MySQL++

Check-in [4b1b3f7c22]
Login

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

Overview
Comment:Version 2.3.2
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | v2.3.2
Files: files | file ages | folders
SHA3-256:4b1b3f7c22dfadbf7a609bdc0b964d6abfffc6ac89e66fb32482eba35d39a720
User & Date: tangent 2007-07-11 21:37:16
Context
2017-09-08
17:17
Moved the AC_PROG_* calls in configure.ac up within the file to avoid warnings about out-of-order macro calls from newer versions of autoconf. This is the first checkin of a sequence made in order to bring the old v2.3.2 release up to modern code standards so that it will build on current (2017) versions of Linux at least. check-in: 89f4526ccc user: tangent tags: v2.3.2-modern
2008-02-29
23:27
Version 3.0.0 check-in: 15a5c82444 user: tangent tags: trunk, v3.0.0
2007-07-11
21:37
Version 2.3.2 check-in: 4b1b3f7c22 user: tangent tags: trunk, v2.3.2
02:29
Version 2.3.1 check-in: c7cfdf08ff user: tangent tags: trunk, v2.3.1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.


















1
2
3
4
5
6



7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22


23
24
25
26
27
28
29
30
31
...
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

















2.3.1, 2007.07.10 (r1659) The "After-the-Fireworks Release"

	o Fixed a problem with SSQLS BLOB handling due to data lifetime
	  issues.  const_string objects now keep a copy of their
	  data, not just a pointer to it.  This is less efficient,
	  but necessary to allow SSQLS to work with BLOBs.




	o Fixed many more embedded null handling problems in manip.h


	o MySQL++ can now optionally reference MySQL C API headers as
	  in a mysql subdirectory, a common thing on *ix systems,
	  by defining MYSQLPP_MYSQL_HEADERS_BURIED before #including
	  mysql++.h.

	o Restored ColData_Tmpl<T>::get_string(), removed in v2.3.0,
	  along with warnings in the docs saying why you don't want
	  to use it, and what your alternatives are.

	o VC++ and MinGW builds now define HAVE_MYSQL_SSL_SET macro,
	  which lets you use the C API's SSL features.	This assumes
	  your C API library does actually include them, which is
	  the case with the official binary releases on Windows.



    o Fixed simple examples-only Makefile generation, for RPMs


2.3.0, 2007.07.02 (r1645)

    o Added Query::for_each() and Query::store_if() methods
      proposed by Joel Fielder, and added examples for each.

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

    o Removed the updel example program.  It was kind of silly,
      and if you were to rewrite it today, you'd use for_each() anyway.

    o Lots of documentation improvements.


