At long last, 3.1.0 is here. From the version number, you know there are new features in
addition to the usual selection of bug fixes, but do you know how many? Let's take a
o Default MySQL version now 5.1, having entered GA since 3.0.9.
o Lots of platform updates tracked, lots of warnings from newer
compilers squished. Most by me, some by Adrian Cornish.
o Added Query::insertfrom(), plus associated classes SQLStream,
NoTransactions, and the InsertPolicy hierarchy. Also adds
examples/ssqls6.cpp, which shows how to use this new feature.
Thanks for this feature go to Rick Gutleber, except for
RowCountInsertPolicy, by me.
o Added comparison operators to tiny_int<T>. Thanks for this patch
go to Edward Diener.
o Added SQLTypeAdapter::is_null(). This lets you retrieve a
nullable column from the DB, then re-insert a value from that
column back into the DB via a template query without explicit
checks for null-ness; it will do the right thing now.
o Added -f flags to lib/*.pl header file generating scripts to
allow overriding the default limit of 25 fields for tqueries
and SSQLSes without having to edit the file, as in previous
versions of MySQL++. Also added --with-field-limit option to
the configure script so you can give both -f options at once
during the build process. This latter is especially useful
for automated binary package builders.
o The file lib/querydef.h (generated by lib/querydef.pl) now
defines the MYSQLPP_TQUERY_MAX_PARAMETERS macro, giving the
maximum number of parameters the functions in the generated file
allow for template queries. Similarly, lib/ssqls.h (generated
by lib/ssqls.pl) defines MYSQLPP_SSQLS_MAX_MEMBERS.
o Added ConnectionPool::safe_grab(), which pings the grabbed
connection before returning it. If the ping fails, we remove
the dead connection from the pool and try again. This doesn't
eliminate the possibility of returning a dead connection;
there is no protection against race conditions. It is merely
a best-effort attempt.
o Added ConnectionPool::remove(Connection*), which removes a
connection from the pool.
o Added ConnectionPool::exchange(), which wraps remove()
o Added a feature to Transaction, where it can send a SET
TRANSACTION ISOLATION LEVEL query before it starts the
transaction proper, affecting the isolation level and the scope
of that change.
o Added ScopedConnection class. Initial version by Joel Fielder,
lots of changes by me. Using it instead of explicit safe_grab()
and release() calls on the pool in examples/cpool.cpp.
o Added FieldNames::operator(size_type) overloads. This is
necessary to correctly overload the base class versions inherited
o FieldNames wasn't doing field-by-name matches case insentitively,
most likely since 3.0.0 when we changed it to derive from
std::vector. This caused SSQLS (at least) to be case sensitive.
Fixed this and renamed the stock.sdate field in the SSQLS
examples to stock.sDate to test this.
o Added Query::replace(iter, iter), on the model of existing
insert(iter, iter). Thanks for this patch go to David Walthour.
o Added Query::operator!(), overriding basic_ios version so that
"if (!query)" does the right thing. Fixes problem report in
o Query copy ctor and assignment operator now perform deeper
copies, so you can pass Query objects around in certain ways
that used to cause crashes. Thanks for this patch go to Steven
o Defined *_null variants for every sql_* typedef, wrapping
all those earlier types in Null<>. All example programs now use
these types instead of explicit Null<>-wrapped types.
o Created a C++ command line parsing mechanism for the examples
today, and for programs coming in the future. It uses the
platform version of getopt() if available, substituting a
public-domain implementation that gets built into MySQL++
itself otherwise. It's documented in the refman -- see
the CommandLineBase class -- but it's in the newly created
mysqlpp::internal namespace, which means we don't promise any
sort of ABI or API stability for it. You're welcome to use it
in your own programs, but expect it to change without warning.
o Added a few missing MYSQLPP_EXPORTs to operator<<()s for stream
manipulators, to allow their use when MySQL++ is built as a DLL.
o Added backticks around table and column identifiers in all
code paths exercised by dtest. There are some others remaining,
particularly things like Row::field_list(). Thanks for this
patch go to Adrian Cornish.
o Added mysqlpp::NOW() which returns a value that, when inserted
into a SQL query, results in a call to SQL's NOW() function.
DateTime::now() -- added in 3.0.0 -- does the same thing,
but this is shorter and matches the SQL syntax.
o Calling DBDriver::disconnect() twice no longer calls
o Worked around a weakness on Windows that caused problems in code
with a connect(), disconnect(), connect() call pattern, when
also using a named pipe to connect to the DB. (There never
has been a problem with this on other platforms or with other
o Initializing a SQLTypeAdapter with a floating-point value
equal to infinity or NaN results in SQL null if the type
is also nullable, or 0 otherwise. Previously, we got an
implementation-defined string, which could give invalid SQL,
or could give 0, a different value from NaN, infinity, or
SQL null. This does collapse the notions of NaN and infinity,
but the MySQL reference manual doesn't say how you're supposed
to preserve these differences.
o Removed the dependency of stadapter.h on sql_types.h, just to get
sql_tinyint*. #including tinyint.h instead, and using equivalent
types to what sql_types.h defines. This is necessary because
sql_types.h should be one of the last things included from
mysql++.h, so that it can define sql_* equivalents for everything
else in MySQL++, which means all those other things need to be
#included by that point.
o The "find MySQL++" autoconf macro (config/mysql++.m4) now
searches for the library in lib64 subdirectories everywhere it
also looks in lib. We did this for the C API finder macro way
back in MySQL++ 2.2.0, and only neglected to do it for this
macro because it's not used by MySQL++ itself, just provided
as a courtesy to MySQL++ users that also use autoconf.
o Also improved the "find C API" macro (config/mysql_loc.m4)
so it, too, is more useful in third-party projects.
o Moved private FieldNames::str_to_lwr() method out into its
own module, in the new mysqlpp::internal namespace, so other
modules can use it. Also added an overload for this new global
method taking std::string instead of char*.
o userman build process can now find FOP when installed from
the standard Ubuntu/Debian package repository.
o No longer generating refman.pdf. It's difficult to generate
properly on some platforms, and isn't all that useful anyway
compared to the HTML version, which builds properly everywhere.
o Dropped custom.h backwards-compatibility header. (Deprecated
over a year ago in MySQL++ 3.0.0.)
o Fixed a bad pointer access crash in Connection::set_option()
triggered when the option set call fails. Thanks for this
patch go to Kevin Regan.
o ReconnectOption behavior now knows about a fix in MySQL 5.1.6 and
newer that lets you set it either before the connection is up,
or after. If you try to set this option when MySQL++ is built
against earlier versions of the MySQL C API, it will refuse to
set the option because it knows the option will be reset when
the connection comes up.
o No longer trying to make the C API library read from a "my"
options file before connect. It does that by default, and
the file is supposed to be .my.cnf anyway.
o Reworked the load_jpeg example code for clarity, extracting
load_jpeg_file() routine as an implementation detail and
making that use the C++ stringstream "slurp into string" idiom
instead of allocating a C char buffer and copying that into
o Restored support for repeating query parameters. Apparently
you could say things like "stuff %0 morestuff %0" in v2.1,
but this was broken by initial 1-parameter fixes in v2.2.
This patch reportedly lets us have both things at once, and
improves handling of 1-parameter template queries in general.
Thanks for this patch go to Martin Gallwey.
o Added examples/tquery4.cpp based on test code and feedback
o Put Comparable class in namespace mysqlpp, where it should always
have been. Aside from being just plain wrong, it caused a
conflict with Boost if you used its Comparable class and hoist
them both into the global namespace. Thanks for this patch go
to Michael Radzewitz.
o Fixed all the known problems with the Xcode project files.
o Skeletal support for SSQLS v2. Doesn't do anything useful
yet, it just got caught up in the need to release 3.1 as-is.
o Various enhancements to the test suite.
o Many, many documentation enhancements.
I am both happy and ashamed of this. :) Happy to get it out, ashamed that I have put it
off so long that I end up dumping such a big ball of stuff on y'all all at once. I'll
try to get back to smaller, more regular releases.
As always, it's available at http://tangentsoft.net/mysql++/