libtabula

Check-in [7d3a624647]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merged trunk changes in
Timelines: family | ancestors | descendants | both | mysql-type-info
Files: files | file ages | folders
SHA1: 7d3a6246470ea7c6f14c2a462ac289dc8c199a85
User & Date: etr 2015-08-10 23:38:15
Context
2015-08-11
03:32
Merged exrun OS X fixes in check-in: fb36fd8453 user: tangent tags: mysql-type-info
2015-08-10
23:38
Merged trunk changes in check-in: 7d3a624647 user: etr tags: mysql-type-info
23:34
Moved the "tags" target to the top level. It's no use down in src. check-in: 0c16a98c03 user: etr tags: trunk
21:54
Comment tweak check-in: 41713dfd16 user: etr tags: mysql-type-info
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to CMakeLists.txt.

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
81
82
83
84
85
86
87


















88
89
90
91
92
93
94
...
121
122
123
124
125
126
127














#   - Cygwin
#   - CentOS 3?
#   - OpenIndiana
#
# - For each success above with CMake < 2.6, lower minimum requirement
#
# - Convert non-core top-level targets
#   - tags
#   - dist
#   - rpm/deb/ebuild; CPack?
#   - abicheck
#
# ---------------------

cmake_minimum_required(VERSION 2.6)

include(CheckSymbolExists)
................................................................................
project(libtabula)
set(LIBTABULA_VERSION_MAJOR  3)
set(LIBTABULA_VERSION_MINOR  9)
set(LIBTABULA_VERSION_BUGFIX 9)
set(LIBTABULA_VERSION_TWEAK  1)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)



















set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)

find_package(Threads)
if (CMAKE_HAVE_THREADS_LIBRARY)
	set(MYSQL_C_API_LIBRARY mysqlclient_r)
................................................................................
add_subdirectory(src)
add_subdirectory(src/ssx)
add_subdirectory(test)
add_subdirectory(examples)

add_custom_target(dtest
	COMMAND ${PROJECT_SOURCE_DIR}/dtest -u test -p test)





















<
<
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
62
63
64
65
66
67
68


69
70
71
72
73
74
75
76
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#   - Cygwin
#   - CentOS 3?
#   - OpenIndiana
#
# - For each success above with CMake < 2.6, lower minimum requirement
#
# - Convert non-core top-level targets


#   - dist/rpm/deb/ebuild... via CPack
#   - abicheck
#
# ---------------------

cmake_minimum_required(VERSION 2.6)

include(CheckSymbolExists)
................................................................................
project(libtabula)
set(LIBTABULA_VERSION_MAJOR  3)
set(LIBTABULA_VERSION_MINOR  9)
set(LIBTABULA_VERSION_BUGFIX 9)
set(LIBTABULA_VERSION_TWEAK  1)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)

# Try to find some kind of "stdint" type header.
find_path(LIBTABULA_HAVE_CSTDINT cstdint)
if (LIBTABULA_HAVE_CSTDINT)
	message("found C++11's <cstdint> header")
else()
	find_path(LIBTABULA_HAVE_BOOST_CSTDINT boost/cstdint.hpp)
	if (LIBTABULA_HAVE_BOOST_CSTDINT)
		message("found <boost/cstdint.hpp>")
	else()
		find_path(LIBTABULA_HAVE_STDINT_H stdint.h)
		if (LIBTABULA_HAVE_STDINT_H)
			message("found C99's <stdint.h>; hope we can use it in C++")
		else()
			message(SEND_ERROR "WARNING: no 'stdint' type header found!")
		endif()
	endif()
endif()

set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)

find_package(Threads)
if (CMAKE_HAVE_THREADS_LIBRARY)
	set(MYSQL_C_API_LIBRARY mysqlclient_r)
................................................................................
add_subdirectory(src)
add_subdirectory(src/ssx)
add_subdirectory(test)
add_subdirectory(examples)

add_custom_target(dtest
	COMMAND ${PROJECT_SOURCE_DIR}/dtest -u test -p test)