2.2.3, 2007.04.17 (r1538) "The Tax Day Release"

    o Previous version left examples/vstudio/* out of the tarball
      by accident.

    o Improved generation of RPM temporary build directory path
      name generation.  Was using a hacked variant of the Fedora
      Packaging Guidelines' second best choice.  Now we're using
................................................................................
      the choice they recommend most highly, without changes.

    o Removed unnecessary resources from vstudio/wforms example.

    o Minor URL fix in refman


2.2.2, 2007.04.13 (r1526) "The Nervousmaking Friday the 13th Release"

    o More small fixes to embedded null handling in Query.

    o Fixed a bug in single-parameter template query handling.

    o Added tquery example, to demonstrate proper use of template
      queries.  Previously, resetdb was the only exemplar, and
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|

<
|
|
|
>
>
>

|
>


|







|
|
|
|
>
>

|







 







|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
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
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
2.3.2, 2007.07.11 (r1669)

	o Previous release's const_string change caused more problems
	  than it fixed.  This release contains the real fix. :)

	o New Connection::set_option() handling deals with the multi
	  statements option correctly again.  examples/multiquery now
	  runs again as a result.

	o Added new unit testing script, called dtest.	See the
	  HACKERS file for details.  (This tool caught the previous
	  two problems!)

	o Squished a GCC pedantic warning.  Thanks for the patch go to
	  Andrew Sayers.


2.3.1, 2007.07.10 (r1659) The "After the Fireworks" release


	o const_string objects now keep a copy of their data, not
	  just a pointer to it.  This is less efficient, but necessary
	  to allow SSQLS to work with BLOBs.  Without this, we were
	  seeing segfaults due to accessing freed memory pointed to
	  by the const_string, because the underlying object went
	  out of scope.

	o Fixed many more potential embedded null handling problems
	  in manip.h.

	o MySQL++ can now optionally reference MySQL C API headers as
	  being in a mysql subdirectory, a common thing on *ix systems,
	  by defining MYSQLPP_MYSQL_HEADERS_BURIED before #including
	  mysql++.h.

	o Restored ColData_Tmpl<T>::get_string(), removed in v2.3.0,
	  along with warnings in the docs saying why you don't want
	  to use it, and what your alternatives are.

	o VC++ and MinGW builds now define the HAVE_MYSQL_SSL_SET
	  macro, which lets you use the C API's SSL features.
	  This assumes your C API library does actually have these
	  features enabled, which is the case with the official binary
	  releases on Windows.	(Builds on *ix systems continue to
	  test for these features at configure time.)

    o Fixed simple examples-only Makefile generation, for RPMs.


2.3.0, 2007.07.02 (r1645)

    o Added Query::for_each() and Query::store_if() methods
      proposed by Joel Fielder, and added examples for each.

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

    o Removed the updel example program.  It was kind of silly,
      and if you were to rewrite it today, you'd use for_each() anyway.

    o Lots of documentation improvements.


2.2.3, 2007.04.17 (r1538) The "Tax Day" release

    o Previous version left examples/vstudio/* out of the tarball
      by accident.

    o Improved generation of RPM temporary build directory path
      name generation.  Was using a hacked variant of the Fedora
      Packaging Guidelines' second best choice.  Now we're using
................................................................................
      the choice they recommend most highly, without changes.

    o Removed unnecessary resources from vstudio/wforms example.

    o Minor URL fix in refman


2.2.2, 2007.04.13 (r1526) The "Nervousmaking Friday the 13th" release

    o More small fixes to embedded null handling in Query.

    o Fixed a bug in single-parameter template query handling.

    o Added tquery example, to demonstrate proper use of template
      queries.  Previously, resetdb was the only exemplar, and

Changes to HACKERS.

43
44
45
46
47
48
49























50
51
52
53
54
55
56

    The diff command is part of every Unix and Linux system, and
    should be installed by default.  If you're on a Windows machine,
    GNU diff is part of Cygwin (http://cygwin.com/).  Subversion is
    also available for all of these systems.  There are no excuses
    for not being able to make unified diffs.  :)

























Adding Support for a Different Compiler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MySQL++ uses the Bakefile system for creating project files
    and makefiles.  This allows us to make changes to a single set
    of files, and have the proper changes be made to all generated
    project files and makefiles.  In the past, we used more ad-hoc







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







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

    The diff command is part of every Unix and Linux system, and
    should be installed by default.  If you're on a Windows machine,
    GNU diff is part of Cygwin (http://cygwin.com/).  Subversion is
    also available for all of these systems.  There are no excuses
    for not being able to make unified diffs.  :)


Testing Your Proposed Change
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In v2.3.2, we added a new script called 'dtest'.  You run it
    like you would most of the examples, except that you don't need
    to run it via exrun:

        $ ./dtest [host] [user] [pass]

    This automatically runs most of the examples, captures the outputs
    to a file, and then compares that to a known-good run's outputs.
    The purpose of this is that, before you submit a patch, run dtest
    and see if it indicates that anything has changed.  If something
    has and you can't account for it, it represents a problem that
    you'll have to fix before submitting the patch.

    If your change purposely causes different outputs from a dtest
    run, remove the bmark.txt file, then re-run dtest and include
    the bmark.txt diffs with your patch.  This communicates to us
    the fact that you know there are differences and want the patch
    evaluated anyway.  Otherwise, we are likely to view the change
    as a bug.


Adding Support for a Different Compiler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MySQL++ uses the Bakefile system for creating project files
    and makefiles.  This allows us to make changes to a single set
    of files, and have the proper changes be made to all generated
    project files and makefiles.  In the past, we used more ad-hoc

Changes to configure.ac.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# You should have received a copy of the GNU Lesser General Public
# License along with MySQL++; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

# Standard autotools stuff
AC_INIT(mysql++, 2.3.1, plusplus@lists.mysql.com, mysql++)
AC_CONFIG_HEADER(config.h)
AC_DISABLE_STATIC
AC_CANONICAL_SYSTEM


# Break package version up into major, minor and bugfix components.
MYSQLPP_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -f1 -d.`







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# You should have received a copy of the GNU Lesser General Public
# License along with MySQL++; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

# Standard autotools stuff
AC_INIT(mysql++, 2.3.2, plusplus@lists.mysql.com, mysql++)
AC_CONFIG_HEADER(config.h)
AC_DISABLE_STATIC
AC_CANONICAL_SYSTEM


# Break package version up into major, minor and bugfix components.
MYSQLPP_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -f1 -d.`

Changes to lib/connection.cpp.

176
177
178
179
180
181
182









183
184
185
186
187
188
189
...
519
520
521
522
523
524
525







526
527
528




529
530
531
532
533
534
535
	// Set defaults for certain connection options.  User can override
	// these by calling set_option() before connect().
	set_option_default(opt_read_default_file, "my");
	set_option_default(opt_connect_timeout, connect_timeout);
	if (compress) {
		set_option_default(opt_compress);
	}










	// Establish connection
	scoped_var_set<bool> sb(connecting_, true);
	if (mysql_real_connect(&mysql_, host, user, passwd, db, port,
			socket_name, client_flag)) {
		unlock();
		success_ = is_connected_ = true;
................................................................................
	switch (option) {
#if MYSQL_VERSION_ID >= 40101
		case opt_secure_auth:
			success = set_option_impl(MYSQL_SECURE_AUTH, &arg);
			break;

		case opt_multi_statements:







			success = set_option_impl(arg ?
					MYSQL_OPTION_MULTI_STATEMENTS_ON :
					MYSQL_OPTION_MULTI_STATEMENTS_OFF);




			break;
#endif
#if MYSQL_VERSION_ID >= 50003
		case opt_report_data_truncation:
			success = set_option_impl(MYSQL_REPORT_DATA_TRUNCATION, &arg);
			break;
#endif







>
>
>
>
>
>
>
>
>







 







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







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
	// Set defaults for certain connection options.  User can override
	// these by calling set_option() before connect().
	set_option_default(opt_read_default_file, "my");
	set_option_default(opt_connect_timeout, connect_timeout);
	if (compress) {
		set_option_default(opt_compress);
	}

#if MYSQL_VERSION_ID >= 40101
	// Check to see if user turned on multi-statements before
	// establishing the connection.  This one we handle specially, by
	// setting a flag during connection establishment.
	if (option_set(opt_multi_statements)) {
		client_flag |= CLIENT_MULTI_STATEMENTS;
	}
#endif

	// Establish connection
	scoped_var_set<bool> sb(connecting_, true);
	if (mysql_real_connect(&mysql_, host, user, passwd, db, port,
			socket_name, client_flag)) {
		unlock();
		success_ = is_connected_ = true;
................................................................................
	switch (option) {
#if MYSQL_VERSION_ID >= 40101
		case opt_secure_auth:
			success = set_option_impl(MYSQL_SECURE_AUTH, &arg);
			break;

		case opt_multi_statements:
			// If connection is up, set the flag immediately.  If not,
			// and caller wants this turned on, pretend success so that
			// we store the info we need to turn this flag on when
			// bringing the connection up.  (If the caller is turning it
			// off before conn comes up, we effectively ignore this, 
			// because that's the default.)
			if (connected()) {
				success = set_option_impl(arg ?
						MYSQL_OPTION_MULTI_STATEMENTS_ON :
						MYSQL_OPTION_MULTI_STATEMENTS_OFF);
			}
			else {
				success = arg;
			}
			break;
#endif
#if MYSQL_VERSION_ID >= 50003
		case opt_report_data_truncation:
			success = set_option_impl(MYSQL_REPORT_DATA_TRUNCATION, &arg);
			break;
#endif

Changes to lib/connection.h.

475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
	std::ostream& api_version(std::ostream& os);

protected:
	/// \brief Types of option setting errors we can diagnose
	enum OptionError {
		opt_err_type,
		opt_err_value,
		opt_err_conn,
	};
	
	/// \brief Drop the connection to the database server
	///
	/// This method is protected because it should only be used within
	/// the library.  Unless you use the default constructor, this
	/// object should always be connected.







|







475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
	std::ostream& api_version(std::ostream& os);

protected:
	/// \brief Types of option setting errors we can diagnose
	enum OptionError {
		opt_err_type,
		opt_err_value,
		opt_err_conn
	};
	
	/// \brief Drop the connection to the database server
	///
	/// This method is protected because it should only be used within
	/// the library.  Unless you use the default constructor, this
	/// object should always be connected.

Changes to lib/const_string.h.

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
	}
	
	/// \brief Initialize string from existing C++ string
	const_string(const std::string& str) :
	str_data_(0),
	length_(str.length())
	{
		str_data_ = new char[length_];
		memcpy(str_data_, str.data(), length_);

	}
	
	/// \brief Initialize string from existing C string
	const_string(const char* str) :
	str_data_(0),
	length_(size_type(strlen(str)))
	{
		str_data_ = new char[length_];
		memcpy(str_data_, str, length_);

	}
	
	/// \brief Initialize string from existing C string of known length
	const_string(const char* str, size_type len) :
	str_data_(0),
	length_(size_type(len))
	{
		str_data_ = new char[length_];
		memcpy(str_data_, str, length_);

	}

	/// \brief Destroy string
	~const_string()
	{
		delete[] str_data_;
	}







|

>







|

>







|

>







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
	}
	
	/// \brief Initialize string from existing C++ string
	const_string(const std::string& str) :
	str_data_(0),
	length_(str.length())
	{
		str_data_ = new char[length_ + 1];
		memcpy(str_data_, str.data(), length_);
		str_data_[length_] = '\0';
	}
	
	/// \brief Initialize string from existing C string
	const_string(const char* str) :
	str_data_(0),
	length_(size_type(strlen(str)))
	{
		str_data_ = new char[length_ + 1];
		memcpy(str_data_, str, length_);
		str_data_[length_] = '\0';
	}
	
	/// \brief Initialize string from existing C string of known length
	const_string(const char* str, size_type len) :
	str_data_(0),
	length_(size_type(len))
	{
		str_data_ = new char[length_ + 1];
		memcpy(str_data_, str, length_);
		str_data_[length_] = '\0';
	}

	/// \brief Destroy string
	~const_string()
	{
		delete[] str_data_;
	}

Changes to mysql++.bkl.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	<set var="BUILDEXAMPLES">yes</set>
	<set var="BUILDLIBRARY">yes</set>
	<set var="HEADER_DIR">$(PREFIX)/include/mysql++</set>

	<if cond="BUILDLIBRARY=='yes'">
		<dll id="mysqlpp">
			<libname>mysqlpp</libname>
			<so_version>2.3.1</so_version>

			<sources>
				lib/coldata.cpp
				lib/connection.cpp
				lib/datetime.cpp
				lib/field_names.cpp
				lib/fields.cpp







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
	<set var="BUILDEXAMPLES">yes</set>
	<set var="BUILDLIBRARY">yes</set>
	<set var="HEADER_DIR">$(PREFIX)/include/mysql++</set>

	<if cond="BUILDLIBRARY=='yes'">
		<dll id="mysqlpp">
			<libname>mysqlpp</libname>
			<so_version>2.3.2</so_version>

			<sources>
				lib/coldata.cpp
				lib/connection.cpp
				lib/datetime.cpp
				lib/field_names.cpp
				lib/fields.cpp