# If ctags is present, add a top-level "tags" target which includes all
# files in both the build and source versions of src/*.  Conditional
# since it isn't always present on *ix, and almost never on Windows.
find_program(CTAGS_PATH ctags)
if (CTAGS_PATH)
    message(STATUS "Found ctags: ${CTAGS_PATH}")
	set_source_files_properties(tags PROPERTIES GENERATED true)
	add_custom_target(tags 
			COMMAND ctags -R --c++-kinds=+p --fields=+iaS --extra=+q 
				${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
			COMMENT "Generating tags file..."
			WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif(CTAGS_PATH)

Changes to HACKERS.md.

6
7
8
9
10
11
12
13
14
15





16
17
18
19
20
21
22
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39




40
41
42
43
44
45
46
47
48
49
50
51
52





















53
54
55
56
57
58
59
60
61
























62
63
64
65
66
67
68
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105











106
107
108
109
110
111
112
...
295
296
297
298
299
300
301



Code Repository Access
----
libtabula 4.0 and newer uses the [Fossil][1] [distributed version
control system][2].

To clone the code repository, say:

    $ fossil clone http://libtabula.org/code libtabula.fossil






That will get you a file called `libtabula.fossil` containing the
full history of libtabula from just after the MySQL++ 3.2.1 fork.

(If you need to dig into libtabula's history prior to the fork,
see the instructions in [the MySQL++ equivalent to this file][3].)

................................................................................

Then to "open" the repo clone so you can hack on it, say:

    $ mkdir libtabula
    $ cd libtabula
    $ fossil open ../libtabula.fossil

As with libtabula.fossil, you can call the working directory
anythihg you like.  I actually prefer a tree like this:

    museum/                    # Where fossils are kept
        libtabula.fossil
    src/                       # Working tree for software projects
        libtabula/
            skull/             # Fossil head, get it?   I crack me up.




            4.0.0/             # Release branch checkout
        mysql++/
            head/              # Gna! MySQL++ svn trunk checkout
            3.2.1/             # Release tarball unpacked

Fossil will let you make any modifications you like to your local
repository copy.  For those with privileges on the upstream
copy, checkins get automatically synced with it by default.
(If you prefer Git or Mercurial style two-phase commits, you
can say `fossil settings autosync off`.)  If you don't have such
permissions, you just modify your local copy, then have to merge
in upstream changes when updating your local clone.























Bootstrapping the Library
----

If you are coming to libtabula from MySQL++ and remember having to
bootstrap the library to get it to build from a Subversion checkout,
you can forget all that.  CMake takes care of that for us now.  Just
use the normal build procedures documented in `README-*.md`.



























On Manipulating the Build System Source Files
----

The [CMake build system][4] files are called `CMakeLists.txt`, of
which there are several in the libtabula tree.  These files in turn
................................................................................
change in `examples/CMakeLists.txt`, not the top-level `CMakeLists.txt`
file.


Submitting Patches
----

If you wish to submit a patch to the library, please send it to [the
libtabula mailing list][11], or [create a ticket][12] and attach the
patch to the ticket.  We want patches in unified diff format.

The easiest way to get a unified diff is to check out a copy of the
current libtabula tree as described above.  Then make your change,
and ask Fossil to generate the diff for you:

    $ fossil diff > mychange.patch

If your patch adds new files to the distribution, you can say
`fossil add newfile` before you do the diff, which will include the
contents of that file in the patch.  (You can do this even when
you've checked out the tree anonymously.)  Then say `fossil revert
newfile` to make Fossil forget about the new file.

Please don't submit patches against branches of the repository or
against released versions. libtabula often drifts enough during
development that a patch against anything other than the tip of the
trunk won't apply cleanly.  We have historically not had separate
"development" and "stable" branches; all development happens on the
trunk, so that the branches you find in the libtabula Fossil repo
are really just release tags, not true branch points.













The libtabula Code Style
----

Every code base should have a common code style.  Love it or
hate it, here are libtabula's current code style rules:
................................................................................
[7]:  http://cygwin.com/setup-x86_64.exe
[8]:  http://tomayko.com/writings/that-dilbert-cartoon
[9]:  http://www.vmware.com/appliances/
[10]: http://www.vmware.com/products/player
[11]: http://libtabula.org/ml/
[12]: http://libtabula.org/code/tktnew
[13]: http://linux.die.net/man/1/indent








|


>
>
>
>
>







 







|







>
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>







 







>
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
...
360
361
362
363
364
365
366
367


Code Repository Access
----
libtabula 4.0 and newer uses the [Fossil][1] [distributed version
control system][2].

To clone the code repository anonymously, say:

    $ fossil clone http://libtabula.org/code libtabula.fossil

If you have a developer account on libtabula.org's Fossil instance, just
add your username to the URL like so:

    $ fossil clone http://username@libtabula.org/code libtabula.fossil

That will get you a file called `libtabula.fossil` containing the
full history of libtabula from just after the MySQL++ 3.2.1 fork.

(If you need to dig into libtabula's history prior to the fork,
see the instructions in [the MySQL++ equivalent to this file][3].)

................................................................................

Then to "open" the repo clone so you can hack on it, say:

    $ mkdir libtabula
    $ cd libtabula
    $ fossil open ../libtabula.fossil

As with `libtabula.fossil`, you can call the working directory
anythihg you like.  I actually prefer a tree like this:

    museum/                    # Where fossils are kept
        libtabula.fossil
    src/                       # Working tree for software projects
        libtabula/
            skull/             # Fossil head, get it?   I crack me up.
            trunk -> skull/    # Alias to match Fossil branch naming
                build/         # Build directory for the skull/trunk
            some-branch/       # Separately-opened working branch
                build/         # Build directory for the working branch
            4.0.0/             # Release branch checkout
        mysql++/
            head/              # Gna! MySQL++ svn trunk checkout
            3.2.1/             # Release tarball unpacked

Fossil will let you make any modifications you like to your local
repository copy.  For those with privileges on the upstream
copy, checkins get automatically synced with it by default.
(If you prefer Git or Mercurial style two-phase commits, you
can say `fossil settings autosync off`.)  If you don't have such
permissions, you just modify your local copy, then have to merge
in upstream changes when updating your local clone.

Developers are expected to make all nontrivial changes on a branch,
rather than check such changes directly into the trunk.  Once we have
discussed the change on the mailing list and resolved any isssues with
the experimental branch, it will be merged into the trunk.

Creating a branch in Fossil is scary-simple, to the point that those
coming from other version control systems may ask, "Is that really all
there is to it?"  Yes, really, this is it:

    $ fossil checkin --branch new-branch-name

That is to say, you make your changes as you normally would; then when
you go to check them in, you give the `--branch` option to the
`ci/checkin` command to put the changes on a new branch, rather than add
them to the same branch the changes were made against.

At some point, the trunk version becomes the next major version.  Stable
versions become either tags or branches.  (The only difference between
tags and branches in Fossil is that branches may have subsequent changes
made to them.)


Bootstrapping the Library
----

If you are coming to libtabula from MySQL++ and remember having to
bootstrap the library to get it to build from a Subversion checkout,
you can forget all that.  CMake takes care of that for us now.  Just
use the normal build procedures documented in `README-*.md`.


CMake Build Directories
----

Although the Bakefile + Autotools based build system allowed separate
source and object file trees, it was not the standard way of working on
MySQL++. If you say something like `./bootsrap && make && make install`,
you get what is called an in-tree build.

CMake works best with out-of-tree builds.  Therefore, the standard
commands after you have "opened" the libtabula Fossil repository are:

    $ mkdir build
    $ cd build
    $ cmake ..

Once CMake has generated the `Makefiles`, you can run `make` as normal.

You may prefer parallel build and source trees to the above nested
scheme.  This works as you would expect:

    $ mkdir ../build
    $ cd ../build
    $ cmake ../trunk


On Manipulating the Build System Source Files
----

The [CMake build system][4] files are called `CMakeLists.txt`, of
which there are several in the libtabula tree.  These files in turn
................................................................................
change in `examples/CMakeLists.txt`, not the top-level `CMakeLists.txt`
file.


Submitting Patches
----

The simplest way to send a change to libtabula is to say this after
developing your change against the trunk of libtabula:

    $ fossil diff > my-changes.patch

Then attach that file to a new [mailing list][11] message.

If your change is more than a small patch, `fossil diff` might not
incorporate all of the changes you have made. The old unified `diff`
format can't encode branch names, file renamings, file deletions, tags,
checkin comments, and other Fossil-specific information. For such
changes, it is better to send a Fossil bundle:

    $ fossil checkin --branch my-changes
    $ fossil bundle export --branch my-changes my-changes.bundle

The checkin command will fail on the "autosync" step if you did an
anonymous checkout of the libtabula Fossil repo, but your changes will
get stored in a new branch.  The "bundle" feature of Fossil takes that
branch and packs just your changes up into a file that one of the
developers can temporarily attach to their local repository, then apply
if they approve the changes.

Because you are working on a branch on your private copy of the
libtabula Fossil repository, you are free to make as many checkins as
you like on the new branch before giving the `bundle export` command.

Contributors with a history of providing quality patches/bundles can
apply to get a developer login on [the repository][14].

Please make your patches or experimental branch bundles against the tip
of the current trunk.  libtabula often drifts enough during development
that a patch against a stable release may not apply to the trunk cleanly
otherwise.


The libtabula Code Style
----

Every code base should have a common code style.  Love it or
hate it, here are libtabula's current code style rules:
................................................................................
[7]:  http://cygwin.com/setup-x86_64.exe
[8]:  http://tomayko.com/writings/that-dilbert-cartoon
[9]:  http://www.vmware.com/appliances/
[10]: http://www.vmware.com/products/player
[11]: http://libtabula.org/ml/
[12]: http://libtabula.org/code/tktnew
[13]: http://linux.die.net/man/1/indent
[14]: http://libtabula.org/code/

Changes to examples/CMakeLists.txt.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
# CMakeLists.txt - Tells CMake how to build the libtabula examples on
#      supported platforms.  See ../CMakeLists.txt for system-wide
#      matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014 by Warren Young

# Copyright © 2015 by Educational Technology Resources, Inc.
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#






|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# CMakeLists.txt - Tells CMake how to build the libtabula examples on
#      supported platforms.  See ../CMakeLists.txt for system-wide
#      matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
# Copyright © 2015 by Educational Technology Resources, Inc.
# Copyright © 2015 by Educational Technology Resources, Inc.
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#

Changes to src/CMakeLists.txt.

1
2
3
4
5
6

7
8
9
10
11
12
13
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# src/CMakeLists.txt - Tells CMake how to build libtabula proper
#    See ../CMakeLists.txt for system-wide matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014 by Warren Young

#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

set(QUERYDEF_PL "${CMAKE_SOURCE_DIR}/src/querydef.pl")
add_custom_command(OUTPUT querydef.h
	COMMAND ${QUERYDEF_PL}
	DEPENDS ${QUERYDEF_PL}
	COMMENT "Generating querydef.h..."
	WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src")

set(SSQLS_PL "${CMAKE_SOURCE_DIR}/src/ssqls.pl")
add_custom_command(OUTPUT ssqls.h
	COMMAND ${SSQLS_PL}
	DEPENDS ${SSQLS_PL}
	COMMENT "Generating ssqls.h..."
	WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src")

add_library(tabula SHARED



    beemutex.cpp
    cmdline.cpp
    connection.cpp
    cpool.cpp
    datetime.cpp
    dbdriver.cpp
    field_names.cpp
    field_type.cpp
    field_types.cpp
    libtabula.cpp
    manip.cpp
    myset.cpp
    mystring.cpp
	mysql/driver.cpp
	mysql/ft.cpp
    null.cpp
    options.cpp
    qparms.cpp
    query.cpp
	querydef.h
    result.cpp
    row.cpp
    scopedconnection.cpp
    sql_buffer.cpp
    sqlstream.cpp
    ssqls.h
    ssqls2.cpp
    stadapter.cpp
    tcp_connection.cpp
    transaction.cpp
    uds_connection.cpp
    utility.cpp
    vallist.cpp
    wnp_connection.cpp
)
target_link_libraries(tabula ${MYSQL_C_API_LIBRARY})





|
>







 







|
|
|
|



|
|
|
|


>
>
>













|





<





<










1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

66
67
68
69
70

71
72
73
74
75
76
77
78
79
80
# src/CMakeLists.txt - Tells CMake how to build libtabula proper
#    See ../CMakeLists.txt for system-wide matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
# Copyright © 2015 by Educational Technology Resources, Inc.
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

set(QUERYDEF_PL "${CMAKE_SOURCE_DIR}/src/querydef.pl")
add_custom_command(OUTPUT querydef.h
    COMMAND ${QUERYDEF_PL}
    DEPENDS ${QUERYDEF_PL}
    COMMENT "Generating querydef.h..."
    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src")

set(SSQLS_PL "${CMAKE_SOURCE_DIR}/src/ssqls.pl")
add_custom_command(OUTPUT ssqls.h
    COMMAND ${SSQLS_PL}
    DEPENDS ${SSQLS_PL}
    COMMENT "Generating ssqls.h..."
    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src")

add_library(tabula SHARED
    querydef.h
    ssqls.h

    beemutex.cpp
    cmdline.cpp
    connection.cpp
    cpool.cpp
    datetime.cpp
    dbdriver.cpp
    field_names.cpp
    field_type.cpp
    field_types.cpp
    libtabula.cpp
    manip.cpp
    myset.cpp
    mystring.cpp
    mysql/driver.cpp
	mysql/ft.cpp
    null.cpp
    options.cpp
    qparms.cpp
    query.cpp

    result.cpp
    row.cpp
    scopedconnection.cpp
    sql_buffer.cpp
    sqlstream.cpp

    ssqls2.cpp
    stadapter.cpp
    tcp_connection.cpp
    transaction.cpp
    uds_connection.cpp
    utility.cpp
    vallist.cpp
    wnp_connection.cpp
)
target_link_libraries(tabula ${MYSQL_C_API_LIBRARY})

Changes to src/common.h.

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

	// Don't let windows.h (via Connector/C) #define min/max
	#define NOMINMAX

	// Stuff for Visual C++ only
#	if defined(_MSC_VER)
#		define LIBTABULA_PLATFORM_VISUAL_CPP
		// MS *still* doesn't ship stdint.h, through VC++ 2008 at least.
		// This means we have to take a wild guess at appropriate
		// integer types in lib/sql_types.h.  See test/inttypes.cpp for
		// tests that check whether we've guessed well.
#		define LIBTABULA_NO_STDINT_H
#		if _MSC_VER < 1400
			// Workarounds for limitations of VC++ 2003 that are fixed
			// in 2005 and later.
#			undef LIBTABULA_QUERY_THISPTR
#			define LIBTABULA_QUERY_THISPTR dynamic_cast<std::ostream&>(*this)
#			undef LIBTABULA_SSQLS_COMPATIBLE
#		elif !defined(_STLP_VERSION) && !defined(_STLP_VERSION_STR)







<
<
<
<
<







54
55
56
57
58
59
60





61
62
63
64
65
66
67

	// Don't let windows.h (via Connector/C) #define min/max
	#define NOMINMAX

	// Stuff for Visual C++ only
#	if defined(_MSC_VER)
#		define LIBTABULA_PLATFORM_VISUAL_CPP





#		if _MSC_VER < 1400
			// Workarounds for limitations of VC++ 2003 that are fixed
			// in 2005 and later.
#			undef LIBTABULA_QUERY_THISPTR
#			define LIBTABULA_QUERY_THISPTR dynamic_cast<std::ostream&>(*this)
#			undef LIBTABULA_SSQLS_COMPATIBLE
#		elif !defined(_STLP_VERSION) && !defined(_STLP_VERSION_STR)

Changes to src/sql_types.h.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
32
33
34
35
36
37
38
39




40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61

























62
63
64
65
66
67
68
69
/// \brief Declares the closest C++ equivalent of each MySQL column type
///
/// The typedefs defined here are only for the "non-NULL" variants.
/// To get nullable versions, wrap the appropriate type in the
/// \c Null<T> template.  See null.h for more information.

/***********************************************************************
 Copyright © 2006-2009 by Educational Technology Resources, Inc.
 Others may also hold copyrights on code in this file.  See the
 CREDITS.txt file in the top directory of the distribution for details.

 This file is part of libtabula.

 libtabula is free software; you can redistribute it and/or modify it
 under the terms of the GNU Lesser General Public License as published
................................................................................
#define LIBTABULA_SQL_TYPES_H_MAIN

#include "common.h"
#include "tiny_int.h"

#include <string>

#if !defined(LIBTABULA_NO_STDINT_H)




#	include <stdint.h>
#endif

namespace libtabula {

#if !defined(DOXYGEN_IGNORE)
// Suppress refman documentation for these typedefs, as they're
// system-dependent.

// Define C++ integer types that are most nearly equivalent to those
// used by the MySQL server.
#if defined(LIBTABULA_NO_STDINT_H)
	// Boo, we're going to have to wing it.

	typedef tiny_int<signed char>	sql_tinyint;
	typedef tiny_int<unsigned char>	sql_tinyint_unsigned;
	typedef signed short			sql_smallint;
	typedef unsigned short			sql_smallint_unsigned;
	typedef signed int				sql_int;
	typedef unsigned int			sql_int_unsigned;
	typedef signed int				sql_mediumint;
	typedef unsigned int			sql_mediumint_unsigned;
	typedef longlong				sql_bigint;

























	typedef ulonglong				sql_bigint_unsigned;
#else
	// Assume a system where C99 is supported in C++ in advance of
	// actual standardization, so we can do this semi-portably.
	//
	// FIXME: The proper way to do this is to also test for <cstdint>,
	// added in C++11, which lets us use std::uint32_t and such.
	typedef tiny_int<int8_t>		sql_tinyint;







|







 







|
>
>
>
>











|
|
>
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/// \brief Declares the closest C++ equivalent of each MySQL column type
///
/// The typedefs defined here are only for the "non-NULL" variants.
/// To get nullable versions, wrap the appropriate type in the
/// \c Null<T> template.  See null.h for more information.

/***********************************************************************
 Copyright © 2006-2009, 2015 by Educational Technology Resources, Inc.
 Others may also hold copyrights on code in this file.  See the
 CREDITS.txt file in the top directory of the distribution for details.

 This file is part of libtabula.

 libtabula is free software; you can redistribute it and/or modify it
 under the terms of the GNU Lesser General Public License as published
................................................................................
#define LIBTABULA_SQL_TYPES_H_MAIN

#include "common.h"
#include "tiny_int.h"

#include <string>

#if defined(LIBTABULA_HAVE_CSTDINT)
#	include <cstdint>
#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
#	include <boost/cstdint.hpp>
#elif defined(LIBTABULA_HAVE_STDINT_H)
#	include <stdint.h>
#endif

namespace libtabula {

#if !defined(DOXYGEN_IGNORE)
// Suppress refman documentation for these typedefs, as they're
// system-dependent.

// Define C++ integer types that are most nearly equivalent to those
// used by the MySQL server.
#if defined(LIBTABULA_HAVE_CSTDINT)
	// Best case: we're using C++11 or newer, so we have official
	// support for C99-like data types in C++.
	typedef tiny_int<std::int8_t>	sql_tinyint;
	typedef tiny_int<std::uint8_t>	sql_tinyint_unsigned;
	typedef std::int16_t			sql_smallint;
	typedef std::uint16_t			sql_smallint_unsigned;
	typedef std::int32_t			sql_int;
	typedef std::uint32_t			sql_int_unsigned;
	typedef std::int32_t			sql_mediumint;
	typedef std::uint32_t			sql_mediumint_unsigned;
	typedef std::int64_t			sql_bigint;
	typedef std::uint64_t			sql_bigint_unsigned;
#elif defined(LIBTABULA_HAVE_BOOST_CSTDINT)
	// Next best case: found the Boost emulation for this C++11 feature
	typedef tiny_int<boost::int8_t>	sql_tinyint;
	typedef tiny_int<boost::uint8_t>sql_tinyint_unsigned;
	typedef boost::int16_t			sql_smallint;
	typedef boost::uint16_t			sql_smallint_unsigned;
	typedef boost::int32_t			sql_int;
	typedef boost::uint32_t			sql_int_unsigned;
	typedef boost::int32_t			sql_mediumint;
	typedef boost::uint32_t			sql_mediumint_unsigned;
	typedef boost::int64_t			sql_bigint;
	typedef boost::uint64_t			sql_bigint_unsigned;
#elif defined(LIBTABULA_HAVE_STDINT_H)
	// We only found the C99 version of this header, so assume we can
	// use it in C++, allowing us to get this feature semi-portably.
	typedef tiny_int<int8_t>		sql_tinyint;
	typedef tiny_int<uint8_t>		sql_tinyint_unsigned;
	typedef int16_t					sql_smallint;
	typedef uint16_t				sql_smallint_unsigned;
	typedef int32_t					sql_int;
	typedef uint32_t				sql_int_unsigned;
	typedef int32_t					sql_mediumint;
	typedef uint32_t				sql_mediumint_unsigned;
	typedef int64_t					sql_bigint;
	typedef uint64_t				sql_bigint_unsigned;
#else
	// Assume a system where C99 is supported in C++ in advance of
	// actual standardization, so we can do this semi-portably.
	//
	// FIXME: The proper way to do this is to also test for <cstdint>,
	// added in C++11, which lets us use std::uint32_t and such.
	typedef tiny_int<int8_t>		sql_tinyint;