ADDED AUTHORS
Index: AUTHORS
==================================================================
--- /dev/null
+++ AUTHORS
DELETED Bakefiles.bkgen
Index: Bakefiles.bkgen
==================================================================
--- Bakefiles.bkgen
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- ./mysql++.bkl
-
-
-
-
- autoconf,msvc6prj,mingw
-
-
-
- -o$(INPUT_FILE_DIR)/Makefile.mingw
-
-
Index: COPYING
==================================================================
--- COPYING
+++ COPYING
@@ -1,10 +1,1 @@
-The MySQL++ library proper and the reference manual derived from
-comments in the library source code are licensed under the GNU Lesser
-General Public License. A copy is provided in this directory, in the
-file LICENSE.
-
-The MySQL++ User Manual is licensed under a unique license derived from
-the Linux Documentation Project License. (The only changes are due to
-the fact that the User Manual isn't actually part of the LDP, so a lot
-of the language in the LDPL doesn't make sense when applied to the user
-manual.) This license is provided in the file doc/userman/LICENSE.
+/usr/share/automake/COPYING
ADDED COPYRIGHT
Index: COPYRIGHT
==================================================================
--- /dev/null
+++ COPYRIGHT
@@ -0,0 +1,23 @@
+The Mysql++ API is copyright 1998 by Kevin Atkinson and is released
+under the LGPL license for now.
+
+The intent of doing this is allow developers to use my library to
+develop commercial programs and to allow it it be distributed with
+commercial databases.
+
+However if you do use it to develop a commercial program a small
+donation to me would be greatly appreshated. Your donation will will
+encourage me to continue to work on improving this API and also
+encourage me to contune to keep it under the LGPL. Please send
+donations too.
+ Kevin Atkinson
+ 7962 Helmart Dr.
+ Laurel, MD 20723
+
+I reserve the right to change the license to future versions of the
+library if I do not get suffecent pay-back to my work. However, it is
+my promise to you that it will never become more restrictive than the
+GPL (not LGPL) licence.
+
+You can contact me at kevinatk@home.com or (301) 498-3290 or at
+7962 Helmart Dr./Laurel, MD 20723.
DELETED CREDITS
Index: CREDITS
==================================================================
--- CREDITS
+++ /dev/null
@@ -1,85 +0,0 @@
-MySQL++ was created by Kevin Atkinson during 1998. From version 1.0
-(released in June 1999) through 1.7.9 (May 2001), the primary maintainer
-was Sinisa Milivojevic . Neither Kevin nor Sinisa
-are currently involved in MySQL++ development. The current maintainer
-is Warren Young , starting with version 1.7.10 in
-August of 2004.
-
-For a fuller account of the library's history, see the first chapter
-of the user manual. For the nitty-gritty details, see the ChangeLog
-in the root package directory. ChangeLog items since 1.7.9 that
-aren't attributed to anyone else were done by Warren Young.
-
-
-Other contributors of note since 1.7.10:
-
- Chris Frey : Lots of GCC warning fixes for
- the bleeding-edge compiler versions, and Gentoo ebuild support.
- Also, if there were a "steering committee" for MySQL++, he'd be
- on it.
-
- Mark Meredino : Several fixes and
- additions, including a lot of work on Microsoft Visual C++
- compatibility, and discoveries made while spelunking in the
- library.
-
- Evan Wies : Contributed several C++ code
- style cleanups.
-
- Arnon Jalon : Added the multi-query
- result set handling features, and multiquery example to demonstrate
- it.
-
- Korolyov Ilya has submitted several patches in many different
- areas of the library.
-
- Remi Collet is maintaining offical
- RPMs for Fedora, with other systems on the way. His work has
- improved the RPM spec file we distribute greatly.
-
- Joel Fielder came up with the
- original idea for Query::for_each() and Query::store_in(),
- provided the basis for examples/for_each.cpp, and provided
- a fix for exception flag propagation in Query.
-
-
-Here are the personal credits from the old 1.7.9 documentation,
-apparently written by Kevin Atkinson:
-
- Chris Halverson - For helping me get it to compile under Solaris.
-
- Fredric Fredricson - For a long talk about automatic conversions.
-
- Michael Widenius - MySQL developer who has been very supportive of
- my efforts.
-
- Paul J. Lucas - For the original idea of treating the query object
- like a stream.
-
- Scott Barron - For helping me with the shared libraries.
-
- Jools Enticknap - For giving me the Template Queries idea.
-
- M. S. Sriram - For a detailed dission of how the Template Queries
- should be implemented, the suggestion to throw exceptions on bad
- queries, and the idea of having a back-end independent query
- object (ie SQLQuery).
-
- Sinisa Milivojevic - For becoming the new offical maintainer.
-
- D. Hawkins and E. Loic for their autoconf + automake contribution.
-
-
-See the ChangeLog for further credits, and details about the differences
-between the many versions of this library.
-
-
-Please do not email any of these people with general questions about
-MySQL++. All of us who are still active in MySQL++ development read the
-mailing list, so questions sent there do get to us:
-
- http://lists.mysql.com/plusplus
-
-The mailing list is superior to private email because the answers are
-archived for future questioners to find, and because you are likely to
-get answers from more people.
Index: ChangeLog
==================================================================
--- ChangeLog
+++ ChangeLog
@@ -1,1942 +1,54 @@
-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::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 It's now possible to store BLOB data in an SSQLS. It's not
- foolproof, so added a section to the user manual (5.9) to
- document the method. Also, changed examples/cgi_jpeg to use
- this new mechanism, instead of the ugly "raw row data" method
- it used to use.
-
- o Revamped Connection::set_option() handling. These options
- used to be queued up, and applied only just before actually
- establishing the connection. This made error reporting less
- helpful because the diagnostic was separated from the cause.
- Plus, the error messages were misleading to begin with. Now,
- set_option() takes effect immediately if the connection is not
- yet up (excepting one special option that can actually be set
- after the connection is up) and issues better diagnostics when
- it detects errors.
-
- o Connection::connect() used to set a few options in such a
- way that the user couldn't override them. Now it's smart enough
- to set them with the desired default values only when we see
- that the user hasn't given them other values.
-
- o SQLString can now be initialized from a mysqlpp::null,
- giving a "NULL" string. This is useful for template queries.
- Patch by Michael Hanselmann.
-
- o resetdb error message about mixing library and header version
- numbers is now more explicit.
-
- o Changed BadConversion exception's "what" message text to be
- more like the other exceptions. The inconsistency lead one
- to incorrectly copy-paste code from another exception handler,
- expecting it to behave the same way. Now it does.
-
- o Added Row::raw_size(), as a shortcut for Row::at().size().
-
- o ssqls-pretty now detects when it's being run from within
- the MySQL++ distribution tree and gives a different -I flag
- to the compiler, so that it picks up the distribution headers
- instead of those that may be on the system already.
-
- o The quote manipulator now works for char[] correctly.
- Thanks for this patch go to Andrew Sayers. (It's always
- worked for char*, but C++ doesn't consider that to be the
- same type, so it used the generic quote handling path,
- which doesn't do anything for char[].)
-
- o Fixed a build bug on older Solaris versions where the
- test for the C API library was erroneously failing, stopping
- the configuration process.
-
- o Simplified mysql_shutdown() level argument detection.
- Already had to do a version number ifdef check for the
- Windows case, so there's really no point to doing it with
- autoconf on Unixy platforms. Moved version number check
- into lib/connection.cpp, and nuked the separate autoconf and
- Windows tests.
-
- o Removed dependency of sql_types.h on myset.h and (indirectly)
- datetime.h. Now we only define sql_* typedef aliases for those
- MySQL++ types if the headers are included before sql_types.h.
-
- o Fixed a typo in one of the storein_sequence() template
- overloads, which is apparently rarely (or never?) used, because
- no one reported the compiler error you'd get if you tried.
-
- o Fixed a few more embedded null handling problems.
-
- o ColData used to keep two copies of all data it held.
- Now it keeps just one.
-
- o Fixed install.bat script to track the unified Bakefile change
- and the lack of separate debug and release builds under MinGW.
-
- o Yet another STLport + Query memory leak fix.
-
- o Squished a warning in newer GCCs having to do with identifier
- shadowing. Patch by Jonathan Wakely.
-
- o Fixed a null-termination bug in Query::parse(). If you
- somehow constructed a query string without a terminating null
- character, then tried to parse it as a template query, it could
- walk off the end of the string. Patch by Worster Chen.
-
- o Removed MYSQLPP_EXPORT tag from FieldNames and FieldTypes
- class declarations, as this can cause problems in programs
- that use vector in VC++. It has to do with multiply
- defined templates, since these classes derive from that
- template, and VC++ can't resolve the conflict without help.
- Since these classes aren't actually used outside the library,
- this shouldn't cause a problem. Patch by Nils Woetzel.
-
- o Partial fix to Doxygen PDF build on RHEL4 and 5. Needs
- hand-coaxing to complete successfully on RHEL4, and doesn't
- yet work at all on RHEL5.
-
- o Shortened the "no*" options to the bootstrap script, so that
- the usage message fits on a single line.
-
- o Added "nodoc" bootstrap script option, for disabling the
- documentation build during the dist target build. Allows for
- building binary RPMs on CentOS 5.0, where doc building is
- currently broken.
-
- 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
- it wasn't really suited for that. This example also tests
- the previous item.
-
- o Added examples/vstudio/mfc, allowing us to improve the way
- we demonstrate Unicode handling. Old way wasn't realistic.
- On *ix, people will depend on the terminal code to handle
- UTF-8. On Windows, users are almost certain to be writing
- a GUI program, which requires different Unicode handling
- than the old examples showed.
-
- o Removed explicit Unicode conversion stuff from command line
- examples, and reworked the Unicode chapter in the user
- manual.
-
- o Added examples/vstudio/wforms to show integration with
- C++/CLI and Windows Forms. Documented this in README.vc.
-
- o Rewrote load_file and cgi_image examples to be more
- useful, renaming them to load_jpeg and cgi_jpeg along
- the way. Also, resetdb now creates a second table in the
- sample database for these two examples' use. Also, added
- examples/logo.jpg to the distribution as sample data for
- these examples.
-
- o Limited the ostream base class casting stuff in Query to
- VC++ 2003, which is the only platform that really needed it.
- VC++ 2005 emits a warning with that hack in place, and on
- other platforms it's just replicating work that the compiler
- does already.
-
- o Added library version information to main library target
- so that systems that version shared libraries work as
- expected. Thanks for this patch go to Jack Eidsness.
-
- o Merged much of the diffs between Remi Collet's RPM spec file
- into the official one.
-
- o Reorganized the doc subdir a bit. Generated HTML is now all
- under doc/html instead of scattered under other subdirs,
- and renamed doc/README.mysql++ to doc/README.manuals.
-
- o Improvements to top-level manual building make targets:
- manuals now only rebuild at need, it's easier to request
- a rebuild of all manuals, and we force a rebuild attempt
- before building the distribution tarball so we don't ship
- outdated manuals.
-
- o Added ability to run examples under gdb using exrun,
- using same mechanism as we currently have for valgrind.
- Thanks for this patch go to Michael Hanselmann.
-
- o Added "Important Underlying C API Limitations" chapter to the
- user manual, to cover problems we keep seeing on the
- mailing list that are the result of ignorance of the way
- libmysqlclient behaves, not bugs MySQL++ is really in a
- position to fix.
-
-
-2.2.1, 2007.02.28 (r1433)
-
- o Fixed the new localtime() alternative selection code
- for VS2003 and various uses of STLport.
-
- o No longer inserting a null character into the query stream
- on calling one of the preview() functions. This was harmless
- in v2.1, which used C strings more extensively, but began
- causing problems in v2.2 due to its wider use of C++ strings.
-
- o Fixed a bug in the Connection copy ctor where it didn't
- completely initialize the object.
-
- o Optimized Query::preview_char() a bit. Patch by Jonathan
- Wakely.
-
- o Reordered directory list used by autconf when locating the
- MySQL C API library. The list is now ordered with the
- most likely locations for the library first, so we're less
- distracted by incorrect libraries. This fixes a specific
- build error under RHEL4 with recent versions of MySQL 5.0.
-
-
-2.2.0, 2007.01.23 (r1417)
-
- o ColData, const_string, and SQLString can now be constructed
- with an explicit length parameter. Furthermore, Query
- class's execute(), store() and use() call chains terminate
- in a version taking an explicit length parameter, instead
- of one taking a simple C string. Together, this means
- that it's now easier to handle data from the SQL server
- containing nulls. The library is almost certainly not yet
- capable of handling embedded nulls in all cases, but this
- is a big first step towards that.
-
- o Can now construct a DateTime object from a time_t, and
- convert a DateTime back to a time_t. Patch by Korolyov Ilya.
-
- o Changed the way we're handling exported functions in the
- Windows DLL case so that it works more reliably under MinGW.
-
- o Added proper copy semantics to Connection, so that you get a
- new connection with the same parameters, not just a bitwise
- copy of the object.
-
- o Using an explicitly thread-safe variant of localtime() for
- time conversions where one is available.
-
- o Removed ListInsert template from myset.h. This wasn't used
- within the library, and was never documented, so I'm betting
- that no one actually uses it.
-
- o Result::copy() was not copying the exception flag in
- all cases. Fix by Steven Van Ingelgem.
-
- o Added exrun shell script and exrun.bat files to distribution,
- to avoid linkage errors when running the examples while
- you still have an older version of MySQL++ installed.
-
- o Renamed MYSQLPP_LIB_VERSION to MYSQLPP_HEADER_VERSION, as
- what it really encodes is the version number in the mysql++.h
- file you're using, not the actual library version number.
-
- o Added mysqlpp::get_library_version(), which returns the
- library version number at build time. Between this and
- the header version constant, you can check that you're not
- mixing MySQL++ header and library versions.
-
- o resetdb example uses these new version number affordances to
- double-check that you're not mixing libraries and headers
- from different versions. This happens easily unless you
- take care of it (such as by using exrun) when you have one
- version of MySQL++ installed and you're trying to build and
- test a new version without blowing away the old one first
- or overwriting it.
-
- o No longer using recursive Makefiles on Unixy platforms
- or split lib + examples project files on VC++. Everything is
- handled by a single top-level Makefile or project file, which
- is simpler for the end user, and makes better dependency
- management possible.
-
- o When looking for the MySQL C library on systems using
- autoconf, looking in .../lib64 wherever we are also looking
- in .../lib.
-
- o RPM build process no longer depends on Bakefile. It means
- you have to build the examples when building an RPM even
- though they're never used within the RPM, but it's a better
- tradeoff in my opinion.
-
- o Updated include and library paths on Windows to reflect
- changes in the most recent MySQL installers.
-
- o Merged lib/defs.h and lib/platform.h into new file,
- lib/common.h. Just cleans up the library internals.
-
- o Fixed build errors on Windows due to recent changes in MySQL.
-
- o Fixed a few memory leaks and double-deletes in Query class.
-
- o Fixed compatibility with STLPort's string implementation.
- Patch by dengxy at cse.buaa.edu.cn.
-
- o Fixed a compatibility problem between Set<> template and
- SSQLS. Patch by Korolyov Ilya.
-
- o Fixed build bug in SQLQueryParms due to a character
- signedness issue on PowerPC with GCC. Patch by Michael
- Hanselmann.
-
- o ~Transaction() can no longer throw exceptions. It'll just
- quietly eat them, to avoid program termination. Fix
- suggested by Alex Burton.
-
- o Fixed thread safety testing in autoconf case, accidentally
- broken during v2.1.0 development cycle.
-
- o Using Doxygen 1.5.1 to generate documentation.
-
-
-2.1.1, 2006.04.04 (r1289)
-
- o MinGW and Cygwin will now build and link to mysqlpp DLLs.
-
- o Fixed bug in Query, causing it to initialize the "throw
- exceptions" flag incorrectly. Thanks for this patch go to
- Joel Fielder.
-
- o Added -v flag for custom.pl script, which turns off the
- multiply-defined static variable fix. Needed for VS 2003,
- which doesn't support variadic macros. Also, added
- a diagnostic to detect the need for the -v flag, and
- suppressed the test for this feature in examples/util.cpp.
-
-
-2.1.0, 2006.03.24 (r1269)
-
- o Converted automake and makemake files to their equivalents in
- Bakefile format.
-
- o Added the Transaction class, which makes it easy to use
- transaction sets in MySQL++.
-
- o Added xaction example to test new Transaction class.
-
- o Resetdb example now creates its example table using the
- InnoDB storage engine, in order to test the new transaction
- support. Resetdb also declares the table as using UTF-8
- text; this doesn't change anything, but it does correctly
- document what we're doing.
-
- o Added sql_types.h header, containing C++ typedefs
- corresponding to each MySQL column type. Using those new
- types in the type_info module, and in the SSQLS examples.
-
- o Replaced the way we were handling the template query
- version of Query member functions, to allow an arbitrary
- number of template query parameters. By default, we
- now support 25 parameters, up from the old limit of 12.
- It's now possible to change just one number, run a script,
- and have a new limit.
-
- o Connection class does a better job of returning error
- messages if you call certain member functions that depend
- on a connection to the server before the connection is
- established.
-
- o Updated libmysqlclient.def for newer versions of MySQL. (Fixes
- build errors having to do with mysql_more_results() and
- mysql_next_result().
-
- o Replaced final use of strcpy() with strncpy().
-
- o custom.pl now runs without complaint in strict mode, with
- warnings turned on. Thanks for this patch go to "Waba".
-
- o Fixed a bug in custom.pl where incorrect code would be
- generated for some SSQLS set() methods. Thanks for this
- patch go to "Waba".
-
- o SSQLS structures now support long and unsigned long fields.
- Thanks for this patch go to "Waba".
-
- o It's now possible to put SSQLS definitions in a header
- file used by multiple modules in a program without
- getting multiple static member definition errors. See the
- documentation for details. Thanks for this patch go to
- Viktor Stark.
-
- o Moved the definition of the 'stock' SSQLS out of the
- custom*.cpp example files and into a new stock.h file.
- Also, #including that file in the util module to test out
- the new SSQLS multiple static definition fix.
-
- o Using all of the digits of precision guaranteed by the
- IEEE 754 spec when stringizing floating point numbers
- to build queries. Previously, we would use the platform
- default, which can be as few as 6 digits.
-
- o Removed lib/compare.h. Not used within the library, never
- documented, and nobody seems to want to defend it.
-
-
-2.0.7, 2005.11.23 (r1147)
-
- o Added explicit mysqlpp namespace qualifiers to generated code in
- custom*.h so you can use SSQLS in places where it doesn't make
- sense to say "using namespace mysqlpp" before the declaration.
- Also updated some of the examples to not have this "using"
- declaration to make it clear to users that it isn't needed, if you
- want to use explicit namespace qualifiers as well. Thanks for
- this patch to Chris Frey.
-
- o Removed an apparently useless unlock() call from ResUse; there is
- no nearby lock() call, so if this unlock() is in fact necessary,
- it shouldn't be here anyway, because the two calls should be
- nearby each other. Thanks for this patch to Chris Frey.
-
- o Fixed Query ostream initialization bug affecting SunPro CC (at
- least). While this bug violates the Standard, it doesn't affect
- many real compilers because they don't enforce this rule. Fixed
- by Chris Frey.
-
- o Previously, we only used the C99 style "long long" support when
- building under GNU CC. This is now the default. This should
- allow the code to work under SunPro CC.
-
- o Added another dynamic cast needed for proper Query ostream
- subclass overloading under VC++. (7.1 at least...)
-
- o Detecting whether MySQL is built with SSL support on platforms
- using autotools. Needed on some old Sun systems, for instance.
- Thanks for this patch to Ovidiu Bivolaru.
-
- o Fixed a potential memory bug in ColData's conversion to SQL null.
-
- o Many minor packaging tweaks. (README clarifications, file
- permission fixes, better adherence to GNU packaging standards,
- etc.)
-
-
-2.0.6, 2005.09.28 (r1123)
-
- o Fixed makemake.bat so it works on cmd.exe, not just 4NT.
-
- o Documentation fixes.
-
-
-2.0.5, 2005.09.13 (r1114)
-
- o Visual C++ build now requires GNU make. It is tested to work
- with either the Cygwin or the MinGW versions. The previous
- version of MySQL++ used nmake. This change enabled the
- following features:
-
- o Debug and Release versions are both built into
- separate subdirectories.
-
- o Dependency tracking for release version works
- correctly now. (Previously dependencies worked
- only for debug version.)
-
- o 'make clean' removes release version binaries
- in addition to debug versions.
-
- o MinGW makemake support updated to support new release/debug
- subdirectory system. This is probationary support, since
- this code currently can't be built as a DLL. As a result,
- it is no more useful than the Cygwin version, for licensing
- reasons.
-
- o Several fixes to allow building on Solaris 8. These fixes may
- also help on other SVR4-derived systems.
-
- o Removed Borland C++ makemake support, because this version
- of the library does not work completely, and there seems
- to be almost no user interest in fixing it.
-
- o Clarified "Handling SQL Nulls" section of user manual's
- Tutorial chapter.
-
-
-2.0.4, 2005.08.29 (r1076)
-
- o Made mysql_shutdown() second parameter autoconf check less
- sensitive to compiler pedantry.
-
- o VC++ library Makefile is now smart enough to re-create the
- import library, if it is deleted while leaving the DLL alone.
-
- o Added libmysqlclient.def to tarball.
-
- o Reworked most of the top-level README* files.
-
- o Renamed LGPL file to LICENSE.
-
-
-2.0.3, 2005.08.25 (r1060)
-
- o Visual C++ makemake system updated to build both debug and
- release versions of library DLL.
-
- o Fixed bug in simple1 example that caused crashes on Windows.
-
- o Doing UTF-8 to ANSI text translation in simple examples now.
-
- o Previous two releases built libmysqlpp with wrong soname on
- autotools-based systems. Fixed.
-
-
-2.0.2, 2005.08.18 (r1050)
-
- o Fixes to makemake system for cmd.exe.
-
- o Fixed the case where the system's C++ library includes an slist
- implementation in namespace std.
-
-
-2.0.1, 2005.08.17 (r1046)
-
- o Added new simple1 example, showing how to retrieve just one
- column from a table. Old simple1 is now called simple2, and
- simple2 is likewise shifted to simple3.
-
- o Added custom6 example, showing how to do the same thing with
- SSQLS.
-
- o Updated user manual to cover new examples.
-
- o Was accidentally shipping Subversion crap with tarball. Fixed.
-
-
-2.0.0, 2005.08.16 (r1031) The "Excess Hair Removal" release
-
- THIS IS NOT A DROP-IN REPLACEMENT FOR MySQL++ v1.7!
-
- At minimum, you will have to recompile your program against
- this library. You may also have to make code changes.
- Please see the "Incompatible Library Changes" chapter of
- the user manual for a guide to migrating your code to this
- new version:
-
- http://tangentsoft.net/mysql++/doc/userman/html/breakages.html
-
- o The library's shared object file name (soname) scheme has
- changed. (This mainly affects POSIX systems.)
-
- The soname for the last 1.7.x releases of MySQL++ was
- libmysqlpp.so.4, meaning the fourth version of the library's
- application binary interface (ABI). (The first ABI version
- in this scheme was that provided by 1.7.9.) MySQL++
- 2.0.0's soname is libmysqlpp.so.2.0.0. Since the dynamic
- linker setup on some systems will create a symlink to
- that file called libmysqlpp.so.2, it's possible that this
- library could be confused with that for MySQL++ 1.7.19
- through .21, which also used this number. Do not install
- this library on a system which still has binaries linked
- against that version of the library!
-
- The new scheme is {ABI}.{feature}.{bug fix}. That is,
- the first number changes whenever we break the library's
- binary interface; the second changes when adding features
- that do not break the ABI; and the last changes when the
- release contains only internal bug fixes. This means
- that we will probably end up with MySQL++ 3.0 and 4.0 at
- some point, so there will be further soname conflicts.
- Hopefully we can put these ABI changes off long enough
- to avoid any real problems.
-
- o autoconf now installs headers into $prefix/include/mysql++,
- instead of $prefix/include. If you were using the
- --includedir configure script option to get this behavior
- before, you no longer need it.
-
- o Linux binary RPMs will henceforth include only the
- libmysqlpp.so.X.Y.Z file, and create any short names
- required, to allow multiple versions to be installed at
- once. Currently, you cannot install two MySQL++ library
- RPMs at once, because they both have /usr/lib/libmysqlpp.so.X,
- for instance.
-
- o Replaced the Visual C++ and Borland C++ project files with
- a new "makemake" system, which creates Makefiles specific
- to a particular toolchain. This new mechanism also supports
- MinGW and generic GCC-on-*ix. This was done partly to reduce
- the number of places we have to change when changing the
- file names in MySQL++ or adding new ones, and partly so we're
- not tied to one particular version of each of these tools.
-
- o VC++ Makefiles create a DLL version of the library only
- now, so there's no excuse for LGPL violations now.
- This same mechanism should make DLL builds under other
- Windows compilers easy.
-
- o Added Connection::enable_ssl(), which enables encrypted
- connections to the database server using SSL.
-
- o Connection::create_db() and drop_db() now return true on
- success, not false.
-
- o Connection::create_db() and drop_db() use Query::exec()
- now, for efficiency, rather than Query::execute().
-
- o Removed Connection::infoo(). Apparently just there to
- save you from a typo when calling the info() method, since
- it was a mere alias.
-
- o Renamed Connection::real_connect() to connect(), gave
- several more of its parameters defaults, and removed old
- connect() function. Then changed user manual and examples
- to use new APIs.
-
- o Replaced Connection::read_option() with new set_option()
- mechanism. The name change matches the method's purpose
- better. Functional changes are that it returns true on
- success instead of 0, it supports a broader set of options
- than read_option() did, and it enforces the correct option
- argument type.
-
- o You can now call Connection::set_option() before the
- connection is established, which will simply queue the option
- request up until the connection comes up. If you use this
- feature, you should use exceptions, because that's the only
- way an option setting failure can be signalled in this case.
-
- o Removed query-building functions (exec*(), store*(),
- use()) from class Connection, and moved all the implementation
- code to class Query. Query no longer delegates the final
- step of sending the query to the database server to
- Connection().
-
- o Added Connection::enable_ssl(), for turning on SSL support on
- a connection.
-
- o Extracted exception disabling mechanism out of the many
- classes that had the feature into a new OptionalExceptions
- base class, which all classes having this feature now
- derive from. Also, removed all per-method exception
- handling flags. Finally, added NoExceptions class. With
- all of these changes, there is now a common way to disable
- exceptions with fine granularity on all objects that
- support the feature.
-
- o All custom MySQL++ exceptions now derive from the new
- Exceptions class. This regularizes the exception interface
- and allows you to use a single catch() block if you want.
-
- o The "throw exceptions" flag is passed from parent to child
- in all situations now. (Or if not, please report it as
- a bug.) This fulfills a promise made in the v1.7.9 user
- manual, with the cost being that some programs will see
- new exceptions thrown that they're not expecting.
-
- o Added a bunch of new exception types: BadOption,
- ConnectionFailed, DBSelectionFailed, EndOfResults,
- EndOfResultSets, LockFailed, and ObjectNotInitialized.
- Some of these replace the use of BadQuery, which in v1.7.x
- was a kind of generic exception, thrown when something more
- specific wasn't available. Beware, this means that programs
- may start crashing after recompiling them under v2.0 due to
- uncaught exceptions, if they were only trying to catch BadQuery.
-
- There are additional instances where the library will
- throw new exceptions. One is when calling a method that
- forces the internals to use an out-of-bounds index on a
- vector; previously, this would just make the program
- likely to crash. Another is that the library uses the
- BadFieldName exception -- created in v1.7.30 -- in more
- apropos situations.
-
- o Renamed SQLQueryNEParms to BadParamCount, to match naming
- style of other concrete exception types.
-
- o Extracted lock()/unlock() functions from Connection and
- Query classes into a new Lockable interface class. Locking
- is implemented in terms of a different class hierarchy, Lock,
- which allows multiple locking strategies with a single ABI.
-
- o Removed ResUse::eof(). It's based on a deprecated MySQL
- C API feature, and it isn't needed anyway.
-
- o Removed arrow operator (->) for iterator returned by Fields,
- Result and Row containers. It was inherently buggy, because
- a correct arrow operator must return the address of an
- object, but the underlying element access functions in these
- classes (e.g. at()) return objects by value, of necessity.
- Therefore, this operator could only return the address of
- a temporary, which cannot be safely dereferenced.
-
- o Returned Row subscripting to something more like the
- v1.7.9 scheme: there are two operator[] overloads, one for an
- integer (field by index) and another for const char* (field
- by name). lookup_by_name() has been removed. Because row[0]
- is ambiguous again, added Row::at() (by analogy with STL
- sequence containers), which always works.
-
- o Collapsed two of the Row::value_list*() overloads into
- two other similar functions using default parameters.
- This changes the API, but the removed functions aren't
- used within the library, and I doubt they are used outside,
- either.
-
- o Merged RowTemplate into Row.
-
- o Merged SQLQuery class into Query class.
-
- o Query is now derived from std::ostream instead of
- std::stringstream, and we manage our own internal string
- buffer.
-
- o Moved SQLParseElement and SQLQueryParms into their own
- module, qparms.
-
- o Added multiple result set handling to Query. MySQL 4.1
- and higher allow you to give multiple SQL statements in a
- single "store" call, which requires extensions to MySQL++
- so you can iterate through the multiple result sets. Also,
- stored procedures in MySQL 5.0 reportedly return multiple
- result sets. Thanks for the initial patch go to Arnon Jalon;
- I reworked it quite a bit.
-
- o Query::storein*() now supports more varieties of the
- nonstandard slist comtainer. (Singly-linked version of
- STL std::list.)
-
- o Template query mechanism and user manual had several
- mismatches. Made manual match actual behavior, or
- made library match documented behavior, as apropriate.
- Initial patch by Jürgen MF Gleiss, with corrections and
- enhancements by Warren Young.
-
- o Collapsed mysql_* date and time base classes' methods and
- data into the subclasses. Also, DateTime no longer derives
- from Date and Time; you could get away with that in the
- old hierarchy, but now it creates an inheritance diamond,
- and allows unsupported concepts like comparing a Time to
- a DateTime.
-
- o Removed "field name" form of Row::field_list(). It was
- pretty much redundant -- if you have the field names, why
- do you need a list of field names?
-
- o ColData can convert itself to bool now. Thanks for this
- patch go to Byrial Jensen.
-
- o Removed simp_list_b type; wasn't being used, and doesn't
- look to be useful for end-user code.
-
- o Several methods that used to take objects by value now
- do so by const reference, for efficiency.
-
- o Several variable and function renamings so that MySQL++
- isn't needlessly tied to MySQL. Even if we never make
- the library work with other database servers, there's
- little point in tying this library to MySQL blindly.
-
- o Renamed all private data members of MySQL++ classes to
- have trailing underscores.
-
- o 'private' section follows 'public' section in all classes
- now.
-
- o Removed mysql++.hh and sqlplus.hh backwards-compatibility
- headers.
-
- o Added copy ctors to Date/Time classes so that they will
- work in SSQLS under GCC 4.0.0. Without these, the compiler
- couldn't make the conversion from raw MySQL row data.
-
- o Fixed a bunch of GCC 4.0 pedantic warnings: added virtual
- dtors to all base classes, calling base class ctors from leaf
- classes, etc.
-
- o All warnings fixed under VC++ at warning level 3. (Mostly
- harmless signedness and integer conversion stuff.)
-
- o Updated LGPL license/copyright comments at the top of
- several files to use FSF's new physical address.
-
- o Relicensed user manual under a close variant of the Linux
- Documentation Project License, as it's designed for
- documentation, which the LGPL is not. Permission for this
- received from Kevin Atkinson and MySQL AB.
-
- o Added ABI and API breakages chapter to user manual. It
- is basically a subset of this ChangeLog, with only the
- information an end-user must know when migrating between
- versions.
-
- o Reworked user manual's DocBook code quite a bit after
- reading Bob Stayton's book "DocBook XSL" 3/e. Better handling
- of stylesheets, taking advantage of some superior DocBook
- features, prettier output (especially the HTML version), etc.
-
- o Rewrote doc/userman/README to make it clearer how to get
- started contributing to the user manual. It's essentially a
- "getting started with DocBook" guide now!
-
- o Lots of small text improvements to user and reference
- manuals. Aside from the obvious tracking of library changes,
- made a bunch of minor style and clarity improvements.
-
- o Added CSS stylesheets for userman and refman to
- make the HTML versions of each a) not ugly; and b) match
- tangentsoft.net. (Yes, some may say that these are incompatible
- goals....)
-
- o Standardized exception handling code in the examples that
- use it.
-
- o Fixed a potential memory leak due to exceptions thrown from
- ResUse. Thanks for this patch go to Chris Frey.
-
- o Using new "no exceptions" feature of library in simple1
- example, so it is now truly simple.
-
- o simple1 example no longer depends as much on util module, so
- that all of the important code is in one place. Makes
- learning MySQL++ a little less intimidating.
-
- o Added new simple2 and usequery examples, to demonstrate
- the proper way to handle a "use" query, with exceptions
- disabled, and not, respectively. Added them to the user
- manual, in the appropriate place.
-
- o Refactored the "print stock table" example functions
- again, to make code using them clearer.
-
- o UTF-8 to UCS-2 handling in examples is now automatic on
- Windows.
-
- o Removed debug code from Windows Unicode output examples
- that slipped into previous release.
-
- o resetdb example is now clearer, and more robust in the
- face of database errors.
-
- o Simplified connect_to_db() in examples' util module.
-
- o Added sample autoconf macro for finding MySQL++ libraries, for
- people to use in their own autotools-based projects.
-
- o Lots and lots of minor cleanups not worth mentioning
- individually...
-
-
-1.7.40, 2005.05.26 (r719)
-
- o Multiple item form of insert() now works if you're using the
- SQLQuery class, or its derivative, Query. Thanks to Mark
- Meredino for this patch.
-
- o Fixed a bug in const_string::compare(), in which MySQL++
- would walk off the end of the shorter of the two strings.
- All was well if the two were the same length.
-
- o ResUse::operator=() now fully updates the object, so it's more
- like the behavior of the full ctor.
-
- o All source files now contain a license and copyright statement
- somewhere within them.
-
- o Optimized mysql++.h a bit: it now #includes only the minimum set
- of files required, and there is now an idempotency guard.
- This improves compile times a smidge, but mainly it was
- done to clean up the generated #include file graph in the
- reference manual. Before, it was a frightful tangle because
- we #included everything except custom*.h.
-
- o Constness fix in MySQL++ date/time classes to avoid compiler
- warnings with SSQLS. Thanks to Wolfram Arnold for this patch.
-
- o Fixed some compiler warnings in custom*.h. Thanks to Chris Frey
- for this patch.
-
- o Added "Submitting Patches" and "Maintaining a Private CVS
- Repository" sections to the HACKERS file. Thanks to Chris
- Frey for the source material for these sections. The HACKERS
- file was improved in several other ways at the same time.
-
- o PDF version of user manual no longer has links to the reference
- manual. They were ugly, and they were broken anyway due to the
- way we move the PDFs after generating them. If you want
- interlinked manuals, use the HTML version.
-
- o PDF version of user manual now has hard page breaks between
- chapters.
-
- o Removed complic1 example. Wasn't pulling its own weight.
- Everything it is supposed to demonstrate is shown in other
- examples already.
-
- o Refactored print_stock_table() in examples/util module to be
- four functions, and made all the examples use various of
- these functions where appropriate. Before, several of
- the examples had one-off stock table printing code because
- print_stock_table() wasn't exactly the right thing, for one
- reason or another. One practical problem with this is that
- some of the examples missed out on the recent Unicode updates;
- now such a change affects all examples the same way.
-
- o Since so many of the examples rely on the util module, the user
- manual now covers it. The simple1 example in the user manual
- didn't make much sense before, in particular, because it's
- really just a driver for the util module.
-
- o Added custom5 example. It shows how to use the equal_list()
- functionality of SSQLS. Thanks to Chris Frey for the original
- version of this program. (I simplified it quite a bit after
- accepting it.)
-
- o New user manual now covers the value_list(), equal_list() and
- field_list() stuff that the old manual covered but which was
- left out in previous versions of the new manaul. Most of the
- examples are the same, but the prose is almost completely new.
- This new section includes the custom5 example.
-
- o Every declaration in MySQL++ is now documented in the reference
- manual, or explicitly treated as "internal only".
-
- o Improved docs for MySQL++'s mechanism to map between MySQL
- server types and C++ types. Initial doc patch by Chris Frey,
- which I greatly reworked.
-
- o Improved a lot of existing reference manual documentation while
- adding the new stuff.
-
- o Expanded greatly on the exception handling discussion in the user
- manual.
-
- o Added all-new "Quoting and Escaping" section to the user
- manual's Tutorial chapter. Moved some existing comments on
- quoting and escaping around and added some new ones to other
- sections as a result.
-
- o Added all-new "Handling SQL Nulls" section to the user manual's
- Tutorial chapter.
-
- o Many improvements to the Overview section of the user manual.
-
- o Row::operator[] reference now explains the right and wrong way to
- use the values it returns. This is in response to a mailing list
- post where someone was incorrectly using this feature and getting
- a bunch of dangling pointers.
-
- o Updated Doxyfile so 1.3.19.1 parses it without warnings. Still
- works with versions back to 1.2.18, at least. (These are
- the versions shipped with Fedora Core 3 and Red Hat Linux 9,
- respectively.)
-
- o Using a superior method to make Doxygen ignore certain sections
- of the source code. Between this change and the fact that
- everything not so ignored is documented, Doxygen no longer
- generates any warnings.
-
- o Lots of code style updates. Everything should now be consistently
- formatted.
-
-
-1.7.35, 2005.05.05 (r601) The "Cinco de Mayo" release
-
- o Added a "how to use Unicode with MySQL++" chapter to the user
- manual. (Too bad "Cinco de Mayo" doesn't have any accented
- characters. That would be just _too_ precious.)
-
- o VC++ examples now use the Unicode Win32 APIs, so they can display
- Unicode data from MySQL++.
-
- o Added an optional conversion function to examples/util.cpp to
- handle the conversion from UTF-8 to UCS-2 on Win32.
-
- o Moved "brief history of MySQL++" from intro section of refman to
- intro section of userman.
-
- o Lots of small bits of documentation polishing.
-
- o Made some minor constness fixes. Thanks to Erwin van Eijk
- for this patch.
-
- o Made some warning fixes for GCC 4.0. Not all warnings are
- fixed, because some of the needed changes would break the ABI.
- Thanks to Chris Frey for this patch.
-
- o Added lib/Doxyfile to distribution.
-
-
-1.7.34, 2005.04.30 (r573)
-
- o Added a multiple-insert method for Query, which lets you insert
- a range of records from an STL container (or the whole thing,
- if you like) in a single SQL query. This is faster, and it
- reduces coding errors due to less repetition. Thanks to Mark
- Meredino for the patch.
-
- o Reference and user manual now get rebuilt automatically when
- required. (E.g. on 'make dist', or explicitly now through 'make
- docs'.)
-
- o Made it easier to change the maximum number of SSQLS data members
- in generated custom-macros.h file. It used to be hard-coded in
- several places in lib/custom.pl; now it's a variable at the top of
- the file.
-
- o Changed default SSQLS data member limit to 25, which is what it
- has been documented as for a long time now. It was actually 26
- within custom.pl.
-
- o Fixed a regression in previous version.
-
- o Trimmed some fat from the distribution packages.
-
- o Some more small doucmentation improvements.
-
-
-1.7.33, 2005.04.29 (r555)
-
- o Worked around an overloaded operator lookup bug in VC++ 7.1
- that caused SSQLS insert, replace and update queries to get
- mangled. (Symptom was that custom2 and custom3 examples didn't
- work right.) Thanks to Mark Meredino for digging up the
- following, which explains the problem and gives the solution:
-
- http://groups-beta.google.com/group/microsoft.public.vc.stl/browse_thread/thread/9a68d84644e64f15
-
- o Some VC++ warning fixes.
-
- o Major documentation improvements:
-
- o Using DocBook for user manual and Doxygen for reference
- manual. The former now references the latter where
- useful.
-
- o Split out HACKERS and CREDITS files from main README,
- and improved remaining bits of README.
-
- o Moved the text from the old v1.7.9 LaTeX-based
- documentation over into the new systems, and reworked
- it to more closely resemble English.
-
- o Added a lot of new material to documentation, and
- simplified a lot of what already existed.
-
- o Documentation is now being built in HTML and PDF forms.
-
- o ebuild file updated to take advantage of recent configure script
- features. Thanks to Chris Frey for this patch.
-
-
-
-1.7.32, 2005.03.10 (r479)
-
- o Example building may now be skipped with --disable-examples
- configure script flag.
-
- o Changed stock items added in resetdb. One is now UTF-8 encoded,
- to show that basic use of Unicode with MySQL++ is easy, yet not
- foolproof. (See formatting of table on systems where cout isn't
- UTF-8 aware!) Other stock items now follow a theme, for your
- amusement. :)
-
- o custom3 example now changes UTF-8 item's name to the 7-bit ASCII
- equivalent. Previously, this example would fix a spelling error
- in the table.
-
- o resetdb example now says 'why' when it is unable to create the
- sample database.
-
- o Small formatting change to print_stock_table(), used by several
- examples.
-
- o Was issuing a VC++-specific warning-disable pragma when built by
- any Windows compiler. Fixed.
-
-
-1.7.31, 2005.03.05 (r462) The "Inevitable Point-one Followup" release
-
- o Check for threads support must now be explicitly requested via
- configure script's new --enable-thread-check flag.
-
- o Fix for contacting MySQL server on a nonstandard port number.
- Thanks to Chris Frey for this patch.
-
- o Example programs using standard command line format now accept a
- fourth optional parameter, a port number for the server. Thanks
- to Chris Frey for this patch.
-
- o One more g++ 3.4 pedantic warning fix by Chris Frey.
-
- o Exception handling in resetdb is no longer nested, because you'd
- get a segfault on some systems when an exception was thrown from
- one of the inner try blocks.
-
- o Improvements to Connection class's handling of locking mechanism.
- Concept based on patches by Rongjun Mu.
-
- o Implemented the declared-but-never-defined Query::lock(). Thanks
- to Rongjun Mu for this patch.
-
- o Cleaned up some unclear if/else blocks in connection.cpp by
- adding explicit braces, correct indenting and putting normal
- code path in the if side instead of the else.
-
-
-1.7.30, 2005.02.28 (r443) The "Power of Round Numbers" release
-
- o bootstrap script now accepts a 'pedantic' argument, which sets a
- bunch of CFLAGS that make g++ very picky about the code it
- accepts without warnings.
-
- o Fixed a bunch of things that generated warnings with g++ in
- pedantic mode. Only two warnings remain, having to do with
- floating point comparisons. (See Wishlist for plans on how to
- deal with these.) Thanks to Chris Frey for this patch.
-
- o Split long tests out of configure.in into M4 files in new config
- subdir. This makes configure.in easier to read.
-
- o Added preliminary thread support. Currently, this just means that
- we detect the required compiler and linker thread flags, and link
- against the proper thread-safe libraries. THERE MAY BE
- UN-THREAD-SAFE CODE IN MYSQL++ STILL!
-
- o Standard C++ exceptions are the default now. Old pre-Standard
- exception stuff removed.
-
- o Row::lookup_by_name() will throw the new BadFieldName exception if
- you pass a bad field name. Thanks for this patch to Chris Frey.
-
- o Row::operator[] will throw a Standard C++ out of bounds exception
- by way of std::vector::at() if you pass it a bad index. Thanks
- for this patch to Chris Frey.
-
- o Setting Connection::is_connected flag to false on close().
- Previously, is_connected() would continue to return true after
- close() was called.
-
- o All number-to-string conversion ctors in SQLString class now use
- ostringstream to do the conversion. Previously, we used
- snprintf(), which isn't available on all systems. Also, we used a
- C99 format specifier for the "long long" conversion, which is also
- not available on all systems. This new ostringstream code should
- be platform-independent, finally.
-
-
-1.7.28, 2005.02.04 (r403)
-
- o --with-mysql* flags to configure script now try the given
- directory explicitly, and only if that fails do they try
- variations, like tacking '/lib' and such onto it to try and find
- the MySQL includes and libraries. Thanks to Matthew Walton for
- the patch.
-
- o Finally removed sql_quote.h's dependence on custom.h, by moving
- the one definition it needed from custom.h to deps.h. This will
- help portability to compilers that can't handle the SSQLS macros,
- by making that part of the library truly optional.
-
-
-1.7.27, 2005.01.12 (r395)
-
- o configure check for libmysqlclient now halts configuration if the
- library isn't found. Previously, it would just be flagged as
- missing, and MySQL++ would fail to build.
-
- o Added sql_string.cpp to VC++ and BCBuilder project files.
-
- o Removed Totte Karlsson's 'populate' example, which never made it
- into the distribution anyway.
-
- o Removed last vestiges of 'dummy.cpp'.
-
- o Renamed *.cc to *.cpp in BCBuilder project files.
-
- o Worked around a BCBuilder C++ syntax processing bug in row.h.
-
-
-1.7.26, 2004.12.17 (r382)
-
- o Moved all of the SQLString definitions out of the header and into
- a new .cpp file, reformatted it all, and made the integer
- conversion functions use snprintf() or _snprintf() instead of
- sprintf(). Also, widened some of the buffers for 64-bit systems.
-
- o Using quoted #include form for internal library headers, to avoid
- some problems with file name clashes. (The headers should still
- be installed in their own separate directory for best results,
- however.) Thanks to Chris Frey and Evan Wies for the patch and
- the discussion that lead to it.
-
- o Removed unnecessary semicolons on namespace block closures.
- Thanks to Evan Wies for this patch.
-
- o Fixed namespace handling in the legacy headers mysql++.hh and
- sqlplus.hh. Thanks to Chris Frey for this patch.
-
- o #including iostream instead of ostream in lib/null.h for
- broader C++ compatibility. (This may allow MySQL++ to work on GCC
- 2.95.2 again, but this is unconfirmed.)
-
- o Detecting proper mysql_shutdown() argument handling automatically
- in platform.h for the Windows compiler case instead of making the
- user edit the file. Thanks to Evan Wies for this patch.
-
- o Fixed examples/Makefile.simple to use new *.cpp file naming.
-
- o Fix to Gentoo ebuild file's exception configure switch handling.
- Thanks to Chris Frey for this patch.
-
- o Rebuilding lib/custom*.h intelligently now, to avoid unnecessary
- recompiles after running bootstrap script.
-
-
-1.7.25, 2004.12.09 (r360)
-
- o Yet more fixes to the --with-mysql-lib and --with-mysql-include
- flags.
-
- o Added DLLEXPORT stuff to platform.h, hopefully so that someone
- can figure out how to make VC++ make a DLL version of MySQL++.
-
- o Renamed *.cc to *.cpp.
-
- o Made 'set -> myset' change in VC++ project files.
-
- o Some style changes (mostly whitespace) in header files.
-
-
-1.7.24, 2004.12.08 (r343)
-
- o Fixed the --with-mysql-lib and --with-mysql-include flags'
- behavior, and extended their search ability to handle one other
- common case. (Fixed by Steve Roberts)
-
- o Fixes to put freestanding functions in namespace mysqlpp. (They
- weren't in the namespace, while all the class member functions
- were.) This required bumping the ABI version number to 4.
-
- o Renamed set module to myset, to avoid conflicts with Standard C++
- Library's set.h when MySQL++ headers were installed into one of
- the standard system include directories.
-
- o Renamed all the idempotency guards to make them consistent in
- style and unique to MySQL++.
-
- o Reformatted all of lib/*.cc.
-
-
-1.7.23, 2004.11.20 (r333)
-
- o Query::reset() now empties the stored query string. If you
- subsequently stored a longer query in the object, you'd overwrite
- the previous query, but otherwise the longer part of the previous
- one would stick out past the new query.
-
- o We now look to the NO_LONG_LONGS macro only to decide whether to
- fake 64-bit integer support using 32-bit integers.
-
- o 64-bit integer support under Visual C++ may be working now, using
- that platform's __int64_t type. This has not been tested.
-
- o Removed 64-bit integer support for Codewarrior on Mac OS 9 and
- earlier. OS X uses GCC, so it requires no special support.
-
- o Added MinGW detection in platform.h.
-
- o If you pass a flag (-X) to the examples that take the standard
- parameters (resetdb, simple1, etc.), it prints a usage message.
-
- o Better error handling in resetdb example, where errors are the
- most critical. (If that one runs without errors, the others
- probably will, too, and you have to run that one first.)
-
- o resetdb now reports success, rather than succeeding silently.
-
- o Removed the code in sample1 example that duplicated util module's
- print_stock_table(), and called that function instead.
-
- o Moved the preview() calls in the example programs to before the
- query execution calls, because execution modifies the query.
-
- o All examples that take the standard command line parameters now
- exit when connect_to_db() fails in one of the ways that don't
- throw an exception, rather than bulling onward until the next
- MySQL database call fails because the connection isn't up.
-
- o dbinfo example now takes the standard command line parameters.
-
- o Much better output formatting in dbinfo example.
-
- o Calling reset() where appropriate in the various example programs.
- Before, the programs may have worked, but not for the right
- reason. This lead some people to believe that calling reset()
- was not necessary.
-
- o Fixed an incorrect use of row["string"] in complic1 example.
-
- o Lots of code style improvements to the examples.
-
- o Some VC++ type warnings squished. Some remain.
-
-
-1.7.22, 2004.11.17 (r302)
-
- o Applied patches by Zahroof Mohammed to allow it to build under GCC
- 3.4.2. Tested on MinGW and Fedora Core 3 systems.
-
- o Removed all the forward declarations in defs.h, and added
- forward declarations where necessary in individual header files.
- #including defs.h in fewer locations as a result.
-
- o Legacy headers sqlplus.hh and mysql++.hh now declare they are
- using namespace mysqlpp, to allow old code to compile against the
- new library without changes.
-
- o Removed query_reset parameter from several class Query member
- functions. In the implementation, these parameters were always
- overridden! No sense pretending that we pay attention to these
- parameters. This changes the ABI version to 3.
-
- o #including custom.h in sql_query.h again...it's necessary on GCC
- 3.4.
-
- o bootstrap script runs lib/config.pl after configure. This is
- just a nicety for those running in 'maintainer mode'.
-
-
-1.7.21, 2004.11.05 (r273)
-
- o Generating a main mysql++ RPM containing just the library files
- and basic documentation, and the -devel package containing
- everything else.
-
- o Devel package contains examples now, along with a new Makefile
- that uses the system include and library files, rather than the
- automake-based Makefile.am we currently have which uses the files
- in the mysql++ source directory.
-
- o Renamed sqlplusint subdirectory in the package to lib.
-
- o Removed the obsolete lib/README file.
-
- o lib/sql_query.h no longer #includes custom.h, simplifying
- build-time dependencies and shortening compile times.
-
-
-1.7.20, 2004.11.03 (r258)
-
- o Collapsed all numbered *.hh headers into a single *.h file. For
- example, the contents of row1.hh, row2.hh and row3.hh are now in
- row.h.
-
- o While doing the previous change, broke several circular
- dependencies. (The numbered file scheme was probably partly done
- to avoid this problem.) The practical upshot of most of these
- changes is that some functions are no longer inline.
-
- o Removed define_short.hh and everything associated with it. The
- library now uses the short names exclusively (e.g. Row instead of
- MysqlRow).
-
- o Put all definitions into namespace mysqlpp. For most programs,
- simply adding a 'using namespace mysqlpp' near the top of the
- program will suffice to convert to this version.
-
- o Once again, the main include file was renamed, this time to
- mysql++.h. Hopefully this is the last renaming!
-
- o mysql++.hh still exists. It emits a compiler warning that the
- file is obsolete, then it #includes mysql++.h for you.
-
- o sqlplus.hh is back, being a copy of the new mysql++.hh. Both of
- these files may go away at any time. They exist simply to help
- people transition to the new file naming scheme.
-
- o Renamed mysql++-windows.hh to platform.h, and added code to it to
- handle #inclusion of config.h on autotools-based systems
- intelligently. This fixes the config.h error when building under
- Visual C++.
-
- o There is now only one place where conditional inclusion of
- winsock.h happens: platform.h.
-
- o Beautified the example programs.
-
-
-1.7.19, 2004.10.25 (r186)
-
- o Fixed an infinite loop in the query mechanism resulting from the
- strstream change in the previous version. There is an overloaded
- set of str() member functions that weren't a problem when query
- objects were based on strstream.
-
- o Query mechanism had a bunch of const-incorrectness: there were
- several function parameters and functions that were const for
- the convenience of other parts of the code, but within these
- functions the constness was const_cast away! This was evil
- and wrong; now there are fewer const promises, and only one is
- still quietly broken within the code. (It's in the SQLQuery
- copy ctor implementation; it should be harmless.)
-
- o Removed operator=() in Query and SQLQuery classes. It cannot take
- a const argument for the same reason we have to cast away const
- in the SQLQuery copy ctor. It's tolerable to do this in the copy
- ctor, but intolerable in an operator. Since the copy ctor is good
- enough for all code within the library and within my own code, I'm
- removing the operator.
-
- o Above changes required bumping the ABI to version 2.
-
- o Visual C++ projects now look for MySQL build files in c:\mysql,
- since that's the default install location. (Previously, it was
- c:\program files\mysql.)
-
-
-1.7.18, 2004.10.01 (r177)
-
- o Changed all the strstream (and friends) stuff to stringstream type
- classes. Let there be much rejoicing.
-
- o Query object now lets you use store() even when the SQL query
- cannot return a result, such as a DROP TABLE command. This is
- useful for sending arbitrary SQL to the server. Thanks to
- Jose Mortensen for the patch.
-
- o Quote fix in configure.in, thanks to David Sward.
-
- o Renamed undef_short file to undef_short.hh.
-
- o Gentoo ebuild file is actually being shipped with the tarball,
- instead of just sitting in my private CVS tree since 1.7.14 was
- current. Ooops....
-
-
-1.7.17, 2004.09.16 (r170)
-
- o Reverted one of the VC++ warning fix changes from 1.7.16 that
- caused crashes on Linux.
-
- o Added a configure test that conditionally adds the extra 'level'
- parameter to mysql_shutdown() that was added in MySQL 4.1.3 and
- 5.0.1.
-
-
-1.7.16, 2004.09.13 (r160)
-
- o Building VC++ version with DLL version of C runtime libraries, and
- at warning level 3 with no warnings emitted.
-
- o VC++ build no longer attempts to fake "long long" support. See
- the Wishlist for further thoughts on this.
-
-
-1.7.15, 2004.09.02 (r144)
-
- o Renamed Configure file to common.am, to avoid file name conflict
- with configure script on case-sensitive file systems.
-
- o Added ebuild file and ebuild target to top-level Makefile for
- Gentoo systems. Thanks to Chris Frey for this.
-
- o Small efficiency improvements to BadQuery exception handling.
- Initial idea by Chris Frey, improvements by Warren Young.
-
-
-1.7.14, 2004.08.26 (r130)
-
- o Builds with Visual C++ 7.1.
-
- o Fixed a bug in custom macro generation that caused problems with
- GCC 3.4. (X_cus_value_list ctor definition was broken.)
-
-
-1.7.13, 2004.08.23 (r92)
-
- o Removed USL CC support. (System V stock system compiler.) Use
- GCC on these platforms instead.
-
- o Added examples/README, explaining how to use the examples, and
- what they all do.
-
- o Most of the example programs now accept command line arguments for
- host name, user name and password, like resetdb does.
-
- o Renamed sinisa_ex example to dbinfo.
-
- o Several Standard C++ syntax fixes to quash errors emitted by
- GCC 3.4 and Borland C++ Builder 6. Thanks to Steffen Schumacher
- and Totte Karlsson for their testing and help with these.
-
- o Added proper #includes for BCBuilder, plus project files for same.
- Thanks to Totte Karlsson for these.
-
-
-1.7.12, 2004.08.19 (r63)
-
- o Many Standard C++ fixes, most from the GCC 3.4 patch by
- Rune Kleveland.
-
- o Added Wishlist file to distribution.
-
- o Fixed a problem in the bootstrap script that caused complaints
- from the autotools on some systems.
-
- o RPM building is working properly now.
-
- o Fixed the idempotency guard in datetime1.hh.
-
-
-1.7.11, 2004.08.17 (r50)
-
- o Renamed mysql++, defs and define_short files, adding .hh to the
- end of each. (They're header files!) This shouldn't impact
- library users, since these are hopefully used internal to the
- library only.
-
- o Removed sqlplus.hh file. Use mysql++.hh instead.
-
- o Added mysql++.spec, extracted from contributed 1.7.9 source RPM,
- and updated it significantly. Also, added an 'rpm' target to
- Makefile.am to automate the process of building RPMs.
-
- o Added bootstrap and LGPL files to distribution tarball.
-
- o Added pre-1.7.10 history to this file.
-
- o Removed .version file. Apparently it's something required by old
- versions of libtool.
-
-
-1.7.10, 2004.08.16 (r27)
-
- o Maintenance taken over by Warren Young (mysqlpp at etr dash usa
- dot com.) See http://lists.mysql.com/plusplus/3326 for details.
-
- o Applied many of the GCC 3.x patches submitted for 1.7.9 over
- the years. This allows it to build on everything from 3.0 to
- 3.3.3, at least. Because so many patches are rolled up in one
- big jump, it's difficult to describe all the changes and where
- they came from. Mostly they're Standard C++ fixes, as GCC
- has become more strict in the source code that it will accept.
-
- o MysqlRow used to overload operator[] for string types as well as
- integers so you could look up a field by its name, rather than by
- its index. GCC 3.3 says this is illegal C++ due to ambiguities in
- resolving which overload should be used in various situations.
- operator[] is now overloaded only for one integer type, and a
- new member function lookup_by_name() was added to maintain the old
- by-field-name functionality.
-
- o Fixed another operator overloading problem in SSQLS macro
- generation with GCC 3.3.
-
- o The _table member of SSQLS-defined structures is now const char*,
- so you can assign to it from a const char* string.
-
- o Got autoconf/automake build system working with current versions
- of those tools again. Removed the generated autotools files from
- CVS.
-
- o Renamed library file from libsqlplus to libmysqlpp.
-
-
-1.7.9 (May 1 2001) Sinisa Milivojevic
-
- * Fixed a serious bug in Connection constructor when reading MySQL
- * options
- * Improved copy constructor and some other methods in Result /
- * ResUse
- * Many other minor improvements
- * Produced a complete manual with chapter 5 included
- * Updated documentation, including a Postscript format
-
-1.7.8 (November 14 2000) Sinisa Milivojevic
-
- * Introduced a new, standard way of dealing with C++ exceptions.
- * MySQL++ now supports two different methods of tracing exceptions.
- * One is by the fixed type (the old one) and one is standard C++
- * type by the usage of what() method. A choice of methods has to be
- * done in building a library. If configure script is run with
- * -enable-exception option , then new method will be used. If no
- * option is provided, or -disable-exception is used, old MySQL++
- * exceptions will be enforced. This innovation is a contribution of
- * Mr. Ben Johnson
- * MySQL++ now automatically reads at connection all standard MySQL
- * configuration files
- * Fixed a bug in sql_query::parse to enable it to parse more then 99
- * char's
- * Added an optional client flag in connect, which will enable usage
- * of this option, e.g. for getting matched and not just affected
- * rows. This change does not require any changes in existing
- * programs
- * Fixed some smaller bugs
- * Added better handling of NULL's. Programmers will get a NULL
- * string in result set and should use is_null() method in ColData to
- * check if value is NULL
- * Further improved configuration
- * Updated documentation, including a Postscript format
-
-1.7.6 (September 22 2000) Sinisa Milivojevic
-
- * This release contains some C++ coherency improvements and scripts
- * enhacements
- * result_id() is made available to programmers to fetch
- * LAST_INSERT_ID() value
- * Connection constroctur ambiguity resolved, thanks to marc@mit.edu
- * Improved cnnfigure for better finding out MySQL libraries and
- * includes
- * Updated documentation, including a Postscript format
-
-1.7.5 (July 30 2000) Sinisa Milivojevic
-
- * This release has mainl bug fixes and code improvements
- * A bug in FieldNames::init has been fixed, enabling a bug free
- * usage of this class with in what ever a mixture of cases that is
- * required
- * Changed behaviour of ResUse, Result and Row classes, so that they
- * could be re-used as much as necessary, without any memory leaks,
- * nor with any re-initializations necessary
- * Fixed all potential leaks that could have been caused by usage of
- * delete instead of delete[] after memory has been allocated with
- * new[]
- * Deleted all unused classes and macros. This led to a reduction of
- * library size to one half of the original size. This has
- * furthermore brought improvements in compilation speed
- * Moved all string manipulation from system libraries to
- * libmysqlclient, thus enabling uniformity of code and usage of 64
- * bit integers on all platforms, including Windows, without
- * reverting to conditional compilation. This changes now requires
- * usage of mysql 3.23 client libraries, as mandatory
- * Changed examples to reflect above changes
- * Configuration scripts have been largely changed and further
- * changes shall appear in consecutive sub-releases. This changes
- * have been done and shall be done by our MySQL developer Thimble
- * Smith
- * Changed README, TODO and text version of manual. Other versions of
- * manual have not been updated
- * Fixed .version ``bug''. This is only partially fixed and version
- * remains 1.7.0 due to some problems in current versions of libtool.
- * This shall be finally fixed in a near future
- * Several smaller fixes and improvements
- * Added build.sh script to point to the correct procedure of
- * building of this library. Edit it to add configure options of your
- * choice
-
-1.7 (May17 2000) Sinisa Milivojevic
-
- * This is mainly a release dealing with bug fixes, consistency
- * improvements and easier configure on some platforms
- * A bug in fetch_row() method of ResUse class has been fixed. Beside
- * changes that existed in a distributed patch, some additional error
- * checking has been introduced
- * A bug in escape manipulator has been fixed that could cause an
- * error if all characters had to be escaped
- * An inconsistency in column indexing has been fixed. Before this
- * version, column names in row indexing with strings, i.e.
- * row[] , has been case sensitive, which was inconsistent
- * with MySQL server handling of column names
- * An inconsistency in conversion from strings to integers or floats
- * has been fixed. In prior version a space found in data would cause
- * a BadConversion exception. This has been fixed, but 100%
- * consistency with MySQL server has not been targeted, so that other
- * non-numeric characters in data will still cause BadConversion
- * exception or error. As this API is used in applications, users
- * should provide feedback if full compatibility with MySQL server is
- * desired, in which case BadConversion exception or error would be
- * abolished in some of future versions
- * A new method in ColData class has been introduced. is_null()
- * method returns a boolean to denote if a column in a row is NULL.
- * Finally, as of this release, testing for NULL values is possible.
- * Those are columns with empty strings for which is_null() returns
- * true.
- * Some SPARC Solaris installations had C++ exception problems with
- * g++ 2.95.2 This was a bug that was fixed in GNU gcc, as from
- * release 2.95 19990728. This version was thoroughly tested and is
- * fully functional on SPARC Solaris 2.6 with the above version of
- * gcc.
- * A 'virtual destructor ' warning for Result class has been fixed
- * Several new functions for STL strings have been added. Those
- * functions (see string_util.hh) add some of the functionality
- * missing in existing STL libraries
- * Conversion for 64 bit integers on FreeBSD systems has been added.
- * On those systems _FIX_FOR_BSD_ should be defined in CXXFLAGS prior
- * to configuring. Complete conversion to the usage of functions for
- * integer conversion found in mysqlclient library is planned for one
- * of the next releases
- * A completely new, fully dynamic, dramatic and fully mutable result
- * set has been designed and will be implemented in some of 2.x
- * releases
- * Several smaller fixes and improvements, including defaulting
- * exceptions to true, instead of false, as of this version
- * An up-to-date and complete Postscript version of documentation is
- * included in this distribution
- * Large chunks of this manual are changed, as well as README and
- * TODO files.
-
-1.6 (Feb 3 2000) Sinisa Milivojevic
-
- * This is a major release as it includes new features and major
- * rewrites
- * Automatic quoting and escaping with streams. It works
- * automatically , depending on the column type. It will work with <<
- * on all ostream derived types. it is paricularly handy with query
- * objects and strstreams. Automatic quoting and escaping on cout,
- * cerr and clog stream objects is intentionally left out, as quoting
- * / escaping on those stream objects is not necessary. This feature
- * can be turned of by setting global boolean dont_quote_auto to
- * true.
- * Made some major changes in code, so that now execute method should
- * be used only with SSQL and template queries, while for all other
- * query execution of UPDATE's, INSERT's, DELETE's, new method exec()
- * should be used. It is also faster.
- * New method get_string is inroduced for easier handling / casting
- * ColData into C++ strings.
- * Major rewrite of entire code, which led to it's reduction and
- * speed improvement. This also led to removal of several source
- * files.
- * Handling of binary data is introduced. No application program
- * changes are required. One of new example programs demonstrates
- * handling of binary data
- * Three new example programs have been written and thoroughly
- * tested. Their intention is to solve some problems addressed by
- * MySQL users.
- * Thorough changes is Makefile system has been made
- * Better configuration scripts are written, thanks to D.Hawkins
- *
- * Added several bug fixes
- * Changed Manual and Changelog
-
-1.5 (Dec 1 1999) Sinisa Milivojevic
-
- * Fixed bug in template queries, introduced in 1.4 (!)
- * Fixed connect bug
- * Fixed several bug in type_info classes
- * Added additional robustness in classes
- * Added additional methods for SQL type info
- * Changed Changelog and README
-
-1.4 (Nov 25 1999) Sinisa Milivojevic
-
- * Fixed bug in store and storein methods
- * Fixed one serious memory leak
- * Fixed a very serious bug generated by gcc 2.95.xx !!
- * Added robustness in classes, so that e.g. same query and row
- * objects can be re-used
- * Changed sinisa_ex example to reflect and demonstrate this
- * stability
- * Changed Changelog and README
- * Few other bug fixes and small improvements and speed-ups
-
-1.3 (Nov 10 1999) Sinisa Milivojevic
-
- * Fixed several erronous definitions
- * Further changed source to be 2.95.2 compatible
- * Expunged unused statements, especially dubious ones, like use of
- * pointer_tracker
- * Corrected bug in example file fieldinf1
- * Finally fixed mysql_init in Connection constructor, which provided
- * much greater stability !
- * Added read and get options, so that clients, like mysqlgui can use
- * it
- * Changed Changelog and README
- * Many other bug fixes.
-
-1.2 (Oct 15 1999) Sinisa Milivojevic
-
- * First offical release. Version 1.0 and 1.1 were releases by Sinisa
- * before I (Kevin Atkinson) made him the offical maintainer,
- * Many manual fixes.
- * Changed README and Changelog
- * Changed source to be compilable by gcc 2.95.xx, tribute to Kevin
- * Atkinson
- * Added methods in Connection class which are necessary for
- * fullfilling administrative functions with MySQL
- * Added many bug fixes in code pertaining to missing class
- * initializers , as notified by Michael Rendell
- * Sinisa Milivojevic is now the offical
- * maintainer.
-
-1.1 (Aug 2 1999) Sinisa Milivojevic
-
- * Added several bug fixes
- * Fixed memory leak problems and variables overlapping problems.
- * Added automake and autoconf support by loic@ceic.com
- * Added Makefile for manual
- * Added support for cygwin
- * Added example sinisa_ex (let modesty prevail) which used to crash
- * a lot when memory allocation, memory leak and overlap problems
- * were present. Smooth running of this example proves that all those
- * bugs are fixed
- * Corrected bugs in sql_query.cc regarding delete versus delete[]
- * and string length in manip.cc
- * Changed manual
- * Changed README
- * Many other smaller things
-
-1.0 (June 9 1999) Michael Widenius
-
- * Added patches from Orion Poplawski to support the
- * UnixWare 7.0 compiler
-
-.64.1.1a (Sep 27 1998)
-
- * Fixed several bugs that caused my library to fail to compile with
- * egcs 1.1. Hopefully it will still compile with egcs 1.0 however I
- * have not been able to test it with egcs 1.0.
- * Removed some problem causing debug output in sql++pretty.
-
-.64.1a (Aug 1 1998)
-
- * Added an (almost) full guide to using Template Queries.
- * Fixed it so the SQLQuery will throw an exception when all the
- * template parameters are not provided.
- * Proofread and speedchecked the manual (it really needed it).
- * Other minor document fixes.
-
-.64.0.1a (July 31 1998)
-
- * Reworked the Class Reference section a bit.
- * Minor document fixes
- * Added more examples for SSQLS.
- * Changed the syntax of equal_list for SSQLS from equal_list (cchar
- * *, Manip, cchar *) to (cchar *, cchar *, Manip).
- * Added set methods to SSQLS. These new methods do the same thing as
- * there corresponding constructors.
- * Added methods for creating a mysql_type_info from a C++ type_info.
-
-.64.a (July 24 1998)
-
- * Changed the names of all the classes so they no longer have to
- * have Mysql in the begging of it. However if this creates a problem
- * you can define a macro to only use the old names instead.
- * The Specialized SQL Structures (formally known as Custom Mysql
- * Structures) changed from mysql_ to sql_.
- * Added the option of using exceptions thoughout the API.
- * ColData (formally known as MysqlStrings) will now throw an
- * exception if there is a problem in the conversion.
- * Added a null adapter.
- * Added Mutable Result Sets
- * Added a very basic runtime type identification for SQL types
- * Changed the document format from POD to LYX .
- * Am now using a modified version of Perceps to extract the class
- * information directly from the code to make my life easier.
- * Added an option of defining a macro to avoid using the automatic
- * conversion with binary operators.
- * Other small fixed I probully forgot to mentune.
-
-.63.1.a
-
- * Added Custom Mysql Structures.
- * Fixed the Copy constructor of class Mysql
- * Started adding code so that class Mysql lets it children now when
- * it is leaving
- * Attempted to compile it into a library but still need help. As
- * default it will compile as a regular program.
- * Other small fixes.
-
-.62.a (May 3 1998)
-
- * Added Template Queries
- * Created s separate SQLQuery object that is independent of an SQL
- * connection.
- * You no longer have to import the data for the test program as the
- * program creates the database and tables it needs.
- * Many small bug fixes.
-
-.61.1.a (April 28 1998)
-
- * Cleaned up the example code in test.cc and included it in the
- * manual.
- * Added an interface layout plan to the manual.
- * Added a reverse iterator.
- * Fixed a bug with row.hh (It wasn't being included because of a
- * typo).
-
-.61.0.a
-
- * Major interface changes. I warned you that the interface may
- * change while it is in pre-alpha state and I wasn't kidding.
- * Created a new and Separate Query Object. You can no longer execute
- * queries from the Mysql object instead you have to create a query
- * object with Mysql::query() and use it to execute queries.
- * Added the comparison operators to MysqlDate, MysqlTime and
- * MysqlDateTime. Fixed a few bugs in the MysqlDate... that effected
- * the stream output and the conversion of them to strings.
- * Reflected the MysqlDate... changes in the manual.
- * Added a new MysqlSet object and a bunch of functions for working
- * with mysql set strings.
-
-.60.3a (April 24 1998)
-
- * Changed strtoq and strtouq to strtoll and strtull for metter
- * compatibility Minor Manual fix.
- * Changed makefile to make it more compatible with Solaris (Thanks
- * Chris H)
- * Fixed bug in comparison functions so that they would compare in he
- * right direction.
- * Added some items to the to do list be sure to have a look.
-
+2000-01-06 Dale Hawkins
+
+ * acconfig.h: New file. Lets me define the library versioning.
+
+ * autogen.sh: Boilerplate configuration jump-start script.
+
+2000-01-04 Dale Hawkins
+
+ * sqlplus.spec.in (Packager): Created new spec.in file to work
+ with autoconf/automake and libtool for easier releases of
+ RPMs. (Yes, I am a Linux bigot and I think the world should
+ revolve around RPMs).
+
+ * configure.in: Reworked this file to work with spec.in and
+ support libtool type versioning.
+
+1999-10-15 Sinisa Milivojevic
+
+* Changed version to 1.2
+* First offical release. Version 1.0 and 1.1 were releases by Sinisa
+ before I (Kevin Atkinson) made him the offical maintainer,
+* Many manual fixes.
+* Changed README and Changelog
+* Changed source to be compilable by gcc 2.95.xx, tribute to Kevin
+ Atkinson
+* Added methods in Connection class which are necessary for
+ fullfilling administrative functions with MySQL
+* Added many bug fixes in code pertaining to missing class
+ initializers , as notified by Michael Rendell
+* Sinisa Milivojevic is now the offical
+ maintainer.
+
+
+1999-08-02 Sinisa Milivojevic
+
+* Changed version to 1.1
+* Added several bug fixes
+* Fixed memory leak problems and variables overlapping problems.
+* Added automake and autoconf support by loic@net.fr
+* Added Makefile for manual
+* Added support for cygwin
+* Added example sinisa_ex (let modesty prevail) which used to crash a
+ lot when memory allocation, memory leak and overlap problems were
+ present. Smooth running of this example proves that all those bugs are
+ fixed
+* Changed manual
+* Cheanged README
+* Many other smaller things
+
+1999-06-09 Michael Widenius
+
+* Changed version to 1.0
+* Added patches from Orion Poplawski to support the
+ UnixWare 7.0 compiler
DELETED HACKERS
Index: HACKERS
==================================================================
--- HACKERS
+++ /dev/null
@@ -1,173 +0,0 @@
-If you are going to make any changes to MySQL++, this file has some
-hints and commentary you may find helpful.
-
-
-Subversion Access
-~~~~~~~~~~~~~~~~~
- To check out the current development version from the Gna!
- Subversion repository, say:
-
- $ svn co svn://svn.gna.org/svn/mysqlpp/trunk mysqlpp
-
- If you're a MySQL++ committer, use svn over ssh instead:
-
- $ svn co svn+ssh://LOGIN@svn.gna.org/svn/mysqlpp/trunk mysqlpp
-
- where LOGIN is your Gna! login name. You will have to have your
- ssh public key(s) registered with Gna! for this to work.
-
-
-Submitting Patches
-~~~~~~~~~~~~~~~~~~
- If you wish to submit a patch to the library, please send it to
- the MySQL++ mailing list, or attach it to an entry in our bug
- tracker on Gna! We want patches in unified diff format.
-
- The easiest way to get a unified diff is to check out a copy of
- the current MySQL++ tree as described in the previous section.
- Then make your change, cd to the MySQL++ root directory, and ask
- Subversion to generate the diff for you:
-
- $ svn diff > mychange.patch
-
- If your patch adds new files to the distribution, you can say
- "svn 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 "svn
- revert newfile" to make Subversion forget about the new file.
-
- If you're making a patch against a MySQL++ distribution tarball,
- then you can generate the diff this way:
-
- $ diff -ruN mysql++-olddir mysql++-newdir > mychange.patch
-
- 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
- systems, and we'd frequently forget to update individual project
- files and makefiles, so at any given time, at least one target
- was likely to be broken.
-
- If MySQL++ doesn't currently ship with project files or makefiles
- tuned for your compiler of choice, you need to work through the
- Bakefile mechanism to add support. We're not willing to do ad-hoc
- platform support any more, so please don't ask if you can send
- us project files instead; we don't want them.
-
- If you want to port MySQL++ to another platform, we need to be
- confident that the entire library works on your platform before
- we'll accept patches. In the past, we've had broken ports that
- were missing important library features, or that crashed when built
- in certain ways. Few people will knowingly use a crippled version
- of MySQL++, since there are usually acceptable alternatives.
- Therefore, such ports become maintenance baggage with little
- compensating value.
-
-
-On Manipulating the Bakefiles and Autoconf Files
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If you're on a Unixy platform and change any of mysql++.bkl,
- configure.ac, or config/*, you must re-run the bootstrap script
- to regenerate the build files. The bootstrap script also has
- other functions:
-
- $ ./bootstrap [pedantic] [no{doc,ex,lib,opt}] [configure flags]
-
- If you pass 'pedantic' to the bootstrap script, it will set up
- the autoconf build system so it turns on all of GCC's warnings and
- such. It's useful to build the library in this mode when making
- changes to make sure there are no obvious problems with the code.
-
- If you pass 'nodoc', the documentation won't be considered a
- prerequisite for building the distribution tarball. This is
- useful on systems where the documentation doesn't build correctly,
- and you only need to make a binary RPM. That process requires
- a tarball, but doesn't need the documentation. Don't distribute
- the tarball or SRPM that results, as they are broken.
-
- If you pass 'noex', the generated Makefiles and project files
- won't try to build any of the examples.
-
- If you pass 'nolib', the generated Makefiles and project files
- won't try to build the MySQL++ library.
-
- If you pass 'noopt', compiler optimization will be turned off
- on systems that use configure. (It currently has no effect on
- MinGW or Visual C++.)
-
- You can pass any of the previous options in any order. As soon as
- the bootstrap script sees an option that it doesn't understand,
- it stops processing the command line. Any subsequent options
- are passed to the configure script. See README.unix for more on
- configure script options.
-
- If you're on Windows and you change the Bakefile (mysql++.bkl),
- re-generating the Makefiles and project files from it is a
- little tricky. The above procedure doesn't work because the
- native Win32 port of Bakefile is incomplete, and Bakefile doesn't
- build correctly under Cygwin. Therefore, you need to run the
- bakefile program directly. You'll use one of these two commands,
- depending on which compiler you're using:
-
- C:\> bakefile -f msvc6prj mysql++.bkl
- C:\> bakefile -f mingw -o Makefile.mingw mysql++.bkl
-
-
-Maintaining a Private CVS Repository
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- You may find it helpful to maintain your own CVS repository.
- Whenever there is a new MySQL++ release, import it on the vendor
- branch like this:
-
- $ cvs import -m "Version 1.7.35" software/mysql++ mysql++ mysql++-1_7_35
-
- (This assumes that you have your CVSROOT environment variable
- set properly.)
-
- Update the HEAD branch like this:
-
- $ cd mysql++
- $ cvs update -PdA
- $ cvs update -j HEAD -j mysql++-1_7_35 -Pd
- $ cvs ci -m "merged 1.7.35 into HEAD"
- $ cvs tag mysql++-1_7_35-merged
-
- Then any changes you make can easily be tracked, and diffs can
- be produced with rdiff:
-
- $ cvs rdiff -ru mysql++-1_7_35 -r mysql++-1_7_35_equal_list \
- $(cat CVS/Repository) > equal_list.patch
-
Index: INSTALL
==================================================================
--- INSTALL
+++ INSTALL
@@ -1,9 +1,1 @@
-The installation procedure depends on the compiler you use to build
-MySQL++. See:
-
- README.unix - for Unix, Linux, Mac OS X, etc.
- README.cygwin - for Cygwin
- README.mingw - for MinGW
- README.vc - for Visual C++
-
-Also see the main README file for things that apply to all systems.
+/usr/share/automake/INSTALL
ADDED LGPL
Index: LGPL
==================================================================
--- /dev/null
+++ LGPL
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
DELETED LICENSE
Index: LICENSE
==================================================================
--- LICENSE
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- , 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
ADDED Makefile.am
Index: Makefile.am
==================================================================
--- /dev/null
+++ Makefile.am
@@ -0,0 +1,14 @@
+# This includes sqlplus.spec _and_ sqlplus.spec.in
+# (this way rpm -ta xxxx work)
+EXTRA_DIST = @PACKAGE@.spec @PACKAGE@.spec.in @PACKAGE@-config.in
+
+SUBDIRS = sqlplusint examples doc # devel
+
+bin_SCRIPTS = sqlplus-config
+
+CONFIG_FILE = @PACKAGE@-config-@SQLPLUS_MAJOR_VERSION@.@SQLPLUS_MINOR_VERSION@
+
+$(CONFIG_FILE): @PACKAGE@-config
+ cp $^ $@
+
+@PACKAGE@-config: @PACKAGE@-config.in
ADDED NEWS
Index: NEWS
==================================================================
--- /dev/null
+++ NEWS
Index: README
==================================================================
--- README
+++ README
@@ -1,124 +1,73 @@
-What It Is
-~~~~~~~~~~
- MySQL++ is a C++ wrapper for MySQL's C API. It is built
- around STL principles, to make dealing with the database
- as easy as dealing with an STL container. MySQL++ relieves
- the programmer of dealing with cumbersome C data structures,
- generation of repetitive SQL statements, and manual creation
- of C++ data structures to mirror the database schema.
-
- Its home page is http://tangentsoft.net/mysql++/
-
-
-Prerequisites
-~~~~~~~~~~~~~
- To build MySQL++, you must have the MySQL C API development
- files installed.
-
- On Unixy systems (Linux, Mac OS X, Cygwin, "real" Unix...),
- the MySQL development files are installed if you build MySQL
- from source. If you installed MySQL as a binary package,
- then the development files are often packaged separately
- from the MySQL server itself. It's common for the package
- containing the development files to be called something like
- "MySQL-devel".
-
- If you're building on Windows with Visual C++ or MinGW, you
- need to install the native Win32 port of MySQL from mysql.com.
- The development files are only included with the "complete"
- version of the MySQL installer, and some versions of this
- installer won't actually install them unless you do a custom
- install. Another pitfall is that MySQL++'s project files
- assume that you've installed the current General Availability
- release of MySQL (v5.0 right now) and it's installed in the
- default location. If you've installed a different version,
- or if MySQL Inc. changes the default location (which they
- seem to do regularly!) you'll have to adjust the link and
- include file paths in the project settings.
-
-
-Additional Things to Read
-~~~~~~~~~~~~~~~~~~~~~~~~~
- Each major platform we support has a dedicated README.* file
- for it containing information specific to that platform.
- Please read it.
-
- For authorship information, see the CREDITS file.
-
- For license information, see the LICENSE file.
-
- If you want to change MySQL++, see the HACKERS file.
-
- You should have received a user manual and a reference manual
- with MySQL++. If not, you can read a recent version online:
-
- http://tangentsoft.net/mysql++/doc/
-
- Search the MySQL++ mailing list archives if you have more
- questions:
-
- http://lists.mysql.com/plusplus/
-
-
-Building the Library
-~~~~~~~~~~~~~~~~~~~~
- As of version 2.1, MySQL++ uses the Bakefile build system. This
- tool creates platform-specific project files and makefiles. We
- currently support these options:
-
- autoconf:
- For Unixy platforms, including Linux, Mac OS X, and
- Cygwin. See README.unix for details. Supplementary
- details for Cygwin are in README.cygwin.
-
- Visual C++:
- We ship Visual C++ 6 project files, but MySQL++ only
- works with Visual C++ 7.1 (a.k.a. Visual Studio 2003)
- or newer. Your version of Visual Studio will upgrade
- these project files for you. See README.vc for details.
-
- MinGW:
- We ship Makefiles made for MinGW. These currently only
- work for building static versions of the library,
- which has licensing ramifications. See README.mingw
- for details.
-
-
-Example Programs
-~~~~~~~~~~~~~~~~
- You may want to try out the programs in the examples
- subdirectory to ensure that the MySQL++ API and your
- MySQL database are both working properly. Also, these
- examples give many examples of the proper use of MySQL++.
- See README.examples for further details.
-
-
-Unsupported Compliers
-~~~~~~~~~~~~~~~~~~~~~
- If you're on Windows but want to use some other compiler
- besides Visual C++ or GCC, you are currently on your own.
- There have been past efforts to port MySQL++ to other Windows
- compilers, but for one reason or another, all of these ports
- have died.
-
- On Unixy systems, GCC still works best. "Native" compilers
- and third-party compilers may work, but you're on your own
- to get it working.
-
- We have nothing in particular against these unsupported
- systems. We just lack the time and resources to support
- everything ourselves. If you are sufficiently motivated to
- get MySQL++ working on one of these alternate systems, see
- the HACKERS file first for guidance. If you follow the advice
- in that file, your patch will be more likely to be accepted.
-
-
-If You Want to Hack on MySQL++...
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If you intend to change the library or example code, please
- read the HACKERS file.
-
- If you want to change the user manual, read doc/userman/README.
-
- If you want to change the reference manual, see the Doxygen
- manual: http://www.stack.nl/~dimitri/doxygen/manual.html
+This is C++ API library for MySQL.
+
+Starting based of 1.2, this is now maintained by sinisa@cytanet.com.cy
+as kevinatk@home.com doesn't have time to support this library anymore.
+
+He has made sinisa@cytanet.com.cy a new official maintainer, which will
+continue to keep mysql++ library under LGPL.
+
+
+Original information from kevinatk@home.com:
+---------------------------------------------------------------------
+
+After several people commented on how my quickie wrapper would be of
+little use I decided to go all out and create a full featured
+version.
+
+To my knowledge this library requiures gcc 2.8 or egcc or better and of
+course the mysql library.
+
+To compile the library and modify the file Configure aproprietly
+and type make.
+
+I am working on trying to get this to compile into a library.
+However I really don't know what I am doing. If you have some
+experense with this please take a look at my makefile and uncomment the
+appropriate lines and let me know if I am doing everything right.
+
+For more information please see the manual.
+
+I developed it using egcc ver 1.02 (I think) from the Debian hamm
+package with kernel 2.0.33 and a Cryix P150+ cpu. I am also using
+Mysql 3.21.25 that is in the non-free section of the Debian
+distribution.
+
+Be sure to let me know what you think. I depend on your feedback.
+
+Thanks,
+I can be reached at kevinatk@home.com
+--------------------------------------------------------------------
+End of original README by Kevin Atkinson
+
+
+Since October 1999, all maintenance has been transferred to Sinisa
+Milivojevic (sinisa@cytanet.com.cy) and Michael Widenius (monty@mysql.com).
+
+Send your feedback to any of these addresses, or even better to the
+mailing list mysql-plusplus@lists.mysql.com.
+
+Since versin 1.1, mysql++ has been prepared to be built with automake and
+autoconf.
+
+This will make compilation and installation much easier.
+
+You should cd to the root of source directory and run ./configure.
+
+If you are running it several times, because you have problems, do delete
+config.cache. In case of the problem config.log contains more info on
+it's whereabouts.
+
+After configure is run, config.h and Makefiles are generated.
+
+If you wish to install mysql++ in a root directory other then /usr/local,
+you should run configure with --with-prefix=.....
+
+Configure contains description of other switches available.
+
+After running configure, run make and make install. Libs will be
+installed in prefix/lib and include files in prefix/include/mysql++.
+
+
+Since version 1.3, mysql++ is fully compliant with latest 2.95.xx series
+of compilers.
+
DELETED README.cygwin
Index: README.cygwin
==================================================================
--- README.cygwin
+++ /dev/null
@@ -1,33 +0,0 @@
-Prerequisite: Build MySQL
-~~~~~~~~~~~~~~~~~~~~~~~~~
- Before you can build MySQL++, you need to build the MySQL
- client library from source. This is necessary because
- Cygwin programs work best when linked to Cygwin libraries.
- You do not need to build a Cygwin version of the MySQL server;
- it's still best to use the native Win32 version of that.
-
- The MySQL client library does not build correctly out of
- the box. The best instructions I've found covering the
- necessary changes are here:
-
- http://cygwin.com/ml/cygwin/2004-11/msg00159.html
-
- I recommend that you use MySQL v4.1.x at this time. Skip the
- step changing the pthread stuff in my_thr_init.c, as this
- change has already been made in recent versions of MySQL.
-
- With the changes applied, build and install the client library
- like so:
-
- $ autoreconf --install --verbose --force
- $ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
- --infodir=/usr/share/info --mandir=/usr/share/man \
- --disable-shared --without-{debug,readline,libedit,server}
- $ make
- $ make install
-
-
-Building the Library and Example Programs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- With that done, you can build MySQL++ just as you would most
- other Unix programs. See README.unix for details.
DELETED README.examples
Index: README.examples
==================================================================
--- README.examples
+++ /dev/null
@@ -1,174 +0,0 @@
-Building the Examples
-~~~~~~~~~~~~~~~~~~~~~
- If you're installing MySQL++ from the source tarball, the example
- programs get built when you build the library. If you change
- any example code, just say 'make' to rebuild the examples.
- The examples are built against the headers and library in the
- lib subdirectory, not against the ones you may have installed
- elsewhere on the system.
-
- If these example files were installed on your system as part of
- the -devel RPM, copy all the files to a directory you can write
- to, then say 'make' in that directory. This uses a simplified
- Makefile, which builds the examples against the headers and
- libraries installed in the system directories.
-
-
-Getting Started with the Examples
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- MySQL++ is built as a shared library on most systems, and a DLL
- on Windows. Since it isn't built in the same directory as the
- examples, this means that your system won't be able to find the
- library without help until you install it. Since you generally
- want to run the examples _before_ installing the library, to test
- that the library actually works, we need a workaround.
-
- That workaround is the exrun script. There are two versions,
- a Bourne shell script called just exrun for POSIX systems, and
- exrun.bat for Windows.
-
- Before running the other examples, you must first create the
- sample database. On POSIX systems, you do that like so:
-
- $ ./exrun resetdb [host] [user] [password] [port]
-
- On Windows, that would instead be:
-
- C:\mysql++\> exrun.bat resetdb [host] [user] [pass] [port]
-
- If you mistakenly run resetdb directly instead of through exrun,
- it will either fail to run because it can't find the MySQL++
- library, or it will find an old version and complain about it.
- None of the other examples are protected against mixed versions
- in this way, but since you have to run resetdb before all the
- other examples, this should pose no problem.
-
- You can give as few of the parameters as you want, but they must
- be in that order. That is, if you want to give a user name,
- you must give the host first. It defaults to localhost with
- your user name, no password, and the default MySQL port (3306).
-
-
-Running the Other Command Line Examples
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- The following examples use the database set up by resetdb, and
- have the same command line format as resetdb:
-
- simple1: Shows the item names for all records in the sample
- stock table. Try this one if you do nothing else.
-
- simple2: Similar to simple1, but it displays all columns
- from the sample stock table, not just the item name.
-
- simple3: Same as simple2, except that it retrieves the data
- with a "use" query instead of a "store" query. See the
- user manual for the difference between these methods.
-
- custom1-6: Demonstrates the SSQLS features. These examples
- are explained in the user manual.
-
- usequery: Demonstrates Query::use(). Unlike simple3, which
- also showcases this function, this one shows how use
- queries interact with exception handling: when you walk
- past the end of a "use" query set with exceptions enabled,
- MySQL++ throws an exception to indicate end of results,
- which you must catch.
-
- multiquery: MySQL++ allows you to issue multiple queries at
- once, and get the results as separate sets. This shows
- that, and also how to use stored procedures, which return
- their results in the same way as a multiquery.
-
- tquery: A simple example showing how to use the template query
- facility.
-
- xaction: Shows how to use the Transaction class to create
- transaction sets which automatically roll back if not
- explicitly committed.
-
- store_if: Demonstrates the Query::store_if() method, which
- allows you to store the results of a query in an STL
- container conditionally. Think of it as a more powerful
- alternative to the SQL WHERE clause.
-
- for_each: Demonstrates the Query::for_each() method, which
- allows you to execute a query and call a functor on each
- returned row. This example uses this to gather statistics
- on the sample table's contents.
-
- load_jpeg: Inserts a JPEG file into the sample database,
- for use by the cgi_jpeg example. (See below.) Unlike
- the other examples, this one takes the last command
- line argument to be a JPEG file name. We've included
- examples/logo.jpg as a sample, if you want to use that.
-
- fieldinf1: Shows how to get information about the fields in
- a result set. (Types, etc.)
-
- dbinfo: Dumps a bunch of information about the database
- server and the tables in its 'mysql' database.
-
- If you run the load_jpeg example, you should consider also
- playing with the other half of the demonstration, cgi_jpeg.
- To run it, you'll need to install MySQL++ on a machine with
- a web server, then copy the cgi_jpeg program to the server's
- CGI directory. For example, on a stock Red Hat type box,
- that would be /var/www/cgi-bin. At that point, a request like
- http://my.server.com/cgi-bin/cgi_jpeg?id=1 should show the
- JPEG you loaded. The ID value to use will be that reported
- by load_jpeg.
-
-
-Dedicated Windows Examples
-~~~~~~~~~~~~~~~~~~~~~~~~~~
- If you're a Visual C++ user, there are two examples specially
- created for you:
-
- examples\vstudio\mfc.vcproj: A GUI replacement for the simple2
- example, it simply logs in and displays the stock table's
- contents. Uses good old C++ and MFC.
-
- examples\vstudio\wforms.vcproj: The same thing, only written in
- C++/CLI and using Windows Forms. We needed a second example
- for two reasons. First, string handling is quite different
- under .NET than in unmanaged C++. Second, many developers
- are now using Visual Studio Express, which doesn't include
- MFC. Please read README.vc before trying to run this example.
- The MySQL++ build settings must be modified before it will
- run correctly.
-
- Before trying to run these examples, run the updexdll.bat file
- in the top MySQL++ directory. This copies the built mysqlpp.dll
- files into the Windows examples' EXE output directories so you
- can run them before you're ready to formally install the DLL on
- your system.
-
- Open examples\vstudio\mysqlpp_gui_examples.sln to begin working
- with these examples. They only work correctly in Visual Studio
- 2005 right now. If you want to backport them to VS 2003, it's
- probably not hard, and we will accept patches for this. The main
- difficulty is that VS 2003 supports Managed C++, which isn't
- the same thing as C++/CLI.
-
- The main justification for these examples is that Unicode is
- handled differently in Windows GUI programs than on the POSIX
- systems where MySQL++ was born and raised. In earlier versions
- of MySQL++, the command line examples had very limited Unicode
- support on Windows, but it was unrealistic and confusing. Now the
- command line examples don't even try to handle Unicode on Windows,
- leaving that up to these new GUI examples.
-
-
-Special exrun Capabilities
-~~~~~~~~~~~~~~~~~~~~~~~~~~
- The Bourne shell version of the exrun script has a few features
- not avaiable in the Windows batch file version. These features
- let you run the examples under various debugging tools.
-
- You can get simple gdb debugging if you run an example like this:
-
- $ ./exrun gdb simple1 foo bar qux
-
- The script also supports valgrind, in memory leak testing mode:
-
- $ ./exrun valgrind simple1 foo bar qux
DELETED README.mingw
Index: README.mingw
==================================================================
--- README.mingw
+++ /dev/null
@@ -1,49 +0,0 @@
-MinGW Version
-~~~~~~~~~~~~~
- You need a fairly recent version of MinGW for MySQL++ to work.
- As I write this, the current release version includes GCC
- 3.4.2, which has known problems. Unless they've released
- a newer version since I wrote this, you'll probably need to
- install the "candidate" version for best compatibility.
-
-
-Prerequisite: Create Import Library
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Before you can build MySQL++ with MinGW, you will need to
- create a MinGW-compatible import library for MySQL's C API
- library. Using the current default install path for MySQL and
- assuming MySQL++ is in c:\mysql++, the commands to do this are:
-
- cd C:\Program Files\MySQL\MySQL Server 5.0\lib\opt
- dlltool -k -d c:\mysql++\libmysqlclient.def -l libmysqlclient.a
-
-
-Building the Library and Example Programs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Now you can build MySQL++ with this command:
-
- mingw32-make -f Makefile.mingw
-
- Notice that we're using the MinGW-specific version of GNU
- make, not the Cygwin or MSYS versions. This is in order to
- get proper path separator handling.
-
- If MySQL isn't in C:\Program Files\MySQL\MySQL Server 5.0\ you have
- two options:
-
- - The simplest is to edit Makefile.mingw. This is
- a generated file, but if that's all the only change
- to MySQL++ you need, it works fine.
-
- - If you're doing deeper work on MySQL++, you
- should make your changes in mysql++.bkl instead.
- Then to generate Makefile.mingw from that file,
- you will need the Win32 port of Bakefile from
- http://bakefile.sf.net/ The command to do that is:
-
- bakefile -f mingw -o Makefile.mingw mysql++.bkl
-
- Once the library is built and you're satisfied that it's working
- correctly, you can run the install.bat file at the project
- root to automatically install the library files and headers in
- subdirectories under c:\mysql++.
DELETED README.unix
Index: README.unix
==================================================================
--- README.unix
+++ /dev/null
@@ -1,61 +0,0 @@
-Building the Library and Example Programs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- MySQL++ uses the GNU autoconf, so you can build it with the
- standard commands:
-
- # ./configure
- $ make
- $ su
- # make install
-
- On Linux, you also need to run 'ldconfig' as root after
- installing the library. You may need to add the library's
- installation directory to /etc/ld.so.conf before you do this,
- particularly if you installed to /usr/local.
-
-
-Configure Options
-~~~~~~~~~~~~~~~~~
- The configure script takes several interesting options. Say:
-
- $ ./configure --help
-
- to get a list. Some of the more interesting flags are:
-
- --prefix:
-
- If you wish to install mysql++ in a root directory
- other than /usr/local, run configure with
- --prefix=/some/dir/name
-
- --with-mysql*:
-
- If you installed MySQL in an atypical location,
- the configure script will not be able to find the
- library and header files without help. The simplest
- way to clue configure into where MySQL is installed
- is with the --with-mysql option. Try something
- like "--with-mysql=/usr/local/mysql", for instance.
- The configure script will then try to guess which
- subdirectories under the given directory contain the
- library and include files.
-
- If that still doesn't work, use --with-mysql-include
- and --with-mysql-lib instead. As with --with-mysql,
- configure can often guess which subdirectory under the
- given directory contains the needed files, so you don't
- necessarily have to give the full path to these files.
-
- --enable-thread-check:
-
- Builds MySQL++ with threads support, if possible.
-
- This option simply turns on two tests: first, that
- your system uses a compatible threading library; and
- second, that the thread-safe version of the MySQL C API
- library (libmysqlclient_r) is installed and working.
- If both of these are true, you get a thread-aware
- version of MySQL++. "Thread-aware" means that the
- library does make an effort to prevent problems, but
- we don't guarantee that all possible uses of MySQL++
- are thread-safe.
DELETED README.vc
Index: README.vc
==================================================================
--- README.vc
+++ /dev/null
@@ -1,178 +0,0 @@
-Prerequisites
-~~~~~~~~~~~~~
- MySQL++ requires Visual Studio 2003 or later. Earlier versions
- did not support a sufficiently broad subset of Standard C++.
-
- You also need to have MySQL installed. The installer may have
- given you the option of whether to install the development files
- or not; if you didn't let it install them, you need to reinstall.
-
-
-Building the Library and Example Programs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- As of MySQL++ v2.2, there is only one set of project files
- in the top level directory for MySQL++. We ship VC++6 style
- project files (.dsw and .dsp instead of .sln and .vcproj) due to
- a limitation of the tool we use to generate the project files.
- Just let Visual Studio convert these to the new format.
-
- If you installed MySQL somewhere other than
-
- C:\Program Files\MySQL\MySQL Server 5.0\
-
- you need to change the project file settings. The simplest way
- to do this is to change the link and include file directories in
- the project settings directly. Although these are technically
- generated files and it's generally bad practice to change generated
- files, if that's all the only change to MySQL++ you need, this
- is harmless. See below if you want to change the actual source
- files that create the project files.
-
- Be sure to build both the Debug and Release versions of the
- library. You will need them both because when you build your
- program in Release mode, it won't work with mysqlpp.dll built
- in Debug mode. The converse may also be true, but I'm not sure.
- The simplest way to ensure that you're running your program against
- the correct DLL is to copy the debug version of the MySQL++ DLL
- into your program's Debug build directory, and the same for the
- release version.
-
- With the library built, run at least the resetdb and simple1
- examples to ensure that the library is working correctly.
- See README.examples for further details.
-
- Once you're sure the library is working correctly, run the
- install.bat file at the project root to automatically install
- the library files and headers in subdirectories under c:\mysql++.
-
-
-Using MySQL++ in an MFC Project
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- If you don't already have a project set up, open Visual Studio, say
- File::New::Project, then choose Visual C++::MFC::MFC Application.
- Go through the wizard setting up the project as you see fit.
-
- Once you have your project open, right click on your top-level
- executable in the Solution Explorer, choose Properties, and make
- the following changes. (Where it doesn't specify Debug or Release,
- make the change to both configurations.)
-
- o Append the following to C/C++::General::Additional Include
- Directories:
-
- C:\Program Files\MySQL\MySQL Server 5.0\include,
- C:\mysql++\include
-
- o Under C/C++::Code Generation change "Runtime Library" to
- "Multi-threaded Debug DLL (/MDd)" for the Debug
- configuration. For the Release configuration, make it
- "Multi-threaded DLL (/MD)".
-
- o Append the following to Linker::General::Additional Library
- Directories for the Debug configuration:
-
- C:\Program Files\MySQL\MySQL Server 5.0\lib\debug,
- C:\mysql++\vc\debug
-
- For the Release configuration, make it the same, but
- change the 'debug' directory names to 'opt'.
-
- o Under Linker::Input add the following to "Additional
- Dependencies":
-
- libmysql.lib wsock32.lib mysqlpp.lib
-
- You may want to study examples\vstudio\mfc\mfc.vcproj to see
- this in action. Note that some of the paths will be different,
- because it can use relative paths for mysqlpp.dll.
-
-
-Using MySQL++ in a Windows Forms C++/CLI Project
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Before you start work on getting MySQL++ working with your own
- program, you need to make some changes to the MySQL++ build settings.
- Open mysqlpp.sln, then right-click on the mysqlpp target and select
- Properties. Make the following changes for both the Debug and
- Release configurations:
-
- o Under Configuration Properties::General, change "Common
- Language Runtime support" to the /clr setting.
-
- o Under C/C++::Command Line, remove the /EHsc from the
- Additional Options section.
-
- If you have already built MySQL++, be sure to perform a complete
- rebuild after changing these options. The compiler will emit several
- C4835 warnings after making those changes, which are harmless when
- using the DLL with a C++/CLI program, but which warn of real problems
- when using it with unmanaged C++. As a result, it's probably best
- if you don't install the resulting DLL in a system level directory.
- I'd recommend copying it only into the same directory as the EXE.
-
- Once you have MySQL++ built with CLR support, open your program's
- project. If you don't already have a project set up, open Visual
- Studio, say File::New::Project, then choose Visual C++::CLR::Windows
- Forms Application. Go through the wizard setting up the project as
- you see fit.
-
- The configuration process isn't much different from that for an
- MFC project, so go through the list above first. Then, make the
- following changes particular to .NET and C++/CLI:
-
- o Under Configuration Properties::General change the setting
- from /clr:pure to /clr. (You need mixed assembly support
- to allow a C++/CLI program to use a plain C++ library like
- MySQL++.)
-
- o For the Linker::Input settings, you don't need wsock32.lib.
- The mere fact that you're using .NET takes care of that
- dependency for you.
-
- In the MFC instructions above, it said that you need to build it
- using the Multi-threaded DLL version of the C++ Runtime Library.
- That's not strictly true for MFC, but it's an absolute requirement
- for C++/CLI. See the Remarks in this MSDN article for details:
-
- http://msdn2.microsoft.com/en-us/library/k8d11d4s.aspx
-
- You may want to study examples\vstudio\wforms\wforms.vcproj to see
- all this in action. Note that some of the paths will be different,
- because it can use relative paths for mysqlpp.dll.
-
-
-Working With Bakefile
-~~~~~~~~~~~~~~~~~~~~~
- MySQL++'s Visual Studio project files aren't maintained directly.
- Instead, they're generated from mysql++.bkl using a tool called
- Bakefile, from http://bakefile.sourceforge.net/ We do it this
- way so we can support multiple platforms and build systems in a
- common way.
-
- Therefore, if you need to make changes to the project files
- and want to submit those changes back to the MySQL++ project,
- you need to do your changes to mysql++.bkl instead of directly to
- the project files. There is a native Win32 version of Bakefile up
- on that web site. Download that and put the directory containing
- bakefile.exe in your Windows PATH.
-
- The documentation on the Bakefile web site isn't wonderful, but
- is adequate for most things. If you can't find documentation
- for the feature you need, it's quite likely that Bakefile just
- doesn't support it. There are things you can do to the project
- settings in Visual Studio that you can't do in Bakefile, since
- it's a cross-platform tool.
-
- Once you've made your changes, generate the Visual C++ project
- files with this command:
-
- bakefile -f msvc6prj mysql++.bkl
-
-
-If You Run Into Problems...
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Especially if you have linking problems, make sure your project
- settings match the above. Visual C++ is very picky about things
- like run time library settings. When in doubt, try running one
- of the example programs. If it works, the problem is likely in
- your project settings, not in MySQL++.
-
DELETED Wishlist
Index: Wishlist
==================================================================
--- Wishlist
+++ /dev/null
@@ -1,326 +0,0 @@
-Patches for any of these thoughtfully considered! See the HACKERS file
-for instructions on sending patches.
-
-Here's a meta-item that doesn't really fit into any of the categories
-below: any time you must hand-roll some SQL code in your program,
-consider whether it could be reduced to an API feature that would be
-widely useful. Patches or proposals of this sort are always welcome.
-
-
-v2.x Features
--------------
- Items in this section may slip to v3.0. The only thing that
- puts an item in this section instead of the v3.0 one is that
- it can be done without breaking the ABI, which would force
- a feature to v3.0.
-
- o Add ConnectionPool class, described in this post:
-
- http://lists.mysql.com/plusplus/6631
-
- o Extend the manipulators to handle nullable versions of
- the types we already support. Should just be a matter of
- duplicating the existing type-specific manipulator functions,
- and wrapping the types in Null<>.
-
- o Add a few features to date and time classes:
-
- - It may be possible to get some nice syntactic sugar,
- such as a way to call SQL functions like NOW() when
- inserting certain Date/Time objects into a Query stream.
-
- - Arithmetic features? (See "Practical Algorithms for
- Programmers" by Binstock and Rex.)
-
- o Add conditional code to the Lockable mechanism to use platform
- mutexes if available, to implement these MySQL C API
- restrictions:
-
- - Only one query executing at once per connection
-
- - For "use" queries, Connection (and therefore Query) object must
- remain locked until last row is consumed
-
- - Safest to have one Connection per thread. Rules for sharing:
- http://dev.mysql.com/doc/mysql/en/threaded-clients.html
-
- Need some way to call mysql_thread_init() and
- mysql_thread_end() per thread. Also, work in some way to
- call mysql_thread_safe() automatically, perhaps the first
- time through the function that calls mysql_thread_init().
- If the C API library reports that it is not thread-safe,
- report this to the caller, perhaps through an exception,
- or simply by refusing to init more than one thread.
-
- o Build a forward iterator mechanism for ResUse. Make it
- general enough that you can use it with STL algorithms
- like find_if(). Then make an example to demonstrate this
- augmentation of SELECT. Also, update usequery example
- to use the iterator. Tricky bit: how do we make it not
- interfere with subclass Result's random-access iterator?
-
- o It may be possible to optimize the use of ColData in the return
- from Row::operator[]. Currently, that operator returns a
- temporary ColData object, which contains a copy of the field data
- in its std::string base class instead of a const char* pointer
- to data within the Row object. If the caller just wants a
- const char*, we can avoid at least one copy here, maybe two. See:
-
- http://lists.mysql.com/plusplus/4451
- http://lists.mysql.com/plusplus/4460
-
- o Add Chris Frey's packarray class?
-
-
-v3.0 Plan
----------
-
- Version 3.0 is primarily for those changes that will break
- the ABI. (i.e. removing functions, changing function
- signatures, etc.) This plan is very tenuous. Some of this
- could slip to v4.0.
-
- o Remove all remaining query_reset function parameters, unless
- the function doesn't actually override them.
-
- o Refactor option mechanism in Connection class into its own
- class. There are a whole lot of functions, structs and
- enums related to this.
-
- o Connection::bad_option() should save its built error message
- in an instance variable, and Connection::error() should
- use that when set, so you can get an explanation of option
- setting errors when exceptions are disabled.
-
- o The Connection::connect() arguments for turning on compression
- and setting the connection timeout should be removed. These
- can be set directly using Connection::set_option().
-
- o Add table creation ability to SSQLS. It has the schema, so...
-
- o SSQLS should allow table column order to differ from
- structure field order. Not only will this decouple the
- definitions, it will allow queries for a subset of the fields
- without restricting you to the first N contiguous fields.
- This will require doing a by-name lookup for each field
- when populating it from the MYSQL_ROW object, but if you
- need the highest possible speed, you shouldn't be using
- SSQLS to begin with.
-
- o Evaluate whether Query's copy ctor should be made private.
- Copying these objects probably never makes sense.
-
- o Rename Query::success() and Query::success_. The names imply
- that they only have meaning once a query is tried, but
- that isn't true. They're an indicator of whether the
- object has had any problems at all, not just problems in
- query execution.
-
- o Rename Query::def to Query::tquery_defaults. Makes its
- purpose clearer. Also, examine all other public data
- members, to see if they have a similar problem.
-
- o Connection::error() returns const char*, while Query::error()
- returns std::string. Pick one.
-
- o Remove MutableColData. It's only used once in the library,
- within myset.h, and that usage is inefficient to the point
- of wanting replacement anyway.
-
- o Turn ColData_Tmpl into a concrete class. Use private
- std::string instance as buffer, and replicate the std::string
- interface publically, delegating to that buffer.
-
- o Use this new class in place of ColData_Tmpl,
- and remove const_string class.
-
- o More robust fix for the Query stream base class init problem:
- http://www.boost.org/libs/utility/base_from_member.html
-
- Requires inheritance change, which is why it has to be in v3.
-
- o Query::str() appends a null byte to the end of the string it
- returns each time it is called. It is arguable whether it
- should append a null byte at all, since std::string doesn't
- need it. But even if it does, it at least should recognize
- when the string already has a null, and not keep adding them
- when it is called repeatedly. See this thread for details:
-
- http://lists.mysql.com/plusplus/6252
-
- o Should sql_timestamp typedef not be for DateTime class, not Time
- class?
-
- o Apply Richard Forrest's iterator patch.
-
- o The quote manipulator (and presumably the others as well) don't
- work properly with char*. See this for details:
-
- http://lists.mysql.com/plusplus/5617
-
- o Change the unsigned int overloads for operator[] on
- const_subscript_iterator and its subclasses from unsigned
- int to a plain int. This should fix the ambiguous overload
- problems, such as with row[0].
-
- See the following threads for reference:
- http://lists.mysql.com/plusplus/4947
- http://lists.mysql.com/plusplus/4952
- http://lists.mysql.com/plusplus/4960
-
- o Several MySQL++ functions wrap the MySQL C API too literally:
- they indicate success by returning 0 instead of true,
- as most other wrapper functions do.
-
- o Apply Waba's patch allowing Null fields in SSQLSes:
- http://lists.mysql.com/plusplus/5433
-
- o Deprecate sql_create_basic_* They have less functionality
- and they're no easier to use than sql_create and friends.
-
- o Consider whether some of the current boilerplate can be
- made into a base class that all SSQLSes derive from. Some
- template functions like Query::insert might become regular
- member functions, taking a reference to the SSQLS base class.
-
- o Abstract all uses of MySQL C API functions into a database
- driver class with a generic interface. This is a step
- towards database-independence, without the parallel class
- hierarchy required by the MySQL++ 1.7 design. Also, it
- will make it easier to make class Connection completely
- friend-less. Right now, the main reason it needs friends
- is because these other classes make C API calls using its
- private MYSQL data member. The other reasons for it having
- friends aren't nearly as compelling, so it wouldn't be
- hard to justify redesigning Connection to eliminate these
- final reasons.
-
- While it would be easy to have just one global database
- driver object, it's probably going to be necessary to have
- one per Connection. Consider what happens when you have one
- program connected to two very different MySQL databases,
- and you indirectly call C API functions that take MYSQL
- parameters. It's likely that those calls are supposed
- to behave different, depending on the data in that MYSQL
- object; for instance, different character encodings in the
- selected databases. So, there must somehow be a way to pass
- the database driver's instance pointer down to all objects
- that will need to use the driver. A side benefit is that
- a single program could talk to multiple different database
- server types. Imagine a program for importing data from
- PostgreSQL and loading it into a MySQL table, for instance.
-
- o Query::preview() is just an alias for Query::str().
- Pick one.
-
- o Remove Query::execute(), store() and use() overloads taking
- a SQLQueryParms object reference. With the changes in
- v2.2 making the single SQLString overload the end-point
- of the call chain, this just adds one more layer to the
- call chain. Oh, sure, maybe there is someone out there who
- uses this...but probably not. Much more likely it's just
- an outdated step that adds nothing to the user experience.
-
- o The sense of Lockable::lock()'s return value is backwards.
- It should return true if it succeeds in locking the object.
-
- o Remove simple const char* version of Query::execute(),
- store(), and use()? SQLString already has a conversion
- ctor taking a const char* string, so there should be no
- need for this explicit overload.
-
-
-
-Future Features
----------------
-
- These changes are not assigned to any particular version.
- They could happen at any time. If you want one to appear at
- some definite date, get coding and provide a patch!
-
- o SSQLS v2. Not sure how it will look yet, but there are ideas
- in play, and patches to study.
-
- o Figure out some way to name debug DLL and library under VC++
- differently (trailing 'd'?) to prevent some problems due
- to mixing debug and release programs and MySQL++ DLLs.
- This appears to require changes to Bakefile, or some sort of
- post-build hackery.
-
- o Create adaptors for std::bitset, for storing binary data in a
- MySQL table. Make two options available, one for storing
- the return from bitset::to_ulong() in an UNSIGNED INTEGER
- column, and another for storing a larger set of bits in a
- more flexible way, perhaps as a BLOB.
-
- o Row object currently depends on the associated ResUse object
- to stick around through all calls to .at(), because it needs
- the list of field types in the result set to construct
- ColData objects. This means it's not possible to store
- the result of several queries before accessing the data.
- Currently, this is just a documented limitation, but it
- would be nice if there were a clean way to avoid this.
- Obviously you could just copy the type list when constructing
- the Row object, but that seems pointlessly inefficient.
-
- o Define operator<< for Fields, Row, ResUse, etc. In other
- words, there should be a way to get a user-readable version
- of received data without a lot of code. Perhaps use a CSV
- output format, or a mysql(1) one (ASCII grid).
-
- o manip.cpp uses mysql_escape_string(), which doesn't take the
- selected database's character set into account. To do that,
- you must use mysql_real_escape_string(), which differs
- by taking a MYSQL instance as an additional parameter.
- The problem is, Connection owns the relevant MYSQL instance,
- and the manipulator functionality is implemented in global
- functions (operator<<() and such) so they have no direct
- access to the relevant Connection object.
-
- The key question for all operator<<'s for manipulators
- to ask is, "which Query object am I being inserted into?"
- From there, you can look up the associated Connection object.
-
- In some cases, this answer to the question is easy, because
- the operator takes an ostream parameter, which can be
- dynamically cast to Query. From there, it's just a lookup
- table problem.
-
- Other operator<<'s don't take an ostream, but they do take
- a manipulator. Right now, manipulators are just enum values,
- but they could in fact be classes. Classes can carry data,
- so there may be a way to "bind" them to the appropriate
- Connection object. If not, then perhaps some other method
- will pop out of the database driver class idea. The driver
- object may be able to look up a suitable Connection object
- for the manipulators.
-
- o MySQL++ handles automatic quoting and escaping differently
- for cout and cerr than for Query streams. This should
- probably be simplified so that automatic quoting is only
- done for Query streams. No other stream type should be
- treated specially.
-
- o Some field_list() functions use the do_nothing manipulator,
- while others use the quote manipulator. Need to pick one.
- In the vast majority of cases, quoting won't be necessary,
- so make that the default. But, it should be possible to turn
- it on, if needed. If all uses of quoting are in template
- code, this can be a #define, allowing different programs
- built on the same system to get different quoting rules.
- Otherwise, it will probably have to be a configure script
- flag, which will "burn" the choice into the built binary.
-
- o User-settable floating-point comparison precisions?
- Something like this: http://lists.mysql.com/plusplus/3984
- As it currently stands, sql_cmp(double,double) is foolish.
- One shouldn't do exact equality comparison on floating
- point values.
-
- o Consider using MySQL C API enum constants in
- mysql_type_info::types definition instead of hard-coded
- values. This could potentially break a lot of
- infrastructure, though, so do it only with care.
-
- o Support prepared statements.
-
ADDED autogen.sh
Index: autogen.sh
==================================================================
--- /dev/null
+++ autogen.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+libtoolize --automake
+aclocal
+autoconf
+autoheader
+
+for fn in AUTHORS ChangeLog NEWS README
+do
+ if [ ! -e "$fn" ]
+ then
+ touch "$fn"
+ fi
+done
+
+automake -a
+./configure $*
+
DELETED bootstrap
Index: bootstrap
==================================================================
--- bootstrap
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-ARGS=1
-BF_OPTIONS=
-while [ $ARGS != 0 ]
-do
- case "$1" in
- nodoc)
- BF_OPTIONS="-DBUILDDOCS=no $BF_OPTIONS"
- shift
- ;;
-
- noex)
- BF_OPTIONS="-DBUILDEXAMPLES=no $BF_OPTIONS"
- shift
- ;;
-
- nolib)
- BF_OPTIONS="-DBUILDLIBRARY=no $BF_OPTIONS"
- shift
- ;;
-
- noopt)
- export CXXFLAGS="-g -O0"
- shift
- ;;
-
- pedantic)
- export CXXFLAGS="-g -O2 -ansi -pedantic -Wall -W -Wold-style-cast -Wfloat-equal -Wwrite-strings -Woverloaded-virtual -Wno-long-long"
- shift
- ;;
-
- *)
- ARGS=0
- ;;
- esac
-done
-
-rm -f config.cache
-set -x
-
-./rebake $BF_OPTIONS &&
- bakefile -f gnu -o Makefile.simple -DBUILDLIBRARY=no mysql++.bkl &&
- aclocal -I config -I /usr/local/share/aclocal &&
- autoheader &&
- autoconf &&
- ./reconf --enable-maintainer-mode $* &&
- make lib/custom.h lib/querydef.h
-
DELETED cleanmf
Index: cleanmf
==================================================================
--- cleanmf
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-rm -f *.{ds?,ncb,sln,suo,vcproj}
-rm -f Makefile
-rm -f Makefile.{in,mingw,simple}
ADDED config.cygwin
Index: config.cygwin
==================================================================
--- /dev/null
+++ config.cygwin
@@ -0,0 +1,104 @@
+####### Compiler, tools and options
+
+CC = g++
+CFLAGS = -DWINDOZE -D_WIN32 -O0 -mno-cygwin -D__cplusplus -Wall
+-fstrength-reduce -D__WIN32__ -I/cygnus/cygwin-b20/include/g++ -I/cygnus/cygwin-b20/include/g++ -I/my/mysql_src/mysql-3.22.13-beta/include -L/my/mysql_src/mysql-3.22.13-beta/client/.libs -L../sqlplusint -mno-cygwin
+#CFLAGS += -fkeep-inline-functions
+# If you have problems when with undefined refrences try uncommenting
+# the above line when compiling the library. But then recommenting
+# it when you compile the examples.
+FPIC =# -fPIC
+INCPATH = -I/cygnus/cygwin-b20/include/g++ -I/my/mysql_src/mysql-3.22.13-beta/include # make sure you can find mysql.h
+LINK = g++
+LFLAGS = -mno-cygwin # make sure you can find mysqlclinet
+NLFLAGS = -lmysql++ # this is for the static lib test
+SLFLAGS = -lmysql++ # this is for shared lib test
+LIBS = -lmysqlclient -mno-cygwin
+SOLLIBS = -lnsl -lsocket # extra lib that Solaris needs
+ARC = ar rc
+CP_R = cp -a
+RMDIR = echo
+#RMDIR = rmdir
+#uncomment the above line if your sure your rmdir does NOT delete non-empty
+#directories. If it does make remove could be DISASTORIUS.
+INSTLIB = /usr/lib
+INSTHEAD = /usr/include
+INSTBIN = /usr/bin
+PERLPATH = /usr/bin/perl
+
+#CFLAGS += -D NO_LONG_LONGS
+
+#TYPE = objs
+TYPE = static
+#TYPE = shared
+
+TARGET = linux
+#TARGET = solaris
+##
+
+# You should not need to modify anything below this line. If you do
+# need to modify something below this line please email me at
+# sinisa@cytanet.com.cy with what you did.
+
+ifeq ($(TARGET), solaris)
+ LIBS += $(SOLLIBS)
+endif
+
+OBJSINT = coldata.o connection.o datetime.o field_names.o field_types.o \
+ manip.o query.o result.o row.o set.o sql_query.o type_info.o vallist.o
+
+HEADERS = mysql++ mysql++.h mysql++-custom mysql++-custom.h
+
+HEADSINT = mysql++ defs \
+ define_short coldata1.hh \
+ type_info1.hh const_string1.hh \
+ null1.hh compare1.hh row1.hh \
+ resiter1.hh vallist1.hh manip1.hh \
+ sql_string1.hh sql_query1.hh \
+ sql_query0.hh datetime1.hh \
+ stream2string1.hh tiny_int1.hh \
+ set1.hh connection1.hh query1.hh \
+ result1.hh field_names1.hh \
+ tracker.h field_types1.hh \
+ fields1.hh connection0.hh \
+ convert1.hh coldata2.hh \
+ compare2.hh connection2.hh \
+ query2.hh const_string2.hh \
+ convert2.hh datetime2.hh \
+ stream2string2.hh field_names2.hh \
+ field_types2.hh fields2.hh \
+ manip2.hh null2.hh result2.hh \
+ row2.hh set2.hh stream2string3.hh \
+ sql_query2.hh sql_string2.hh \
+ tiny_int2.hh type_info2.hh \
+ vallist2.hh coldata3.hh \
+ convert3.hh null3.hh compare3.hh \
+ connection3.hh const_string3.hh \
+ datetime3.hh field_names3.hh \
+ field_types3.hh manip3.hh \
+ query3.hh result3.hh row3.hh \
+ set3.hh sql_query3.hh \
+ sql_string3.hh tiny_int3.hh \
+ type_info3.hh vallist3.hh \
+ custom.hh custom-macros.hh
+
+####### Implicit rules
+
+.SUFFIXES:
+
+%.o: %.cc
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+
+%: %.o
+ifeq ($(TYPE), objs)
+ $(CC) $(CFLAGS) $(LIBS) -o $@ ../sqlplusint/*.o $^
+endif
+ifeq ($(TYPE), static)
+ $(CC) $(CFLAGS) $(NLFLAGS) $(LIBS) -o $@ $^
+endif
+ifeq ($(TYPE), shared)
+ $(CC) $(CFLAGS) $(SLFLAGS) $(LIBS) -o $@ $^
+endif
ADDED config.h.in
Index: config.h.in
==================================================================
--- /dev/null
+++ config.h.in
@@ -0,0 +1,52 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+/*
+** This file has been automatically generated by 'acconfig' from aclocal.m4
+** Copyright (C) 1988 Eleftherios Gkioulekas
+**
+** This file is free software; as a special exception the author gives
+** unlimited permission to copy and/or distribute it, with or without
+** modifications, as long as this notice is preserved.
+**
+** This program is distributed in the hope that it will be useful, but
+** WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/* This is the top section */
+
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+#undef SQLPLUS_MAJOR_VERSION
+#undef SQLPLUS_MINOR_VERSION
+#undef SQLPLUS_MICRO_VERSION
+#undef SQLPLUS_INTERFACE_AGE
+#undef SQLPLUS_BINARY_AGE
+
+/* Define if you have the strtol function. */
+#undef HAVE_STRTOL
+
+/* Define if you have the intl library (-lintl). */
+#undef HAVE_LIBINTL
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* This is the bottom section */
+
DELETED config/acx_pthread.m4
Index: config/acx_pthread.m4
==================================================================
--- config/acx_pthread.m4
+++ /dev/null
@@ -1,233 +0,0 @@
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl This macro figures out how to build C programs using POSIX
-dnl threads. It sets the PTHREAD_LIBS output variable to the threads
-dnl library and linker flags, and the PTHREAD_CFLAGS output variable
-dnl to any special C compiler flags that are needed. (The user can also
-dnl force certain compiler flags/libs to be tested by setting these
-dnl environment variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl NOTE: You are assumed to not only compile your program with these
-dnl flags, but also link it with them as well. e.g. you should link
-dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
-dnl
-dnl If you are only building threads programs, you may wish to
-dnl use these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE
-dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
-dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
-dnl the default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform,
-dnl or if you have any other suggestions or comments. This macro was
-dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
-dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread
-dnl macros posted by Alejandro Forero Cuervo to the autoconf macro
-dnl repository. We are also grateful for the helpful feedback of
-dnl numerous users.
-dnl
-dnl @version $Id: acx_pthread.m4 1129 2005-10-04 17:53:10Z wyoung $
-dnl @author Steven G. Johnson
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthread or
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
- if test x"$acx_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include ],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_TRY_LINK([#include ], [int attr=$attr;],
- [attr_name=$attr; break])
- done
- AC_MSG_RESULT($attr_name)
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
DELETED config/libm.m4
Index: config/libm.m4
==================================================================
--- config/libm.m4
+++ /dev/null
@@ -1,37 +0,0 @@
-dnl @synopsis LIB_MATH
-dnl
-dnl This macro figures out how whether programs using C's math routines
-dnl need to link to libm or not. This is common on SysV Unices.
-dnl
-dnl @category C
-dnl @author Warren Young
-dnl @version 1.2, 2006-03-06
-
-AC_DEFUN([LIB_MATH],
-[
- AC_MSG_CHECKING([whether -lm is needed to use C math functions])
-
- MYSQLPP_EXTRA_LIBS=
- TRY_LIBM=no
- AC_TRY_LINK(
- [ #include ],
- [ floor(0); ], AC_MSG_RESULT(no), TRY_LIBM=yes)
-
- if test "x$TRY_LIBM" = "xyes"
- then
- save_LIBS=$LIBS
- LIBS="$LIBS -lm"
- AC_TRY_LINK(
- [ #include ],
- [ floor(0); ],
- [
- MYSQLPP_EXTRA_LIBS=-lm
- AC_MSG_RESULT(yes)
- ],
- AC_MSG_ERROR([Failed to build program containing math functions!]))
- LIBS="$save_LIBS"
- fi
-
- AC_SUBST(MYSQLPP_EXTRA_LIBS)
-])
-
DELETED config/localtime_r.m4
Index: config/localtime_r.m4
==================================================================
--- config/localtime_r.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl @synopsis AX_C_LOCALTIME_R
-dnl
-dnl This macro determines whether the C runtime library contains
-dnl localtime_r(), a thread-safe replacement for localtime().
-dnl
-dnl @version 1.0, 2007/02/20
-dnl @author Warren Young
-AC_DEFUN([AX_C_LOCALTIME_R],
-[
- AC_MSG_CHECKING([for localtime_r()])
-
- AC_TRY_RUN([
- #include
- int main(void)
- {
- time_t tt;
- struct tm stm;
- localtime_r(&tt, &stm);
- return 0;
- }
- ], [localtime_r_found=yes], [localtime_r_found=no], [localtime_r_found=no])
-
- AC_MSG_RESULT([$localtime_r_found])
- if test x"$localtime_r_found" = xyes
- then
- AC_DEFINE(HAVE_LOCALTIME_R, 1,
- [Define if you have the localtime_r() facility])
- fi
-]) dnl AX_C_LOCALTIME_R
-
DELETED config/mysql++.m4
Index: config/mysql++.m4
==================================================================
--- config/mysql++.m4
+++ /dev/null
@@ -1,131 +0,0 @@
-#-######################################################################
-# mysql++.m4 - Example autoconf macro showing how to find MySQL++
-# library and header files.
-#
-# Copyright (c) 2004-2005 by Educational Technology Resources, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published
-# by the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# 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
-#-######################################################################
-
-dnl @synopsis MYSQLPP_DEVEL
-dnl
-dnl This macro tries to find the MySQL++ library and header files.
-dnl
-dnl We define the following configure script flags:
-dnl
-dnl --with-mysqlpp: Give prefix for both library and headers, and try
-dnl to guess subdirectory names for each. (e.g. tack /lib and
-dnl /include onto given dir name, and other common schemes.)
-dnl --with-mysqlpp-lib: Similar to --with-mysqlpp, but for library only.
-dnl --with-mysqlpp-include: Similar to --with-mysqlpp, but for headers
-dnl only.
-dnl
-dnl This macro depends on having the default compiler and linker flags
-dnl set up for building programs against the MySQL C API. The mysql.m4
-dnl macro in this directory fits this bill; run it first.
-dnl
-dnl @version 1.0, 2005/07/13
-dnl @author Warren Young
-
-AC_DEFUN([MYSQLPP_DEVEL],
-[
-AC_CACHE_CHECK([for MySQL++ devel stuff], ac_cv_mysqlpp_devel,
-[
- #
- # Set up configure script macros
- #
- AC_ARG_WITH(mysqlpp,
- [ --with-mysqlpp= path containing MySQL++ header and library subdirs],
- [MYSQLPP_lib_check="$with_mysqlpp/lib $with_mysqlpp/lib/mysql++"
- MYSQLPP_inc_check="$with_mysqlpp/include $with_mysqlpp/include/mysql++"],
- [MYSQLPP_lib_check="/usr/local/mysql++/lib /usr/local/lib/mysql++ /opt/mysql++/lib /usr/lib/mysql++ /usr/local/lib /usr/lib"
- MYSQLPP_inc_check="/usr/local/mysql++/include /usr/local/include/mysql++ /opt/mysql++/include /usr/local/include/mysql++ /usr/local/include /usr/include/mysql++ /usr/include"])
- AC_ARG_WITH(mysqlpp-lib,
- [ --with-mysqlpp-lib= directory path of MySQL++ library],
- [MYSQLPP_lib_check="$with_mysqlpp_lib $with_mysqlpp_lib/lib $with_mysqlpp_lib/lib/mysql"])
- AC_ARG_WITH(mysqlpp-include,
- [ --with-mysqlpp-include= directory path of MySQL++ headers],
- [MYSQLPP_inc_check="$with_mysqlpp_include $with_mysqlpp_include/include $with_mysqlpp_include/include/mysql"])
-
- #
- # Look for MySQL++ library
- #
- MYSQLPP_libdir=
- for dir in $MYSQLPP_lib_check
- do
- if test -d "$dir" && \
- ( test -f "$dir/libmysqlpp.so" ||
- test -f "$dir/libmysqlpp.a" )
- then
- MYSQLPP_libdir=$dir
- break
- fi
- done
-
- if test -z "$MYSQLPP_libdir"
- then
- AC_MSG_ERROR([Didn't find the MySQL++ library dir in '$MYSQLPP_lib_check'])
- fi
-
- case "$MYSQLPP_libdir" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL++ library directory ($MYSQLPP_libdir) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([lib in $MYSQLPP_libdir])
-
- case "$MYSQLPP_libdir" in
- /usr/lib) ;;
- *) LDFLAGS="$LDFLAGS -L${MYSQLPP_libdir}" ;;
- esac
-
-
- #
- # Look for MySQL++ headers
- #
- AC_MSG_CHECKING([for MySQL++ header directory])
- MYSQLPP_incdir=
- for dir in $MYSQLPP_inc_check
- do
- if test -d "$dir" && test -f "$dir/mysql++.h"
- then
- MYSQLPP_incdir=$dir
- break
- fi
- done
-
- if test -z "$MYSQLPP_incdir"
- then
- AC_MSG_ERROR([Didn't find the MySQL++ header dir in '$MYSQLPP_inc_check'])
- fi
-
- case "$MYSQLPP_incdir" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL++ header directory ($MYSQLPP_incdir) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([$MYSQLPP_incdir])
-
- CPPFLAGS="$CPPFLAGS -I${MYSQLPP_incdir}"
-
- AC_MSG_CHECKING([that we can build MySQL++ programs])
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([#include ],
- [std::string s; mysqlpp::escape_string(s)])],
- ac_cv_mysqlpp_devel=yes,
- AC_MSG_ERROR(no))
-])]) dnl End MYSQLPP_DEVEL
-
DELETED config/mysql_loc.m4
Index: config/mysql_loc.m4
==================================================================
--- config/mysql_loc.m4
+++ /dev/null
@@ -1,112 +0,0 @@
-dnl @synopsis MYSQL_API_LOCATION
-dnl
-dnl This macro tries to find MySQL C API header and library locations.
-dnl
-dnl We define the following configure script flags:
-dnl
-dnl --with-mysql: Give prefix for both library and headers, and try
-dnl to guess subdirectory names for each. (e.g. Tack /lib and
-dnl /include onto given dir name, and other common schemes.)
-dnl --with-mysql-lib: Similar to --with-mysql, but for library only.
-dnl --with-mysql-include: Similar to --with-mysql, but for headers
-dnl only.
-dnl
-dnl @version 1.2, 2007/02/20
-dnl @author Warren Young
-AC_DEFUN([MYSQL_API_LOCATION],
-[
- #
- # Set up configure script macros
- #
- AC_ARG_WITH(mysql,
- [ --with-mysql= root directory path of MySQL installation],
- [MYSQL_lib_check="$with_mysql/lib/mysql $with_mysql/lib"
- MYSQL_inc_check="$with_mysql/include $with_mysql/include/mysql"],
- [MYSQL_lib_check="/usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64/mysql /usr/lib/mysql /usr/local/lib64 /usr/local/lib /usr/local/lib/mysql /usr/local/mysql/lib /usr/local/mysql/lib/mysql /opt/mysql/lib /opt/mysql/lib/mysql"
- MYSQL_inc_check="/usr/include/mysql /usr/local/include/mysql /usr/local/mysql/include/mysql /opt/mysql/include/mysql"])
- AC_ARG_WITH(mysql-lib,
- [ --with-mysql-lib= directory path of MySQL library installation],
- [MYSQL_lib_check="$with_mysql_lib $with_mysql_lib/lib64 $with_mysql_lib/lib $with_mysql_lib/lib64/mysql $with_mysql_lib/lib/mysql"])
- AC_ARG_WITH(mysql-include,
- [ --with-mysql-include= directory path of MySQL header installation],
- [MYSQL_inc_check="$with_mysql_include $with_mysql_include/include $with_mysql_include/include/mysql"])
-
- #
- # Decide which C API library to use, based on thread support
- #
- if test "x$acx_pthread_ok" = xyes
- then
- MYSQL_C_LIB=mysqlclient_r
- else
- MYSQL_C_LIB=mysqlclient
- fi
-
- #
- # Look for MySQL C API library
- #
- AC_MSG_CHECKING([for MySQL library directory])
- MYSQL_libdir=
- for m in $MYSQL_lib_check
- do
- if test -d "$m" && \
- (test -f "$m/lib$MYSQL_C_LIB.so" || test -f "$m/lib$MYSQL_C_LIB.a")
- then
- MYSQL_libdir=$m
- break
- fi
- done
-
- if test -z "$MYSQL_libdir"
- then
- AC_MSG_ERROR([Didn't find $MYSQL_C_LIB library in '$MYSQL_lib_check'])
- fi
-
- case "$MYSQL_libdir" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL library directory ($MYSQL_libdir) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([$MYSQL_libdir])
-
- case "$MYSQL_libdir" in
- /usr/lib) ;;
- *) LDFLAGS="$LDFLAGS -L${MYSQL_libdir}" ;;
- esac
-
-
- #
- # Look for MySQL C API headers
- #
- AC_MSG_CHECKING([for MySQL include directory])
- MYSQL_incdir=
- for m in $MYSQL_inc_check
- do
- if test -d "$m" && test -f "$m/mysql.h"
- then
- MYSQL_incdir=$m
- break
- fi
- done
-
- if test -z "$MYSQL_incdir"
- then
- AC_MSG_ERROR([Didn't find the MySQL include dir in '$MYSQL_inc_check'])
- fi
-
- case "$MYSQL_incdir" in
- /* ) ;;
- * ) AC_MSG_ERROR([The MySQL include directory ($MYSQL_incdir) must be an absolute path.]) ;;
- esac
-
- AC_MSG_RESULT([$MYSQL_incdir])
-
- CPPFLAGS="$CPPFLAGS -I${MYSQL_incdir}"
-
- save_LIBS=$LIBS
- LIBS="$LIBS $MYSQLPP_EXTRA_LIBS"
- AC_CHECK_LIB($MYSQL_C_LIB, mysql_store_result, [], [
- AC_MSG_ERROR([Could not find working MySQL client library!]) ])
- AC_SUBST(MYSQL_C_LIB)
- LIBS=$save_LIBS
-]) dnl MYSQL_API_LOCATION
-
DELETED config/mysql_ssl.m4
Index: config/mysql_ssl.m4
==================================================================
--- config/mysql_ssl.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-dnl @synopsis MYSQL_WITH_SSL
-dnl
-dnl This macro determines whether mysql_ssl_set() API call exists.
-dnl Requires at least MySQL 4.0.1.
-dnl
-dnl @version $Id$, $Date$
-dnl @author Ovidiu Bivolaru
-AC_DEFUN([MYSQL_WITH_SSL],
-[
- #
- # Check for mysql_ssl_set() in libmysqlclient(_r)
- #
- AC_CHECK_LIB($MYSQL_C_LIB, mysql_ssl_set, [
- AC_DEFINE(HAVE_MYSQL_SSL_SET,, Define if your MySQL library has SSL functions)
- ]) dnl AC_CHECK_LIB(mysqlclient, mysql_ssl_set)
-]) dnl MYSQL_WITH_SSL
-
DELETED config/socket_nsl.m4
Index: config/socket_nsl.m4
==================================================================
--- config/socket_nsl.m4
+++ /dev/null
@@ -1,72 +0,0 @@
-dnl @synopsis LIB_SOCKET_NSL
-dnl
-dnl This macro figures out what libraries are required on this platform
-dnl to link sockets programs.
-dnl
-dnl The common cases are not to need any extra libraries, or to need
-dnl -lsocket and -lnsl. We need to avoid linking with libnsl unless
-dnl we need it, though, since on some OSes where it isn't necessary it
-dnl will totally break networking. Unisys also includes gethostbyname()
-dnl in libsocket but needs libnsl for socket().
-dnl
-dnl @category Misc
-dnl @author Warren Young
-dnl @version 1.5, 2006-03-06
-
-AC_DEFUN([LIB_SOCKET_NSL],
-[
- save_LIBS="$LIBS"
-
- AC_MSG_CHECKING([whether -lsocket is needed])
- TRY_LSOCKET=no
- AC_TRY_LINK(
- [
- #include
- #include
- #include
- #include
- ],
- [ socket(AF_INET, SOCK_STREAM, 0); ],
- AC_MSG_RESULT(no), TRY_LSOCKET=yes)
-
- if test "x$TRY_LSOCKET" = "xyes"
- then
- LIBS="-lsocket $LIBS"
- AC_TRY_LINK(
- [
- #include
- #include
- #include
- #include
- ],
- [ socket(AF_INET, SOCK_STREAM, 0); ],
- [
- MYSQLPP_EXTRA_LIBS="-lsocket $MYSQLPP_EXTRA_LIBS"
- AC_MSG_RESULT(yes)
- ],
- AC_MSG_ERROR([failed to link using -lsocket!]))
- fi
-
- AC_MSG_CHECKING([whether -lnsl is needed])
- TRY_LNSL=no
- AC_TRY_LINK(
- [ #include ],
- [ gethostbyname("gna.org"); ],
- AC_MSG_RESULT(no), TRY_LNSL=yes)
-
- if test "x$TRY_LNSL" = "xyes"
- then
- LIBS="-lnsl $LIBS"
- AC_TRY_LINK(
- [ #include ],
- [ gethostbyname("gna.org"); ],
- [
- MYSQLPP_EXTRA_LIBS="-lnsl $MYSQLPP_EXTRA_LIBS"
- AC_MSG_RESULT(yes)
- ],
- AC_MSG_ERROR([failed to link using -lnsl!]))
- fi
-
- AC_SUBST(MYSQLPP_EXTRA_LIBS)
-])
-
DELETED config/stl_slist.m4
Index: config/stl_slist.m4
==================================================================
--- config/stl_slist.m4
+++ /dev/null
@@ -1,55 +0,0 @@
-dnl @synopsis STL_SLIST_EXTENSION
-dnl
-dnl This macro determines whether the local STL implementation includes
-dnl a singly-linked list template, slist, and if so, where it is.
-dnl
-dnl @version 1.2, 2005/07/22
-dnl @author Warren Young
-AC_DEFUN([STL_SLIST_EXTENSION],
-[
- AC_MSG_CHECKING([for STL slist extension])
-
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [#include ],
- [slist l])],
- AC_DEFINE(HAVE_GLOBAL_SLIST, 1,
- [ Define if you have ::slist container in ]),
- TRY_NEXT=yes)
-
- if test -z "$TRY_NEXT"
- then
- SLIST_LOC=", global scope"
- else
- TRY_NEXT=""
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [#include ],
- [std::slist l])],
- AC_DEFINE(HAVE_STD_SLIST, 1,
- [ Define if you have std::slist container in ]),
- TRY_NEXT=yes)
-
- if test -z "$TRY_NEXT"
- then
- SLIST_LOC=", namespace std"
- else
- TRY_NEXT=""
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [#include ],
- [__gnu_cxx::slist l])],
- AC_DEFINE(HAVE_EXT_SLIST, 1,
- [ Define if you have __gnu_cxx:slist container in ]),
- SLIST_LOC="not found")
-
- if test -z "$SLIST_LOC"
- then
- SLIST_LOC=", namespace __gnu_cxx"
- fi
- fi
- fi
-
- AC_MSG_RESULT([$SLIST_LOC])
-]) dnl STL_SLIST_EXTENSION
-
DELETED configure.ac
Index: configure.ac
==================================================================
--- configure.ac
+++ /dev/null
@@ -1,85 +0,0 @@
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published
-# by the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# 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
-AC_PROG_CC
-AC_PROG_CXX
-
-
-# Break package version up into major, minor and bugfix components.
-MYSQLPP_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -f1 -d.`
-AC_SUBST(MYSQLPP_VERSION_MAJOR)
-MYSQLPP_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -f2 -d.`
-AC_SUBST(MYSQLPP_VERSION_MINOR)
-MYSQLPP_VERSION_BUGFIX=`echo $PACKAGE_VERSION | cut -f3 -d.`
-AC_SUBST(MYSQLPP_VERSION_BUGFIX)
-
-
-# Include Bakefile macros
-AC_BAKEFILE([m4_include(config/autoconf_inc.m4)])
-
-
-# Check for Standard C support
-AC_HEADER_STDC
-
-
-# Figure out whether/how to handle threading support, if available.
-AC_ARG_ENABLE(thread-check,
- [ --enable-thread-check Check for threads, and use if available. ],
- [ thread_check=yes ])
-if test "x$thread_check" = "xyes"
-then
- ACX_PTHREAD
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- CC="$PTHREAD_CC"
-fi
-
-
-# Checks for libraries and local system features
-AC_CHECK_HEADERS(zlib.h, AC_CHECK_LIB(z, gzread, [],
- [ AC_MSG_ERROR([zlib is required]) ]))
-LIB_MATH
-LIB_SOCKET_NSL
-MYSQL_API_LOCATION
-MYSQL_WITH_SSL
-AX_C_LOCALTIME_R
-AC_CHECK_LIB(intl, main)
-
-
-# If this is Cygwin, add a linker flag to suppress a silly link message.
-case "${host}" in
- *cygwin*)
- LDFLAGS="$LDFLAGS -Wl,--enable-auto-import"
- ;;
-esac
-
-
-# Check for Standard C++ support, and extensions. This must be near
-# the end, because the CPLUSPLUS directive makes autoconf use C++
-# compiler for all subsequent tests!
-AC_LANG_CPLUSPLUS
-STL_SLIST_EXTENSION
-
-
-#
-# Configure process complete; write out files generated from *.in.
-#
-AC_OUTPUT([Makefile mysql++.spec lib/Doxyfile lib/mysql++.h])
-
ADDED configure.in
Index: configure.in
==================================================================
--- /dev/null
+++ configure.in
@@ -0,0 +1,116 @@
+dnl Process this file with autoconf to produce a configure script.
+# require autoconf 2.13
+AC_PREREQ(2.13)
+
+AC_INIT(sqlplusint/sqlplus.hh)
+
+dnl Much of this was copied from glib's configure.in
+
+dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
+dnl are available for $ac_help expansion (don't we all *love* autoconf?)
+AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+#
+# Making releases:
+# SQLPLUS_MICRO_VERSION += 1;
+# SQLPLUS_INTERFACE_AGE += 1;
+# SQLPLUS_BINARY_AGE += 1;
+# if any functions have been added, set SQLPLUS_INTERFACE_AGE to 0.
+# if backwards compatibility has been broken,
+# set SQLPLUS_BINARY_AGE _and_ SQLPLUS_INTERFACE_AGE to 0.
+#
+
+SQLPLUS_MAJOR_VERSION=1
+SQLPLUS_MINOR_VERSION=5
+SQLPLUS_MICRO_VERSION=0
+SQLPLUS_INTERFACE_AGE=0
+SQLPLUS_BINARY_AGE=0
+
+SQLPLUS_VERSION=$SQLPLUS_MAJOR_VERSION.$SQLPLUS_MINOR_VERSION.$SQLPLUS_MICRO_VERSION
+dnl
+AC_DIVERT_POP()dnl
+
+VERSION=$SQLPLUS_VERSION
+
+AC_SUBST(SQLPLUS_MAJOR_VERSION)
+AC_SUBST(SQLPLUS_MINOR_VERSION)
+AC_SUBST(SQLPLUS_MICRO_VERSION)
+AC_SUBST(SQLPLUS_INTERFACE_AGE)
+AC_SUBST(SQLPLUS_BINARY_AGE)
+
+# libtool versioning
+LT_RELEASE=$SQLPLUS_MAJOR_VERSION.$SQLPLUS_MINOR_VERSION
+LT_CURRENT=`expr $SQLPLUS_MICRO_VERSION - $SQLPLUS_INTERFACE_AGE`
+LT_REVISION=$SQLPLUS_INTERFACE_AGE
+LT_AGE=`expr $SQLPLUS_BINARY_AGE - $SQLPLUS_INTERFACE_AGE`
+AC_SUBST(LT_RELEASE)
+AC_SUBST(LT_CURRENT)
+AC_SUBST(LT_REVISION)
+AC_SUBST(LT_AGE)
+
+dnl Initialize automake
+AM_INIT_AUTOMAKE(sqlplus, $VERSION)
+
+dnl Set definition here
+AM_CONFIG_HEADER(config.h)
+
+dnl Initialize libtool
+AM_PROG_LIBTOOL
+
+dnl Initialize maintainer mode
+AM_MAINTAINER_MODE
+
+dnl This is a little hack to make this work with rpm better (see sqlplus.spec.in)
+test -z "$CXXFLAGS" && CXXFLAGS="${CFLAGS}"
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CXXCPP
+
+dnl Copied from lf_texidoc.m4 in share/aclocal
+AC_PATH_PROGS(PERL, perl perl5, nope)
+if test "$PERL" = nope
+then
+ AC_MSG_WARN([missing perl. Need perl to build documentation and some headers which should have been included in the distribution.])
+fi
+
+
+AC_PROG_LN_S
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+dnl These will be set in config.h
+AC_DEFINE_UNQUOTED(SQLPLUS_MAJOR_VERSION, $SQLPLUS_MAJOR_VERSION)
+AC_DEFINE_UNQUOTED(SQLPLUS_MINOR_VERSION, $SQLPLUS_MINOR_VERSION)
+AC_DEFINE_UNQUOTED(SQLPLUS_MICRO_VERSION, $SQLPLUS_MICRO_VERSION)
+AC_DEFINE_UNQUOTED(SQLPLUS_INTERFACE_AGE, $SQLPLUS_INTERFACE_AGE)
+AC_DEFINE_UNQUOTED(SQLPLUS_BINARY_AGE, $SQLPLUS_BINARY_AGE)
+
+AC_CHECK_LIB(intl, main)
+AC_CHECK_LIB(socket, main)
+AC_CHECK_LIB(nsl, main)
+
+dnl #########################################################################
+dnl Check for MySQL headers and libraries
+dnl #########################################################################
+AC_PACKAGE_MYSQL
+
+AM_WITH_DMALLOC()
+
+dnl Checks for header files.
+AC_HEADER_STDC
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strtol)
+
+AC_OUTPUT([
+Makefile
+sqlplusint/Makefile
+examples/Makefile
+doc/Makefile
+sqlplus-config
+sqlplus.spec
+])
ADDED doc/Makefile.am
Index: doc/Makefile.am
==================================================================
--- /dev/null
+++ doc/Makefile.am
@@ -0,0 +1,40 @@
+# This file should cause the manual to be a generated source (i.e., so
+# that it is build at distribution time since its creation is
+# non-standard)
+
+# This file still needs a lot of work...
+
+# SUBDIRS = man-html man-text
+
+EXTRA_DIST = \
+ doc.tex.tmpl html.sty manual.aux manual.dvi manual.log manual.lyx \
+ manual.ps manual.tex pretty.pl sql++pretty doc-fix.pl doc-trim.pl \
+ examples-proc.pl html2txt.pl insert-classref.pl
+
+default: manual
+
+perlclean:
+ -rm -f manual.txt manual.html
+ $(MAKE) -C ../sqlplusint/ perlclean
+
+manual:
+ $(MAKE) -C ../sqlplusint/ classref
+ perl insert-classref.pl
+ -rm -f -r man-html
+ -mkdir man-html
+ perl examples-proc.pl
+ latex manual.tex
+ latex manual.tex
+ latex2html \
+ -split 3 \
+ -toc_depth 3 \
+ -dir man-html \
+ -long_titles 2 \
+ -local_icons \
+ -show_section_numbers \
+ manual.tex
+
+ -rm -f -r man-text
+ -mkdir man-text
+ perl html2txt.pl
+
DELETED doc/README.devel
Index: doc/README.devel
==================================================================
--- doc/README.devel
+++ /dev/null
@@ -1,11 +0,0 @@
-This file comes with the mysql++-devel RPM. This RPM installs the
-files you need when building your own MySQL++ based programs, as well as
-documentation and examples that can help you learn how to use the library.
-The documentation is pretty badly out of date at the moment. See the
-example programs for the "official" word on how to use this library.
-
-This RPM installs the MySQL++ header files in /usr/include/mysql++,
-the MySQL++ library in /usr/lib, and a set of example programs in
-/usr/src/mysql++/examples. For more information on the examples, see
-the README.examples file in this directory.
-
DELETED doc/README.manuals
Index: doc/README.manuals
==================================================================
--- doc/README.manuals
+++ /dev/null
@@ -1,5 +0,0 @@
-For more information about MySQL++, see its home page:
-
- http://tangentsoft.net/mysql++/
-
-See the LICENSE file in this directory for the library's license.
ADDED doc/doc-fix.pl
Index: doc/doc-fix.pl
==================================================================
--- /dev/null
+++ doc/doc-fix.pl
@@ -0,0 +1,22 @@
+$/ = undef;
+
+open F, $ARGV[0];
+
+$_=;
+
+s~\\begin_inset LatexCommand \\ref.+
+\\end_inset
+(.+)
+\\begin_inset LatexDel .+
+\\end_inset
+.+
+\\begin_inset LatexDel .+
+\\end_inset
+~\\begin_inset LatexCommand \\ref\{$1\}
+
+\\end_inset
+~g;
+
+open F, ">$ARGV[0]";
+print F $_;
+
ADDED doc/doc-trim.pl
Index: doc/doc-trim.pl
==================================================================
--- /dev/null
+++ doc/doc-trim.pl
@@ -0,0 +1,11 @@
+$/ = undef;
+
+open F, $ARGV[0];
+
+$_=;
+
+/(\\layout Section.+)\\the_end/s;
+
+open F, ">$ARGV[0]";
+print F $1;
+
ADDED doc/doc.tex.tmpl
Index: doc/doc.tex.tmpl
==================================================================
--- /dev/null
+++ doc/doc.tex.tmpl
@@ -0,0 +1,193 @@
+#ptags [ ]
+[!autolink]
+
+[foreach class]
+\section{[class]}
+\label{[filter ref][class dont_filter][endfilter]}
+
+[if templ]template [endif] \
+[if struct]struct[endif][else][if union]union[endif][else]class[endelse][endelse] \
+\textbf{[class]}[templ]
+
+[if parents]\textbf{Parents:} [parents][endif]
+
+[if with_class][if with_class != [class]]
+ \textbf{Related to:} [with_class] \
+ (\ref{[filter ref][with_class dont_filter][endfilter]})
+[endif][endif]
+
+[if brief]\textit{[brief]}[endif]
+
+[detail]
+
+\subsection{Synopses}
+
+[if public]
+\textbf{Public members:}
+\begin{itemize}
+[foreach public]
+\item [if pure]pure [endif][type] \textbf{[mname]} \
+ [if func] \
+ ([args]) [if const] const [endif] \
+ [if throws] throws [throwclass]([throwargs])[endif] \
+ [endif] \
+ [if enum] [lb][args][rb] [endif] \
+ [if detail] (\ref{[filter ref][class dont_filter]::[member dont_filter][endfilter]}) [endif] \
+ [if brief] - \textit{[brief]}[endif] \
+[next]
+
+\end{itemize}
+[endif]
+
+[if protected]
+\textbf{Protected members:}
+\begin{itemize}
+
+[foreach protected]
+\item [if pure]pure [endif][type] \textbf{[mname]} \
+ [if func] \
+ ([args]) [if const] const [endif] \
+ [if throws] throws [throwclass]([throwargs])[endif] \
+ [endif] \
+ [if enum] [lb][args][rb] [endif] \
+ [if detail] (\ref{[filter ref][class dont_filter]::[member dont_filter][endfilter]}) [endif] \
+ [if brief] - \textit{[brief]}[endif] \
+[next]
+
+\end{itemize}
+[endif]
+
+[nobreak]
+[foreach func]
+[if with_class == [class]]
+[if !l1][def l1]
+ \textbf{Related Functions} [n]
+ [n]
+ \begin{itemize} [n]
+[endif]
+\item [type] \textbf{[name]} ([args])
+ [if throws] throws [throwclass]([throwargs]) [endif]
+ [if brief] - \textit{[brief]}[endif] [n]
+[endif]
+[next]
+[if l1] [undef l1]
+ \end{itemize} [n]
+[endif]
+[endnobreak]
+
+[nobreak]
+[foreach typedef]
+[if with_class == [class]]
+ [if !l1] [def l1]
+ \textbf{Related Types} [n]
+ [n]
+ \begin{itemize} [n]
+ [endif]
+\item [if typedef]typedef [endif][if enum]enum [endif][type] \textbf{[name]}
+ [if enum] [lb][args][rb] [endif]
+ [if brief] - \textit{[brief]}[endif] [n]
+[endif]
+[next]
+[if l1] [undef l1]
+ \end{itemize} [n]
+[endif]
+[endnobreak]
+
+[nobreak]
+[def pclass [class]]
+[foreach class]
+[if with_class == [pclass]] [if with_class != [class]]
+[if !l1] [def l1]
+ \textbf{Related Classes} [n]
+ [n]
+ \begin{itemize} [n]
+[endif]
+\item [if templ]template [endif]
+ [if struct]struct[endif][else][if union]union[endif][else]class[endelse][endelse]
+ \textbf{[class]}[templ]
+ (\ref{[filter ref][class dont_escape][endfilter]})
+ [if brief] - \textit{[brief]} [endif] [n]
+[endif] [endif]
+[next]
+[if l1] [undef l1]
+ \end{itemize} [n]
+[endif]
+[undef pclass]
+[endnobreak]
+
+[foreach public]
+[if detail]
+\subsection{[member]}
+\label{[filter ref][class dont_filter]::[member dont_filter][endfilter]}
+
+ [if pure]pure [endif][type] \textbf{[mname]} \
+ [if func] \
+ ([args]) [if const] const [endif] \
+ [if throws] throws [throwclass]([throwargs])[endif] \
+ [endif] \
+ [if enum] [lb][args][rb] [endif]
+
+[if brief]\textit{[brief]}[endif]
+
+[detail]
+
+[endif]
+
+[next]
+
+[foreach func][if with_class == [class]][// ][if detail]
+\subsection{[name]}
+
+[type] \textbf{[name]} ([args]) \
+ [if throws] throws [throwclass]([throwargs]) [endif]
+
+[if brief]\textit{[brief]}[endif]
+
+[detail]
+
+[endif][endif][next]
+
+[next]
+
+
+\section{Misc Non Members}
+
+[foreach func][if !with_class]
+[if !f1] [def f1]
+ \textbf{Functions:}
+ \begin{itemize}
+[endif]
+\item [type] \textbf{[name]} ([args]) \
+ [if throws] throws [throwclass]([throwargs]) [endif] \
+ [if brief] - \textit{[brief]}[endif]
+[endif][next]
+[if f1] [undef f1]
+\end{itemize}
+[endif]
+
+[foreach typedef][if !with_class]
+[if !tl] [def tl]
+ \textbf{Types:}
+ \begin{itemize}
+[endif]
+\item [if typedef]typedef [endif][if enum]enum [endif][type] \textbf{[name]}
+ [if enum] [lb][args][rb] [endif]
+ [if brief] - \textit{[brief]}[endif]
+[endif][next]
+[if tl] [undef tl]
+\end{itemize}
+[endif]
+
+[foreach func]
+[if detail][if !with_class]
+\subsection{[name]}
+
+[type] \textbf{[name]} ([args]) \
+ [if throws] throws [throwclass]([throwargs]) [endif]
+
+[if brief]\textit{[brief]}[endif]
+
+[detail]
+
+[endif][endif]
+[next]
ADDED doc/examples-proc.pl
Index: doc/examples-proc.pl
==================================================================
--- /dev/null
+++ doc/examples-proc.pl
@@ -0,0 +1,20 @@
+
+$/ = undef;
+open IN, "manual.tex";
+$_ = ;
+
+s/\\begin\{comment\}[\n\s]+example:(\S+)[\n\s]*\\end\{comment\}[\n\s]*/${\(&ie($1))}/sg;
+
+open IN, ">manual.tex";
+print IN;
+
+sub ie {
+ my $return;
+ $return = "\n";
+ $return .= "\\begin{verbatim}\n";
+ open EIN, "examples/$_[0]";
+ local $/ = undef;
+ $return .= ;
+ $return .= "\\end{verbatim}\n\n";
+ return $return;
+}
ADDED doc/html2txt.pl
Index: doc/html2txt.pl
==================================================================
--- /dev/null
+++ doc/html2txt.pl
@@ -0,0 +1,7 @@
+opendir DIR, "man-html";
+
+foreach (readdir(DIR)) {
+ next unless /(.+?)\.html$/;
+ print "lynx -dump man-html/$_ > man-text/$1.txt\n" ;
+ system "lynx -dump man-html/$_ > man-text/$1.txt" ;
+}
ADDED doc/insert-classref.pl
Index: doc/insert-classref.pl
==================================================================
--- /dev/null
+++ doc/insert-classref.pl
@@ -0,0 +1,22 @@
+$/ = undef;
+
+open F, "manual.tex";
+open CR, "../sqlplusint/doc.tex";
+
+$_=;
+$classref=;
+
+s~\\begin{comment}[\s\n]*Begin Class Ref[\s\n]*\\end{comment}.+?\\begin{comment}[\s\n]*End Class Ref[\s\n]*\\end{comment}~
+\\begin{comment}
+Begin Class Ref
+\\end{comment}
+$classref
+\\begin{comment}
+End Class Ref
+\\end{comment}
+~s || die "Could not insert classref\n";
+
+open F, ">manual.tex";
+print F $_;
+
+
ADDED doc/manual.lyx
Index: doc/manual.lyx
==================================================================
--- /dev/null
+++ doc/manual.lyx
@@ -0,0 +1,13238 @@
+#This file was created by Thu Dec 2 15:59:50 1999
+#LyX 0.12 (C) 1995-1998 Matthias Ettrich and the LyX Team
+\lyxformat 2.15
+\textclass book
+\begin_preamble
+\usepackage{html}
+
+\begin{htmlonly}
+
+\renewenvironment{lyxcode}
+ {\begin{list}{}{
+ \setlength{\rightmargin}{\leftmargin}
+ \raggedright
+ \setlength{\itemsep}{0pt}
+ \setlength{\parsep}{0pt}
+ \ttfamily}%
+ \item[]
+ \begin{ttfamily}}
+ {\end{ttfamily}
+ \end{list} }
+
+\newenvironment{LyXParagraphIndent}[1]%
+{\begin{quote}}
+{\end{quote}}
+
+\end{htmlonly}
+\end_preamble
+\language default
+\inputencoding default
+\fontscheme default
+\graphics default
+\float_placement h
+\paperfontsize 11
+\spacing single
+\papersize Default
+\paperpackage a4
+\use_geometry 1
+\use_amsmath 0
+\paperorientation portrait
+\leftmargin 1in
+\rightmargin 1in
+\secnumdepth 2
+\tocdepth 2
+\paragraph_separation skip
+\defskip medskip
+\quotes_language english
+\quotes_times 2
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+
+\layout Title
+
+Mysql++
+\newline
+A C++ API for Mysql
+\newline
+ver 1.5
+\layout Author
+
+Kevin Atkinson
+\newline
+(kevinatk@home.com)
+\newline
+ Sinisa Milivojevic
+\newline
+(sinisa@cytanet.com.cy)
+\newline
+Michael Widenius
+\newline
+(monty@mysql.com)
+\layout Standard
+
+
+\begin_inset LatexCommand \tableofcontents
+
+\end_inset
+
+
+\layout Part*
+
+Introductory Material
+\layout Chapter
+
+Introduction
+\layout Section
+
+What is Mysql++
+\layout Standard
+
+Mysql++ is a complex C++ API for Mysql (And other SQL Databases Soon).
+ The goal of this API is too make working with Queries as easy as working
+ with other STL Containers.
+ See the Overview chapter (
+\begin_inset LatexCommand \ref{Overview}
+
+\end_inset
+
+) for the components that make up Mysql++.
+\layout Section
+
+Getting Mysql++
+\layout Standard
+
+The latest version of Mysql++ can be found at the mysql++ web site at http://www.
+mysql.com/download_mysql++.html
+\layout Section
+
+Mysql++ Mailing List
+\layout Standard
+
+Instructions for joining the mailing list (and an archive of the mailing
+ list) can be found off the Mysql++ home page at http://www.mysql.com/download_mys
+ql++.html.
+ If you just wish to ask questions, you can mail to mysql-plusplus@lists.mysql.com.
+\layout Chapter
+
+Overview
+\layout Standard
+
+
+\begin_inset LatexCommand \label{Overview}
+
+\end_inset
+
+The Mysql++ API has developed into a very complex and powerful being.
+ With many different ways to accomplish the same task.
+ Unfortunately this means that figuring out how to perform a simple task
+ can be frustrating for new users of my library.
+ In this section I will attempt to provide an overview of the many different
+ components of the library.
+\layout Standard
+
+Like working with most other SQL API the process for executing queries is
+ the same.
+ 1) You open the connection, 2) You form and execute the queries, 3) You
+ iterate through the result set.
+ It not much different in my C++ API.
+ However there is a lot of extra functionality along each step of the way.
+\layout Section*
+
+The Main Database Handle
+\layout Standard
+
+This is a class that handles the connection to the Mysql server.
+ You always need at least one of these objects to do anything.
+ It can either create a separate queries object or directly execute queries.
+ The separate query object is the recommended way as it gives you far more
+ power.
+\layout Section*
+
+The Query Object
+\layout Standard
+
+This object is the recommended way of executing queries.
+ It is subclassed from strstream which means you can write to it like any
+ other stream to aid in the formation of queries.
+\layout Standard
+
+You can also set up Template queries with this class.
+ Template queries are a way of setting up queries with replaceable parameters
+ that you can change throughout your program.
+\layout Standard
+
+You can also use specialized structures and even the dramatic result sets
+ to aid in creating queries however more on that latter.
+\layout Standard
+
+The Query object returns an object with information about the success of
+ a query for non-select queries (queries that don't return a result set).
+\layout Section*
+
+The Result Sets
+\layout Standard
+
+For queries that return a result set you have essentially two different
+ ways of handling the results: in a dramatic result set, or in a static
+ one.
+\layout Subsection*
+
+The Dramatic Result Set
+\layout Standard
+
+The Dramatic Result set is a result set in which the names of the columns
+ and the type of information of the columns does not need to be determined
+ at compile time.
+ The result set can be completely constant in which the data is returned
+ to you in a constant string link class, semi-constant in which you can
+ modify the data one row at a time, or a truly mutable in which in you can
+ modify the data in any way you like.
+\layout Standard
+
+The constant result set is a result set that is closely bound to the result
+ set in the C API and is the one that provides the most functionality.
+ With this result set you can find out detailed information about the type
+ of information stored in each of the columns.
+ This is also the fastest because the data does not need to be copied at
+ all.
+\layout Standard
+
+The semi-constant result set is like the constant result set except you
+ can modify the data one row at a time.
+ The data you modify is actually a copy of the data returned by the server.
+ This means that modifying the data does not change the actual result set
+ at all.
+\layout Standard
+
+The semi-constant result set is actually the same thing as the constant
+ result set.
+ The only difference is that when you request a row from the result set
+ you specifically declare the row as a mutable one.
+ This means that you can get some rows back as constant rows and others
+ as mutable ones.
+\layout Standard
+
+The truly mutable result set is a result set similar to the constant one
+ except that the data is truly mutable in the sense that you can change
+ the data in the actual result set.
+ However unlike the first one this result set is not bound to the C API
+ result set.
+ Instead it containers a copy of the data returned by the C API in a two-dimensi
+onal vector.
+ Because of this the detailed information about each of the columns is not
+ currently available, only the column names and the C++ type that most closely
+ matches the original SQL type.
+ Also, because it makes a copy of the data returned from the C API, there
+ is a little bit of performance penalty to using this one.
+\layout Standard
+
+The rows in all the dramatic result sets are very close to an Standard Template
+ Library (STL) random access container.
+ This means that they have an iterator which can be used for STL algorithms.
+ There is even couple of specialized utility function to aid in the use
+ of the result sets in STL algorithms.
+\layout Standard
+
+The columns in all the dramatic result are also very close to an STL random
+ access container.
+ However, in addition to accessing the columns by there index number you
+ can also access the columns via there field names.
+\layout Standard
+
+In addition, because both the rows and the columns are STL like containers,
+ you can also treat the result set as a two- dimensional array.
+ For example you can get the 5th item on the 2nd row by simply saying result[2][
+5].
+ Because you can also use the field names you can substitute the column
+ number by a field name and say result[2]["price"] to get "price" of the
+ item on the 2nd row, for example.
+\layout Standard
+
+The actual data that all the dramatic result sets return is stored in a
+ special string like class that has some additional magic too it.
+ The magic is that the column data will automatically convert itself into
+ all of the basic data types as well as some additional types types that
+ are designed to handle mysql types which includes types for handling dates,
+ times, sets, and types with a null value.
+ If there is a problem in the conversion it will either set a warning flag
+ or throw an exception depending on how it is configured.
+\layout Standard
+
+The drastic result sets can even be used to help form queries with the help
+ of some additional method.
+ There is a method for returns: 1) A comma separated list of the data (for
+ example: 1.5, 10, "Dog, "Brown"), 2) A comma separated list of the field
+ names (for example: age, weight, what, color), and 3) An equal list (for
+ example: age = 1.5 AND weight = 10 AND what = "Dog" AND color = "Brown").
+\layout Standard
+
+Mutable result sets can be created with out an actual query so that you
+ can take advantage of these methods to aid in inserting data into the database
+ with out having to first create an unnecessary query.
+\layout Subsection*
+
+The Static Result Sets
+\layout Standard
+
+The results from an query can also be stored statically in what I call a
+ specialized SQL structure.
+ These structures are then stored in some STL container such a vector or
+ list, or even a set or multi-set as the the specialized structures can
+ also be made less-than-comparable.
+ Unlike the dramatic result sets it is assumed that the programmer knows
+ what the result set is going to look like.
+ Because of this all the information about the columns, including the names,
+ are lost.
+\layout Standard
+
+These Specialized Structures are exactly that C++ `structs'.
+ Each member item is stored with a unique name within the structure.
+ You can in no way use STL algorithms or anything else STL to work with
+ the individual elements of the structures.
+ However naturally because these structures are then stored in STL containers
+ you can use STL algorithms on the containers of these structures.
+ The containers represent the rows, and the individual elements of the structure
+ represent the columns.
+ For example you can access the item named "price" on the second row by
+ saying result[2].price.
+ With the dramatic result set you would have probably needed to say result[2]["p
+rice"] to accomplish the same result.
+\layout Standard
+
+If there is a problem in converting from the result set returned by the
+ server to the specialized structures an exception is thrown.
+\layout Standard
+
+To aid in the creating of queries using these specialized structures, the
+ same query aiding methods are available to use that are available for the
+ dramatic result sets.
+ This includes methods for returning a comma separated list of the data,
+ a comma separated list of the field names, and an equal list.
+\layout Section*
+
+In addition
+\layout Standard
+
+In addition to the material mentioned there are also many generic classes
+ that can be used with other programs.
+ Examples of this include a special const string class, a const random access
+ adapter that will make a random access container out of a class with nothing
+ but the size() method and the subscript ([]) operator defined and a generic
+ SQL query class that can be used any SQL C or C++ API.
+\layout Chapter
+
+Important Changes
+\layout Standard
+
+I will try to keep the changes that will break old code to a minimal however
+ when I do I will document them here.
+ Once this library goes into alpha testing this section will no longer exist
+ as I will try very hard not to make changes that will break old code.
+\layout Section
+
+Current Changes
+\layout Itemize
+
+Changed the syntax of equal_list for SSQLS from
+\series bold
+equal_list (cchar *, Manip, cchar *)
+\series default
+ to
+\series bold
+equal_list (cchar *, cchar *, Manip)
+\series default
+.
+\layout Itemize
+
+Mysql++ now runs with egcs.
+ But
+\noun on
+beware !,
+\noun toggle
+ do not yet use -O6 -mpentium options are still unsafe for g++, with a heavy
+ use of constant and static initializers, and especially with C++ exceptions
+ .
+ Also, please try to keep all objects as local as possible.
+ Declare it in the lowest blocks always !!
+\layout Itemize
+
+MySQL++ now runs with gcc 2.95.1 and 2.
+ Keeping objects local is no more necessary.
+\layout Itemize
+
+The
+\begin_inset Quotes eld
+\end_inset
+
+connection
+\begin_inset Quotes erd
+\end_inset
+
+ constructors for
+\series bold
+Connection
+\series default
+ and
+\series bold
+Connection::connect
+\series default
+ (formally known as
+\series bold
+Mysql
+\series default
+) has changed so that the data base name is the first paremeter.
+ The same is valid for connect method.
+\layout Itemize
+
+All new client feature implemented in 3.22.xx as various options on connect
+ are mplemented in a new constructor and real_connect method
+\layout Itemize
+
+Also new configuration constructs in 3.23.xx are strictly followed
+\layout Itemize
+
+Mysql++ now can be compiled on Win32 with use of Cygwin compiler from Cygnus
+ Inc.
+\layout Itemize
+
+Autoconf and Automake are fully implemented
+\layout Itemize
+
+The Specialized SQL Structures (formally known as Custom Mysql Structures)
+ changed from mysql_ to sql_.
+\layout Itemize
+
+Changed all of the functions that return zero (false) on success and non-zero
+ (true) other wise to bool.
+ This means that they now return true on success and false on faillier.
+ This means that you now need to negate your expressions that test the output
+ of these functions.
+
+\layout Itemize
+
+Almost all methods that returned MysqlString now return a normal string.
+ Because
+\series bold
+MysqlString
+\series default
+ objects will convert them selves into string when needed there should not
+ be a problem with:
+\begin_deeper
+\layout LyX-Code
+
+MysqlString s = mysql.host_info
+\end_deeper
+\layout Itemize
+
+The data type
+\series bold
+MysqlRow
+\series default
+ now returns (
+\series bold
+MysqlString
+\series default
+ or
+\series bold
+MysqlColData
+\series default
+) is now subclassed from a special string class that I wrote to handle working
+ with a const string in a much more efficient way (ie it doesn't copy it).
+ Unfortunitlly this data type is also more limited see the section on "const_str
+ing" for more info.
+\layout Itemize
+
+All necessary methods pertaining to the administration funcitons have been
+ added
+\layout Section
+
+Future Changes
+\layout Itemize
+
+The behavior of MysqlString when used with binary operators is going to
+ change in a future version (if I can figure out how to pull it off) Instead
+ of converting to the type on the other side of the operator the MysqlString
+ will it convert to the type the Mysql server said it originally was.
+ This will be a lot safer and more predictable.
+\layout Part*
+
+Usage
+\layout Chapter
+
+Tutorial by Example
+\layout Section
+
+Introduction
+\layout Standard
+
+This tutorial is meant to give you a jump start into using my API.
+ My Mysql++ API is a very complicated being with a lot of advance features
+ that you can due without if all you want to do is execute simple queries.
+\layout Section
+
+Assumptions
+\layout Standard
+
+This tutorial assumes you know C++ fairly well, inparticuler it assumes
+ you know about the Standard Template Library (STL) and exceptions.
+\layout Section
+
+Running the Examples
+\layout Standard
+
+All of the example code form complete running programs.
+ However in order to use them you need to first compile them my switching
+ to the examples directory and typing in
+\family typewriter
+make
+\family default
+.
+ Then you need to set up the database by running reset-db.
+ The usage of the reset-db program is as follows.
+\layout LyX-Code
+
+reset-db [host [user [password]]]
+\layout Standard
+
+If you leave off host localhost is assumed.
+ If you leave off user your current username is assumed.
+ If you leave of the password it is assumed that you don't need one.
+\layout Standard
+
+When you first run the program you need to give it an account with permission
+ to create databases.
+ Once the database is created you can use any account that has permission
+ full permission to the database mysql_cpp_data.
+
+\layout Standard
+
+You should also run the reset-db program between examples that modify the
+ data or else things might not work right.
+\layout Section
+
+The Basics
+\layout Subsection
+
+A Simple Example
+\layout Standard
+
+The following example demonstrates how to open a connection, execute a simple
+ query, and display the results.
+ The code can be found in the file
+\family typewriter
+simple1.cc
+\family default
+ which is located in the examples directory.
+\layout Comment
+
+example:simple1.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ Connection con("mysql_cpp_data");
+\newline
+
+\protected_separator
+ // The full format for the Connection constructor is
+\newline
+
+\protected_separator
+ // Connection(cchar *db, cchar *host="",
+\newline
+
+\protected_separator
+ //
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cchar *user="", cchar *passwd="")
+\newline
+
+\protected_separator
+ // You may need to specify some of them if the database is not on
+\newline
+
+\protected_separator
+ // the local machine or you database username is not the same as your
+\newline
+
+\protected_separator
+ // login name, etc..
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+ // This creates a query object that is bound to con.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ query << "select * from stock";
+\newline
+
+\protected_separator
+ // You can write to the query object like you would any other ostrem
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ Result res = query.store();
+\newline
+
+\protected_separator
+ // Query::store() executes the query and returns the results
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ cout << "Query: " << query.preview() << endl;
+\newline
+
+\protected_separator
+ // Query::preview() simply returns a string with the current query
+\newline
+
+\protected_separator
+ // string in it.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ cout << "Records Found: " << res.size() << endl << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ Row row;
+\newline
+
+\protected_separator
+ cout.setf(ios::left);
+\newline
+
+\protected_separator
+ cout << setw(17) << "Item"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(4)
+\protected_separator
+ << "Num"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << "Weight"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << "Price"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "Date" << endl
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ Result::iterator i;
+\newline
+
+\protected_separator
+ // The Result class has a read-only Random Access Iterator
+\newline
+
+\protected_separator
+ for (i = res.begin(); i != res.end(); i++) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row = *i;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw(17) << row[0]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(4)
+\protected_separator
+ << row[1]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << row["weight"]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // you can use either the index number or column name when
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // retrieving the colume data as demonstrated above.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << row[3]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << row[4] << endl;
+\newline
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+ return 0;
+\newline
+}
+\layout Standard
+
+Everything here should be fairly obvious.
+ Take particular notice of how I used an iterator with the result set.
+\layout Subsection
+
+A slightly more complicated example
+\layout Standard
+
+This example is almost like the previous one however it uses exceptions
+ and the automatic conversion feature of
+\series bold
+ColData
+\series default
+.
+ Pay particular notice to how exceptions are used.
+ This file for this code is named
+\family typewriter
+complic1.cc
+\family default
+.
+\layout Comment
+
+example:complic1.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ try { // its in one big try block
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con(use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Here I broke making the connection into two calls.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // The first one creates the Connection object with the
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // use exceptions option turned on and the second one
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // makes the connection
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "select * from stock";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Result res = query.store();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Query: " << query.preview() << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Records Found: " << res.size() << endl << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Row row;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.setf(ios::left);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw(17) << "Item"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(4)
+\protected_separator
+ << "Num"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << "Weight"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << "Price"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "Date" << endl
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Result::iterator i;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.precision(3);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ for (i = res.begin(); i != res.end(); i++) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row = *i;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw(17) << row["item"] << setw(4) << row[1]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7)
+\protected_separator
+ << (double)row[2]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// This is converting the row to a double so that we
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// can set the precision of it.
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// ColData has the nice feature that it will convert to
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// any of the basic c++ types.
+\protected_separator
+ if there is a problem
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// in the conversion it will throw an exception (which I
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// cache below).
+\protected_separator
+ To test it try changing the 2 in row[2]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// to row[0]
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(7) << (double)row[3];
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Date date = row["sdate"];
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // The ColData is implicitly converted to a date here.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.setf(ios::right);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.fill('0');
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw(2) << date.month << "-" << setw(2) << date.day << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.fill(' ');
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.unsetf(ios::right);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return 0;
+\newline
+
+\protected_separator
+ } catch (BadQuery er) { // handle any connection or
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // query errors that may come up
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ } catch (BadConversion er) { // handle bad conversions
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\layout Standard
+
+Everything should be fairly obvious.
+ A few notes about exceptions, however:
+\layout Enumerate
+
+When the
+\series bold
+use_exceptions
+\series default
+ flag is set for a parent object it is also set for all of its children
+ the it created after the flag is set.
+ For example when the
+\series bold
+use_exceptions
+\series default
+ flag is set for the
+\family typewriter
+con
+\family default
+ object, it is also set for the
+\family typewriter
+query
+\family default
+ object.
+ Please note that the
+\series bold
+use_exceptions
+\series default
+ flag is not linked, it is copied.
+ This means that when you change the
+\series bold
+use_exceptions
+\series default
+ flag only its new children are affected,
+\emph on
+not
+\emph default
+ the ones it already created.
+\layout Enumerate
+
+
+\series bold
+ColData
+\series default
+ will always throw an exception when it encounters a bad conversion.
+ A bad conversion is defined as a conversion in which: a) All the charters
+ from the string are not read in and b) The remaining characters are something
+ other than whitespace, zeros (0), or periods (.).
+ This means that when ``1.25'' is converted into an int an exception will
+ be thrown however not when ``1.00'' is converted into an int as the remaining
+ characters are the period and the zero.
+
+\layout Standard
+
+To see how the exception work try creating an error.
+ Some good things to try would be misspelling the table name or changing
+ the double to an int.
+\layout Subsection
+
+Getting Info about the Fields
+\layout Standard
+
+The following example demonstrates how to get some basic information about
+ the fields, including the name of the field and the SQL type.
+ The file is called fieldinfo1.cc.
+\layout Comment
+
+example:fieldinf1.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ try { // its in one big try block
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con(use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "select * from stock";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Result res = query.store();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Query: " << query.preview() << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Records Found: " << res.size() << endl << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Query Info:
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.setf(ios::left);
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ for (unsigned int i = 0; i < res.size(); i++) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw(2)
+\protected_separator
+ << i
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(15) << res.names(i).c_str()
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// this is the name of the field
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(15) << res.types(i).sql_name()
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// this is the SQL identifier name
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// Result::types(unsigned int) returns a mysql_type_info which in many
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// ways is like type_info except that it has additional sql type
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// information in it.
+ (with one of the methods being sql_name())
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw(20) << res.types(i).name()
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// this is the C++ identifier name which most closely resembles
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// the sql name (its is implementation defined and often not very readable)
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ if (res.types(0) == typeid(string))
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Field 'item' is of an sql type which most closely resembles a
+\backslash
+n"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "the c++ string type
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // this is demonstrating how a mysql_type_info can be compared with a c++
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // type_info.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ if (res.types(1) == typeid(short int))
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Field 'num' is of an sql type which most closely resembles a
+\backslash
+n"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "the c++ short int type
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ else if (res.types(1).base_type() == typeid(short int))
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Field 'num' base type is of an sql type which most closely
+\backslash
+n"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "resembles a the c++ short int type
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // However you have to be careful as if it can be null the actual type
+ is
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Null not TYPE.
+\protected_separator
+ So you should always use the base_type method
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // to get at the underlying type.
+\protected_separator
+ If the type is not null than this base
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // type would be the same as its type.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return 0;
+\newline
+
+\protected_separator
+ } catch (BadQuery er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ } catch (BadConversion er) { // handle bad conversions
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\newline
+
+\protected_separator
+
+\layout Section
+
+Specialized SQL Structures
+\layout Subsection
+
+Retrieving Data
+\layout Standard
+
+The next example demonstrates a fairly interesting concept known as Specialized
+ SQL Structures (SSQLS).
+ The file name for this code is
+\family typewriter
+custom1.cc
+\family default
+.
+\layout Comment
+
+example:custom1.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+sql_create_5 (stock,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// struct name,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ 1, 5,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// I'll explain these latter
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ string, item,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// type, id
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ int, num,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ double, weight,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ double, price,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Date, sdate)
+\newline
+
+\protected_separator
+
+\newline
+// this is calling a very complex macro which will create a custom
+\newline
+// struct "stock" which has the variables:
+\newline
+//
+\protected_separator
+
+\protected_separator
+ string item
+\newline
+//
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ int num
+\newline
+//
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ ...
+\newline
+//
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Date sdate
+\newline
+// defined as well methods to help populate the class from a mysql row
+\newline
+// among other things that I'll get too in a latter example
+\newline
+
+\protected_separator
+
+\newline
+int main () {
+\newline
+
+\protected_separator
+ try {
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// its in one big try block
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con (use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect ("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query ();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "select * from stock";
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ vector < stock > res;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.storein (res);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // this is storing the results into a vector of the custom struct
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // "stock" which was created my the macro above.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.setf (ios::left);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw (17) << "Item"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (4) << "Num"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << "Weight"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << "Price"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "Date" << endl
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Now we we iterate through the vector using an iterator and
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // produce output similar to that using Row
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Notice how we call the actual variables in i and not an index
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // offset.
+\protected_separator
+ This is because the macro at the begging of the file
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // set up an *actual* struct of type stock which contains the
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // variables item, num, weight, price, and data.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.precision(3);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ vector ::iterator i;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ for (i = res.begin (); i != res.end (); i++) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw (17) << i->item.c_str ()
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// unfortunally the gnu string class does not respond to format
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+// modifers so I have to convert it to a conat char *.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (4) << i->num
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << i->weight
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << i->price
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << i->sdate
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return 0;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadQuery er){ // handle any connection
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // or query errors that may come up
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadConversion er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // we still need to cache bad conversions incase something goes
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // wrong when the data is converted into stock
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\layout Standard
+
+As you can see.
+ SSQLS are very powerful things.
+\layout Subsection
+
+Adding Data
+\layout Standard
+
+SSQLS can also be used to add data to a table.
+ The file name for this code is custom2.cc
+\layout Comment
+
+example:custom2.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include "util.hh"
+\newline
+// util.hh/cc contains the print_stock_table function
+\newline
+
+\protected_separator
+
+\newline
+sql_create_5(stock, 1, 5, string, item, int, num,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ double, weight, double, price, Date, sdate)
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ try { // its in one big try block
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con(use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ stock row;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // create an empty stock object
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ /*
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.item = "Hot Dogs";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.num = 100;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.weight = 1.5;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.price = 1.75;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.sdate = "1998-09-25"; */
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.set("Hot Dogs", 100, 1.5, 1.75, "1998-09-25");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // populate stock
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.insert(row);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // form the query to insert the row
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // the table name is the name of the struct by default
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Query : " << query.preview() << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // show the query about to be executed
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // execute a query that does not return a result set
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ print_stock_table(query);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // now print the new table;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadQuery er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ } catch (BadConversion er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\layout Standard
+
+That's all there is to it.
+ Because this example modifies the data you should run
+\family typewriter
+reset-db
+\family default
+ after running the example code.
+\layout Subsection
+
+Modifying Data
+\layout Standard
+
+And it almost as easy to modify data with SSQLS.
+ The file name is custom3.cc.
+\layout Comment
+
+example:custom3.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include "util.hh"
+\newline
+// util.hh/cc contains the print_stock_table function
+\newline
+
+\protected_separator
+
+\newline
+sql_create_5(stock, 1, 5, string, item, int, num,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ double, weight, double, price, Date, sdate)
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ try { // its in one big try block
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con(use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "select * from stock where item =
+\backslash
+"Hotdogs' Buns
+\backslash
+" ";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Result res = query.store();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ if (res.empty())
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ throw BadQuery("Hotdogs' Buns not found in table, run reset-db");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // here we are testing if the query was successful, if not throw a bad
+ query
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ stock row = res[0];
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // because there should only be one row in this query we don't
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // need to use a vector.
+\protected_separator
+ Just store the first row directly in
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // "row".
+\protected_separator
+ We can do this because one of the constructors for
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // stock takes a Row as an parameter.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ stock row2 = row;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Now we need to create a copy so that the replace query knows
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // what the original values are.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ row.item = "Hotdog Buns"; // now change item
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.update(row2, row);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // form the query to replace the row
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // the table name is the name of the struct by default
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Query : " << query.preview() << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // show the query about to be executed
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // execute a query that does not return a result set
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ print_stock_table(query);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // now print the new table;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadQuery er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ } catch (BadConversion er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\layout Standard
+
+When you run the example you will notice that in the where clause only the
+
+\emph on
+item
+\emph default
+field is checked for.
+ This is because SSQLS also also less-than-comparable.
+\layout Standard
+
+Don't forget to run
+\family typewriter
+reset-db
+\family default
+ after running the example.
+\layout Subsection
+
+Less-Than-Comparable
+\layout Standard
+
+SSQLS are can also be made less-than-comparable.
+ This means that they can be sorted and stored in sets as demonstrated in
+ the next example.
+ The file name is custom4.cc
+\layout Comment
+
+example:custom4.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+sql_create_5(stock,
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ 1, // This number is used to make a SSQLS less-than-comparable.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // If this number is n then if the first n elements are the
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // same the two SSQLS are the same.
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // In this case if two two stock's "item" are the same then
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // the two stock are the same.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ 5, // this number should generally be the same as the number of
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // elements in the list unless you have a good reason not to.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ string,item,
+\protected_separator
+ int,num,
+\protected_separator
+ double,weight,
+\protected_separator
+ double,price,
+\protected_separator
+ Date,sdate)
+\newline
+
+\protected_separator
+
+\newline
+int main() {
+\newline
+
+\protected_separator
+ try { // its in one big try block
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Connection con(use_exceptions);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ con.connect("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = con.query();
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "select * from stock";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ set res;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.storein(res);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // here we are storing the elements in a set not a vector.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.setf (ios::left);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw (17) << "Item"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (4) << "Num"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << "Weight"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << "Price"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "Date" << endl
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Now we we iterate through the set.
+\protected_separator
+ Since it is a set the list will
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // naturally be in order.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ set::iterator i;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout.precision(3);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ for (i = res.begin (); i != res.end (); i++) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << setw (17) << i->item.c_str ()
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (4) << i->num
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << i->weight
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << setw (7) << i->price
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << i->sdate
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ i = res.find(stock("Hamburger Buns"));
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ if (i != res.end())
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Hamburger Buns found.
+\protected_separator
+ Currently " << i->num << " in stock.
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ else
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cout << "Sorry no Hamburger Buns found in stock
+\backslash
+n";
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Now we are using the set's find method to find out how many
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // Hamburger Buns are in stock.
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return 0;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadQuery er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ } catch (BadConversion er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: Tried to convert
+\backslash
+"" << er.data << "
+\backslash
+" to a
+\backslash
+""
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << er.type_name << "
+\backslash
+"." << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\layout Subsection
+
+And There's More
+\layout Standard
+
+This is only scratching the surface of what SSQLS can do for more information
+ see the chapter on them (
+\begin_inset LatexCommand \ref{SSQLS}
+
+\end_inset
+
+).
+\layout Section
+
+Template Queries
+\layout Standard
+
+Another powerful feature of Mysql++ is being able to set up template queries.
+ The following example demonstrates how to use them.
+ This code is the actual code used to set up and/or reset the sample database.
+ It can be found under reset-db.cc.
+ I hope to come up with some better examples soon.
+\layout Comment
+
+example:reset-db.cc
+\layout LyX-Code-Sans
+
+#include
+\newline
+#include
+\newline
+
+\protected_separator
+
+\newline
+int main (int argc, char *argv[]) {
+\newline
+
+\protected_separator
+ Connection connection(use_exceptions);
+\newline
+
+\protected_separator
+ try { // the entire main block is one big try block;
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ if (argc == 1) connection.connect("");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ else if (argc == 2) connection.connect("",argv[1]);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ else if (argc == 3) connection.connect("",argv[1],argv[2]);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ else if (argc <= 4) connection.connect("",argv[1],argv[2],argv[3]);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // create a new object and connect based on any (if any) arguments
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // passed to main();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ try {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ connection.select_db("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ } catch (BadQuery er) {
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // if it couldn't connect to the database assume that it doesn't exist
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // and try created it.
+\protected_separator
+ If that does not work exit with an error.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ connection.create_db("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ connection.select_db("mysql_cpp_data");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ }
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ Query query = connection.query();
+\protected_separator
+ // create a new query object
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ try { // ignore any errors here
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // I hope to make this simpler soon
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute("drop table stock");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ } catch (BadQuery er) {}
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "create table stock
+\protected_separator
+ (item char(20) not null, num smallint,"
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ << "weight double, price double, sdate date)";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute(RESET_QUERY);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // send the query to create the table and execute it.
+\protected_separator
+ The
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // RESET_QUERY tells the query object to reset it self after
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // execution
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query << "insert into %5:table values (%0q, %1q, %2, %3, %4q)";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.parse();
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // set up the template query I will use to insert the data.
+\protected_separator
+ The
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // parse method call is important as it is what lets the query
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // know that this is a template and not a literal string
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.def["table"] = "stock";
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // This is setting the parameter named table to stock.
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute ("Hamburger Buns", 56, 1.25, 1.1, "1998-04-26");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute ("Hotdogs' Buns"
+\protected_separator
+
+\protected_separator
+ ,65, 1.1 , 1.1, "1998-04-23");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute ("Dinner Roles"
+\protected_separator
+ , 75,
+\protected_separator
+ .95, .97, "1998-05-25");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ query.execute ("White Bread"
+\protected_separator
+
+\protected_separator
+ , 87, 1.5, 1.75, "1998-09-04");
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // The last parameter "table" is not specified here.
+\protected_separator
+ Thus
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ // the default value for "table" is used which is "stock".
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+ } catch (BadQuery er) { // handle any errors that may come up
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ cerr << "Error: " << er.error << endl;
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ return -1;
+\newline
+
+\protected_separator
+ }
+\newline
+}
+\newline
+
+\protected_separator
+
+\layout Chapter
+
+Class Reference
+\layout Standard
+
+This chapter documents all of the classes that are meant to be used.
+ If it is not documented here
+\series bold
+don't use it
+\series default
+ because it is a internal method or class meant to only be used by other
+ related classes.
+\layout Comment
+
+Begin Class Ref
+\layout Standard
+
+
+\begin_inset LatexCommand \label{SQLQuery}
+
+\end_inset
+
+
+\begin_inset LatexCommand \label{SQLQueryParms}
+
+\end_inset
+
+
+\layout Comment
+
+End Class Ref
+\layout Section
+
+Manipulators
+\layout Standard
+
+The following manipulators modify only the next item to the right of it
+ in an
+\family typewriter
+<<
+\family default
+ chain.
+ They can be used with any ostream (which includes
+\series bold
+SQLQuery
+\series default
+ and
+\series bold
+Query
+\series default
+ because they are also ostreams) or
+\series bold
+SQLQueryParms
+\series default
+.
+ When used with
+\series bold
+SQLQueryParms
+\series default
+ they will override any settings set by the Template Query for that particular
+ item.
+\layout Description
+
+quote Quote and escape the next item.
+ Can be used with
+\series bold
+ostream
+\series default
+ or
+\series bold
+SQLQueryParms
+\series default
+.
+
+\layout Description
+
+quote_only Quote but don't escape the next item.
+ Can be used with
+\series bold
+ostream
+\series default
+ or
+\series bold
+SQLQueryParms
+\series default
+.
+
+\layout Description
+
+quote_only_double Quote, but don't escape the next item, with `` instead
+ of '.
+
+\layout Description
+
+escape Escape the next item.
+
+\layout Description
+
+do_nothing Does exactly what it says nothing.
+ Used as a dummy manipulator when you are required to use some manipulator.
+ When used with
+\series bold
+SQLQueryParms
+\series default
+ it will make sure that it does not get formatted in any way overriding
+ any setting set by the template query.
+
+\layout Description
+
+ignore Only valid when used with
+\series bold
+SQLQueryParms
+\series default
+.
+ Like
+\series bold
+do_nothing
+\series default
+ however this one will not override formatting set by the template query,
+ thus it is ignored.
+
+\layout Chapter
+
+Template Queries
+\layout Standard
+
+The idea of template queries is too provide a query with replaceable parameters
+ that can be changed between query calls with out having to reform the queries.
+\layout Section
+
+Setting Them Up
+\layout Standard
+
+To set up a template query simply enter the query like it is a normal query.
+ For example:
+\layout LyX-Code
+
+query << "select (%2:field1, %3:field2) from stock where %1:wheref = %q0:what"
+\layout Standard
+
+And then execute the Query::parse() method.
+ For example:
+\layout LyX-Code
+
+query.parse()
+\layout Section
+
+Template Format
+\begin_inset LatexCommand \label{template format}
+
+\end_inset
+
+
+\layout Standard
+
+An example template looks like this
+\layout LyX-Code
+
+select (%2:field1, %3:field2) from stock where %1:wheref = %q0:what
+\layout Standard
+
+The numbers represent the element number in
+\series bold
+SQLQueryParms
+\series default
+ (see the next section).
+
+\layout Standard
+
+The format of the substation parameter is:
+\layout LyX-Code
+
+%(modifier)##(:name)(:)
+\layout Standard
+
+Where Modifier can be any one of the following:
+\layout Description
+
+% Print an actual "%"
+\layout Description
+
+"" "" means nothing.
+ Don't quote or escape no matter what.
+
+\layout Description
+
+q This will quote and escape it using mysql_escape_string if it is a string
+ or char *, or another Mysql specific types that needs to be quoted.
+
+\layout Description
+
+Q Quote but don't escape based on the same rules.
+ This can save a bit of time if you know the strings will never need quoting
+
+\layout Description
+
+r Always quote and escape even if it is a number.
+
+\layout Description
+
+R Always quote but don't escape even if it is a number.
+
+\layout Standard
+
+## represents a number up to two digits
+\layout Standard
+
+``:name'' is for an optional name which aids in filling SQLQueryParms.
+ Name can contain any alpha-numeric characters or the underscore.
+ If you use name it must be proceeded by non-alpha-numeric charter.
+ If this is not the case add a column after the name.
+ If you need to represent an actual colon after the name follow the name
+ by two-columns.
+ The first one will end the name and the second one won't be processed.
+
+\layout Section
+
+Setting the Parameters
+\layout Standard
+
+The parameters can either be set when the query is executed or ahead of
+ time by using default parameters.
+\layout Subsection
+
+At Execution Time
+\layout Standard
+
+To specify the parameters when you want to execute a query simply use
+\series bold
+Query::store(const SQLString &parm0, [..., const SQLString &parm11])
+\series default
+ (or
+\series bold
+Query::use
+\series default
+ or
+\series bold
+Query::execute
+\series default
+).
+ Where
+\series bold
+parm0
+\series default
+ corresponds to parameter number 0, etc.
+ You may specify from 1 to 12 different parameters.
+ For example:
+\layout LyX-Code
+
+Result res = query.store("Dinner Roles", "item", "item", "price")
+\layout Standard
+
+with the template query provided in section
+\begin_inset LatexCommand \ref{template format}
+
+\end_inset
+
+ would produce:
+\layout LyX-Code
+
+select (item, price) from stock where item = "Dinner Roles"
+\layout Standard
+
+The reason for why I
+\emph on
+didn't
+\emph default
+ make the template the more logical:
+\layout LyX-Code
+
+select (%0:field1, %1:field2) from stock where %2:wheref = %q3:what
+\layout Standard
+
+will become apparent shortly.
+\layout Subsection
+
+Using Defaults
+\layout Standard
+
+You can also set the parameters one at a time by means of the public data
+ member
+\series bold
+def
+\series default
+.
+ To change the values of the
+\series bold
+def
+\series default
+ simply use the subscript operator.
+ You can refer to the parameters either by number or by name.
+ For example:
+\layout LyX-Code
+
+query.def[0] = "Dinner Roles";
+\newline
+query.def[1] = "item";
+\newline
+query.def[2] = "item";
+\newline
+query.def[3] = "price";
+\layout Standard
+
+and
+\layout LyX-Code
+
+query.def["what"] = "Dinner Roles";
+\newline
+query.def["wheref"] = "item";
+\newline
+query.def["field1"] = "item";
+\newline
+query.def["field2"] = "price";
+\layout Standard
+
+would both have the same effect.
+\layout Standard
+
+Once all the parameters are set simply execute as you would have executed
+ the query before you knew about template queries.
+ For example:
+\layout LyX-Code
+
+Result res = query.store()
+\layout Subsection
+
+Combining the Two
+\layout Standard
+
+You can also combine the use of setting the parameters at execution time
+ and setting them by use of the
+\series bold
+def
+\series default
+ object by simply using the extended form of
+\series bold
+Query::store
+\series default
+ (or
+\series bold
+use
+\series default
+ or
+\series bold
+execute
+\series default
+) without all of necessary parameters specified.
+ For example:
+\layout LyX-Code
+
+query.def["field1"] = "item";
+\newline
+query.def["field2"] = "price";
+\newline
+Result res1 = query.store("Hamburger Buns", "item");
+\newline
+Result res2 = query.store(1.25, "price");
+\layout Standard
+
+Would store the query:
+\layout LyX-Code
+
+select (item, price) from stock where item = "Hamburger Buns"
+\layout Standard
+
+for
+\family typewriter
+ res1
+\family default
+and
+\layout LyX-Code
+
+select (item, price) from stock where price = 1.25
+\layout Standard
+
+for
+\family typewriter
+res2
+\family default
+.
+\layout Standard
+
+Because the extended form of
+\series bold
+Query::store
+\series default
+ can only effect the beginning (by number not by location) parameters the
+ more logical template query:
+\layout LyX-Code
+
+select (%0:field1, %1:field2) from stock where %2:wheref = %q3:what
+\layout Standard
+
+would
+\emph on
+not
+\emph default
+of worked in this case.
+ Thus the more twisted ordering of
+\layout LyX-Code
+
+select (%2:field1, %3:field2) from stock where %1:wheref = %q0:what
+\layout Standard
+
+was needed so that we can specify
+\series bold
+wheref
+\series default
+ and
+\series bold
+what
+\series default
+ each time.
+\layout Standard
+
+One thing to watch out for, however, is that
+\series bold
+Query::store(const char* q)
+\series default
+ is also defined for executing the query
+\family typewriter
+q
+\family default
+.
+ For this reason when you use the
+\series bold
+Query::store
+\series default
+ (or
+\series bold
+use
+\series default
+, or
+\series bold
+execute
+\series default
+) with only one item and that item is a
+\series bold
+const char*
+\series default
+ you need to explicitly convert it into a SQLString.
+ For example:
+\layout LyX-Code
+
+Result res = query.store(SQLString("Hamburger Buns")).
+\layout Subsection
+
+Error Handling
+\layout Standard
+
+If for some reason you did not specify all the parameters when executing
+ the query
+\emph on
+and
+\emph default
+ the remaining parameters do not have there values set via
+\family typewriter
+def
+\family default
+ the query object will throw a
+\series bold
+SQLQueryNEParms
+\series default
+ object.
+ In which case you you can find out what happened by checking the value
+ of
+\series bold
+SQLQueryNEParms::string
+\series default
+.
+
+\layout Standard
+
+For example:
+\layout LyX-Code
+
+query.def["field1"] = "item";
+\newline
+query.def["field2"] = "price";
+\newline
+Result res = query.store(1.25);
+\layout Standard
+
+would throw
+\series bold
+SQLQueryNEParms
+\series default
+ because the
+\family typewriter
+wheref
+\family default
+ is not specified.
+\layout Standard
+
+In theory this exception should never be thrown.
+ If the exception is thrown it probably a logic error on you part.
+ (Like in the above example)
+\layout Subsection
+
+More Advanced Stuff
+\layout Standard
+
+To be written.
+ However, for now see the class
+\series bold
+SQLQuery
+\series default
+ (
+\begin_inset LatexCommand \ref{SQLQuery}
+
+\end_inset
+
+) and
+\series bold
+SQLQueryParms
+\series default
+ (
+\begin_inset LatexCommand \ref{SQLQueryParms}
+
+\end_inset
+
+) for more information.
+\layout Chapter
+
+Specialized SQL Structures
+\begin_inset LatexCommand \label{SSQLS}
+
+\end_inset
+
+
+\layout Standard
+
+The Specialized SQL Structures (SSQLS) allows you create structures to hold
+ data for mysql queries with extra functionality to make your life easier.
+ These structures are in no way related to any Standard Template Library
+ (STL) type of containers.
+ These structures are exactly that
+\series bold
+structs
+\series default
+.
+ Each member item is stored with a unique name within the structure.
+ You can in no way use STL algorithms are anything else STL to work with
+ the individual structures.
+ However you CAN use these structures as the
+\series bold
+value_type
+\series default
+ for STL containers.
+ (They would be pretty useless if you couldn't.)
+\layout Section
+
+sql_create_basic
+\layout Standard
+
+The following command will create a basic mysql query for use with the
+ sample database.
+
+\layout LyX-Code
+
+sql_create_basic_5(stock,
+\protected_separator
+0,
+\protected_separator
+0,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date)
+\protected_separator
+
+\layout Standard
+
+This will set up the following structure:
+\layout LyX-Code
+
+struct
+\protected_separator
+stock
+\protected_separator
+{
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock
+\protected_separator
+()
+\protected_separator
+{}
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock
+\protected_separator
+(const MysqlRow
+\protected_separator
+&row);
+\newline
+
+\protected_separator
+
+\protected_separator
+set (const MysqlRow &row);
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+string
+\protected_separator
+item;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+int
+\protected_separator
+num;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+double
+\protected_separator
+weight;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+double
+\protected_separator
+price;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+MysqlDate
+\protected_separator
+date;
+\protected_separator
+
+\newline
+};
+\protected_separator
+
+\layout Standard
+
+As you can see this is nothing fancy.
+ The main advantage of this simple structure is the
+\series bold
+stock (MysqlRow &row)
+\series default
+ constructor which allows you to easily populate a vector of stocks like
+ so:
+\layout LyX-Code
+
+vector
+\protected_separator
+result;
+\protected_separator
+
+\protected_separator
+
+\newline
+query.storein(result);
+\protected_separator
+
+\layout Standard
+
+That's all there is two it.
+ The requirements are that the query returns elements in the same order
+ as you specified them in the custom structure.
+
+\layout Standard
+
+The general format is:
+\layout LyX-Code
+
+sql_create_basic_#(NAME,
+\protected_separator
+0,
+\protected_separator
+0,
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+...
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#)
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+Where # is the number of valuables in the vector, NAME is the name of the
+ structure you wish to create, and TYPE1 is the type name for first item
+ and ITEM1 is the valuables name for the first item etc..
+
+\layout Section
+
+sql_create_basic with compare
+\layout Standard
+
+You can also make the structure comparable by changing the first 0 in the
+ previous example to a non zero number.
+ This number, lets call it n, will tell c++ that if the first n number
+ or the same then the two structures are the same.
+
+\layout Standard
+
+For example:
+\layout LyX-Code
+
+sql_create_basic_5(stock,
+\protected_separator
+1,
+\protected_separator
+0,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date)
+\protected_separator
+
+\layout Standard
+
+will create a structure where only the item valuable is checked to see if
+ two different stocks are the same.
+ It also allows you to compare one structure to another based on the value
+ of item.
+ (If n is greater than one it will compare the structures in a Lexicographic
+ order.
+ For example if it was 2 it would first compare
+\family typewriter
+item
+\family default
+ and if item was the same it would then compare
+\family typewriter
+num
+\family default
+.
+ If num was the same it would declare the two structures the same.)
+\layout Standard
+
+In addition what the previous example defines it also defines the following:
+
+\layout LyX-Code
+
+struct
+\protected_separator
+stock
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock
+\protected_separator
+(const
+\protected_separator
+string
+\protected_separator
+&p1);
+\newline
+
+\protected_separator
+
+\protected_separator
+set (const string &p1);
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+==
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+!=
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+>
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+<
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+>=
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+operator
+\protected_separator
+<=
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+int
+\protected_separator
+cmp
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+int
+\protected_separator
+compare
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&other)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+}
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\newline
+int
+\protected_separator
+compare
+\protected_separator
+(const
+\protected_separator
+stock
+\protected_separator
+&x,
+\protected_separator
+const
+\protected_separator
+stock
+\protected_separator
+&y);
+\protected_separator
+
+\layout Standard
+
+int compare (const stock &x, const stock &y) compares x to y and return
+ <0 if x < y, 0 if x = y, and >0 if x > y.
+ stock::cmp and stock::compare are the same thing as compare(*this, other).
+
+\layout Standard
+
+stock::stock is a constructor that will set item to p1 and leave the other
+ variables undefined.
+ This is useful for creating temporary objects to use for comparisons like
+ x <= stock("Hotdog").
+
+\layout Standard
+
+Because
+\series bold
+stock
+\series default
+ is now less-then-comparable you can store the query results in a set:
+\layout LyX-Code
+
+set
+\protected_separator
+result;
+\protected_separator
+
+\protected_separator
+
+\newline
+query.storein(result);
+\protected_separator
+
+\layout Standard
+
+And you can now use it like any other set, for example:
+\layout LyX-Code
+
+cout
+\protected_separator
+<<
+\protected_separator
+result.lower_bound(stock("Hamburger"))->item
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+will return the first item that begins with Hamburger.
+
+\layout Standard
+
+You can also now use it will any STL algorithm that require the values to
+ be less-then-comparable.
+
+\layout Standard
+
+The general format so far is:
+\layout LyX-Code
+
+sql_create_base_#(NAME,
+\protected_separator
+CMP,
+\protected_separator
+0,
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+...
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#)
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+where CMP is that the number that tells c++ that if the first cmp variables
+ are the same then the two structures are the same.
+
+\layout Section
+
+sql_create_basic with Additional Constructor
+\layout Standard
+
+The last zero in the last example if for creating another constructor.
+ Let this zero be m then it will create a constructor which will populate
+ the first n variables.
+ For example:
+\layout LyX-Code
+
+sql_create_basic_5(stock,
+\protected_separator
+1,
+\protected_separator
+5,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date)
+\protected_separator
+
+\layout Standard
+
+will also define:
+\layout LyX-Code
+
+struct
+\protected_separator
+stock
+\protected_separator
+{
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock(const
+\protected_separator
+string&,
+\protected_separator
+const
+\protected_separator
+int&,
+\protected_separator
+const
+\protected_separator
+double&,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+const
+\protected_separator
+double&,
+\protected_separator
+const
+\protected_separator
+MysqlDate&);
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+set(const
+\protected_separator
+string&,
+\protected_separator
+const
+\protected_separator
+int&,
+\protected_separator
+const
+\protected_separator
+double&,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+const
+\protected_separator
+double&,
+\protected_separator
+const
+\protected_separator
+MysqlDate&);
+\protected_separator
+
+\newline
+}
+\protected_separator
+
+\layout Section
+
+sql_create_basic General Format
+\layout Standard
+
+Thus the general format for sql_create_basic is
+\layout LyX-Code
+
+sql_create_basic_#(NAME,
+\protected_separator
+CMP,
+\protected_separator
+CNST,
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+...,
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#)
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+Where:
+\layout Itemize
+
+# is the number of valuables in the vector
+\layout Itemize
+
+NAME is the name of the structure you wish to create
+\layout Itemize
+
+CMP is the number that tells c++, if not set to 0, that if the first cmp
+ variables are the same then the two structures are the same.
+
+\layout Itemize
+
+CNST is the number, if not set to 0, that will create a constructor which
+ will populate the first n variables.
+
+\layout Itemize
+
+TYPE1 is the type name for first item and ITEM1 is the valuables name for
+ the first item etc..
+
+\layout Section
+
+sql_create_basic_c_order
+\layout Standard
+
+You can also specify an alternate order for when mysql populates the structure.
+ For example:
+\layout LyX-Code
+
+sql_create_basic_c_order_5(stock,
+\protected_separator
+2,
+\protected_separator
+5,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date,
+\protected_separator
+5,
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+order
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+4,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+1,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+2,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+3)
+\protected_separator
+
+\layout Standard
+
+This will create a similar structure as in the previous example except that
+ that the order of the data items will be different and c++ will use the
+ first two items to compare with (date, price).
+ However because a custom order is specified you can use the same query
+ to populate the set.
+ It will fill
+\family typewriter
+date
+\family default
+ with the first 5th item of the query result set,
+\family typewriter
+price
+\family default
+ with the 4th, etc...
+
+\layout Section
+
+sql_create_basic_c_order General Format
+\layout Standard
+
+Thus the general format for sql_create_basic is
+\layout LyX-Code
+
+sql_create_basic_c_order_#
+\protected_separator
+(NAME,
+\protected_separator
+CMP,
+\protected_separator
+CNST,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+ORDER1,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#,
+\protected_separator
+ORDER#)
+\protected_separator
+
+\layout Standard
+
+Where:
+\layout Itemize
+
+# is the number of valuables in the vector
+\layout Itemize
+
+NAME is the name of the structure you wish to create
+\layout Itemize
+
+CMP is the number that tells c++, if not set to 0, that if the first cmp
+ variables are the same then the two structures are the same.
+
+\layout Itemize
+
+CNST is the number, if not set to 0, that will create a constructor which
+ will populate the first n variables.
+
+\layout Itemize
+
+TYPE1 is the type name for first item, ITEM1 is the valuable name for the
+ first item, ORDER1 is the order number for the first item ...etc...
+
+\layout Section
+
+sql_create
+\layout Standard
+
+In addition to the basic structures you can set up enhanced structures that
+ also have methods defined to aid in the creation of queries and in the
+ insertion of data in tables.
+
+\layout Standard
+
+For example:
+\layout LyX-Code
+
+sql_create_5(stock,
+\protected_separator
+1,
+\protected_separator
+5,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date)
+\protected_separator
+
+\layout Standard
+
+which will, in addition to that which is defined in sql_create_basic with
+ Additional Constructor, define the equivalent to:
+\layout LyX-Code
+
+struct
+\protected_separator
+stock
+\protected_separator
+{
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+static
+\protected_separator
+char
+\protected_separator
+*names[];
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+static
+\protected_separator
+char
+\protected_separator
+*table;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_value_list
+\protected_separator
+value_list(cchar
+\protected_separator
+*d
+\protected_separator
+=
+\protected_separator
+",",
+\protected_separator
+
+\protected_separator
+//
+\protected_separator
+basic
+\protected_separator
+form
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+Manip
+\protected_separator
+m
+\protected_separator
+=
+\protected_separator
+mysql_quote)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_field_list
+\protected_separator
+field_list(cchar
+\protected_separator
+*d
+\protected_separator
+=
+\protected_separator
+",",
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+Manip
+\protected_separator
+m
+\protected_separator
+=
+\protected_separator
+mysql_do_nothing)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_equal_list
+\protected_separator
+equal_list(cchar
+\protected_separator
+*d
+\protected_separator
+=
+\protected_separator
+",",
+\layout LyX-Code
+
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+cchar *e = " = ",
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+Manip
+\protected_separator
+m
+\protected_separator
+=
+\protected_separator
+mysql_quote,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+//
+\protected_separator
+bool
+\protected_separator
+form
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_cus_value_list
+\protected_separator
+value_list([cchar
+\protected_separator
+*d,
+\protected_separator
+[Manip
+\protected_separator
+m,]
+\protected_separator
+]
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+i1,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+i2
+\protected_separator
+=
+\protected_separator
+false,
+\protected_separator
+...
+\protected_separator
+,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+bool
+\protected_separator
+i5
+\protected_separator
+=
+\protected_separator
+false)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+//
+\protected_separator
+list
+\protected_separator
+form
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_cus_value_list
+\protected_separator
+value_list([cchar
+\protected_separator
+*d,
+\protected_separator
+[Manip
+\protected_separator
+m,]
+\protected_separator
+]
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+stock_enum
+\protected_separator
+i1,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+stock_enum
+\protected_separator
+i2
+\protected_separator
+=
+\protected_separator
+stock_NULL,
+\protected_separator
+...,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+stock_enum
+\protected_separator
+i5
+\protected_separator
+=
+\protected_separator
+stock_NULL)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+template
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+//
+\protected_separator
+vector
+\protected_separator
+form
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+stock_cus_value_list
+\protected_separator
+value_list([cchar
+\protected_separator
+*d,
+\protected_separator
+[Manip
+\protected_separator
+m,]
+\protected_separator
+]
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+vector
+\protected_separator
+*i)
+\protected_separator
+const;
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+...(The
+\protected_separator
+logical
+\protected_separator
+equivalent
+\protected_separator
+for
+\protected_separator
+field_list
+\protected_separator
+and
+\protected_separator
+equal_list)...
+\protected_separator
+
+\newline
+};
+\protected_separator
+
+\layout Standard
+
+
+\series bold
+value_list()
+\series default
+ returns a special class that when used with the << operator with an ostream
+ on the left will return a comma separated list with values properly quoted
+ and escaped when needed.
+
+\layout Standard
+
+
+\series bold
+field_list()
+\series default
+ return a special class than does the same thing but returns a list of
+ fields that the structure holds which in this case is the same thing as
+ the valuable names.
+ The field names are not escaped or quoted
+\layout Standard
+
+
+\series bold
+equal_list()
+\series default
+ returns a comma separated list with the format
+\series bold
+field name = value
+\series default
+.
+ The field name is not quoted or escaped and value is escaped or quoted
+ as needed.
+
+\layout Standard
+
+For example:
+\layout LyX-Code
+
+stock
+\protected_separator
+s("Dinner
+\protected_separator
+Roles",75,0.95,0.97,"1998-05-25");
+\protected_separator
+
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+"Value
+\protected_separator
+List:
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.comma_list()
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+"Field
+\protected_separator
+List:
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.field_list()
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+"Equal
+\protected_separator
+List:
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.equal_list()
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\layout Standard
+
+Would return something like (with a little extra hand formating):
+\layout LyX-Code
+
+Value
+\protected_separator
+List:
+\protected_separator
+'Dinner
+\protected_separator
+Roles',75,0.95,0.97,'1998-05-25'
+\protected_separator
+
+\protected_separator
+
+\newline
+Field
+\protected_separator
+List:
+\protected_separator
+item,num,weight,price,date
+\protected_separator
+
+\newline
+Equal
+\protected_separator
+List:
+\protected_separator
+item
+\protected_separator
+=
+\protected_separator
+'Dinner
+\protected_separator
+Roles',num
+\protected_separator
+=
+\protected_separator
+75,weight
+\protected_separator
+=
+\protected_separator
+0.95,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+price
+\protected_separator
+=
+\protected_separator
+0.97,date
+\protected_separator
+=
+\protected_separator
+'1998-05-25'
+\protected_separator
+
+\layout Standard
+
+A combination of the field and value list can be used for insert or replace
+ queries.
+ For example:
+\layout LyX-Code
+
+query
+\protected_separator
+<<
+\protected_separator
+"insert
+\protected_separator
+into
+\protected_separator
+stock
+\protected_separator
+("
+\protected_separator
+<<
+\protected_separator
+s.field_list()
+\protected_separator
+")
+\protected_separator
+values
+\protected_separator
+"
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+<<
+\protected_separator
+s.value_list();
+\protected_separator
+
+\layout Standard
+
+will insert
+\family typewriter
+s
+\family default
+ into table stock.
+
+\layout Standard
+
+You can also use SQLQuery::insert or SQLQuery::replace (and thus Query::insert
+ or Query::replace) as a short cut to accomplish the same task like so:
+
+\layout LyX-Code
+
+query.insert(s);
+\layout Standard
+
+It will use s.table for the table name which defaults to the name of the
+ structure.
+
+\layout Standard
+
+You can also specify an different delimiter "d".
+ If none is specified it defaults to ",".
+ With this you can use the delimiter " AND " for equal_list to aid in update
+ and select queries.
+ For example:
+\layout LyX-Code
+
+stock
+\protected_separator
+s2
+\protected_separator
+=
+\protected_separator
+s;
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+s2.item
+\protected_separator
+=
+\protected_separator
+"6
+\protected_separator
+Dinner
+\protected_separator
+Roles";
+\protected_separator
+
+\newline
+query
+\protected_separator
+<<
+\protected_separator
+"UPDATE
+\protected_separator
+TABLE
+\protected_separator
+stock
+\protected_separator
+SET
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s2.equal_list()
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+<<
+\protected_separator
+"
+\protected_separator
+WHERE
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.equal_list("
+\protected_separator
+AND
+\protected_separator
+");
+\protected_separator
+
+\layout Standard
+
+would produce the query:
+\layout LyX-Code
+
+UPDATE
+\protected_separator
+TABLE
+\protected_separator
+stock
+\protected_separator
+SET
+\protected_separator
+item
+\protected_separator
+=
+\protected_separator
+'6
+\protected_separator
+Dinner
+\protected_separator
+Roles',num
+\protected_separator
+=
+\protected_separator
+75,weight
+\protected_separator
+=
+\protected_separator
+0.95,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+price
+\protected_separator
+=
+\protected_separator
+0.97,date
+\protected_separator
+=
+\protected_separator
+'1998-05-25'
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+WHERE
+\protected_separator
+item
+\protected_separator
+=
+\protected_separator
+'Dinner
+\protected_separator
+Roles'
+\protected_separator
+AND
+\protected_separator
+num
+\protected_separator
+=
+\protected_separator
+75
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+AND
+\protected_separator
+weight
+\protected_separator
+=
+\protected_separator
+0.95
+\protected_separator
+AND
+\protected_separator
+price
+\protected_separator
+=
+\protected_separator
+0.97
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+AND
+\protected_separator
+date
+\protected_separator
+=
+\protected_separator
+'1998-05-25'
+\protected_separator
+
+\layout Standard
+
+which will change the entree in the table so that item is now "6 Dinner
+ Roles" instead of "Dinner Roles"
+\layout Standard
+
+You can use
+\series bold
+SQLQuery::update
+\series default
+ (and thus
+\series bold
+Query::update
+\series default
+) as a short cut to accomplishing the same task like so:
+\layout LyX-Code
+
+stock
+\protected_separator
+s2
+\protected_separator
+=
+\protected_separator
+s;
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+s2.item
+\protected_separator
+=
+\protected_separator
+"6
+\protected_separator
+Dinner
+\protected_separator
+Roles";
+\protected_separator
+
+\newline
+query.update(s,s2);
+\protected_separator
+
+\layout Standard
+
+Like
+\series bold
+SQLQuery::insert
+\series default
+, it will use s.table for the table name which defaults to the name of the
+ structure.
+
+\layout Standard
+
+You can also specify an different manipulator which will effect the way
+ c++ quotes or escapes the values.
+ This may be any valid stream manipulator that only effects the item to
+ the right of manipulator.
+
+\series bold
+value_list
+\series default
+ and
+\series bold
+equal_list
+\series default
+ defaults to
+\series bold
+escape
+\series default
+ and
+\series bold
+field_list
+\series default
+ defaults to
+\series bold
+do_nothing
+\series default
+.
+ For
+\series bold
+equal_list
+\series default
+ the manipulator only effects the
+\series bold
+value
+\series default
+ part and not the
+\series bold
+field name
+\series default
+ part.
+
+\layout Standard
+
+This can be useful creating exporting to a file where you don't want quotes
+ around strings for example.
+
+\layout LyX-Code
+
+table_out
+\protected_separator
+<<
+\protected_separator
+q.value_list("
+\backslash
+
+\protected_separator
+t",
+\protected_separator
+mysql_escape)
+\protected_separator
+<<
+\protected_separator
+endl;
+\layout Standard
+
+will append data to the file handle table_out.
+
+\layout Standard
+
+The three non-basic forms allow you to specify which items are returned.
+ For example:
+\layout LyX-Code
+
+cout
+\protected_separator
+<<
+\protected_separator
+q.value_list(false,false,true,true,false)
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+//bool
+\protected_separator
+form
+\protected_separator
+
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+q.value_list(stock_weight,
+\protected_separator
+stock_price)
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+//list
+\protected_separator
+form
+\protected_separator
+
+\layout Standard
+
+will both return:
+\layout LyX-Code
+
+0.95,0.97
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+The
+\shape italic
+bool form
+\shape default
+ excepts boolean arguments where each true/false represents an wether to
+ show a valuable.
+ False means not to show it while true means to show it.
+ If you leave of some they are assumed to be false.
+ For example:
+\layout LyX-Code
+
+cout
+\protected_separator
+<<
+\protected_separator
+q.value_list(false,false,true,true)
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+is the same as the above example.
+
+\layout Standard
+
+The
+\shape italic
+list form
+\shape default
+ allows you to specify which items to show.
+ An enum values are created for each valuable with the name of struct plus
+ the underscore character prefixed before it.
+ For example: item becomes stock_item.
+
+\layout Standard
+
+These forms can be useful is select queries.
+ For example:
+\layout LyX-Code
+
+query
+\protected_separator
+<<
+\protected_separator
+"SELECT
+\protected_separator
+*
+\protected_separator
+FROM
+\protected_separator
+stock
+\protected_separator
+WHERE
+\protected_separator
+"
+\protected_separator
+
+\layout LyX-Code
+
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+ <<
+\protected_separator
+q.equal_list("
+\protected_separator
+AND
+\protected_separator
+",stock_weight,stock_price);
+\protected_separator
+
+\layout Standard
+
+would produce the query:
+\layout LyX-Code
+
+SELECT
+\protected_separator
+*
+\protected_separator
+FROM
+\protected_separator
+stock
+\protected_separator
+WHERE
+\protected_separator
+weight=0.95
+\protected_separator
+AND
+\protected_separator
+price=0.97
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+which will select all rows from stock which have the same weight and price
+ as
+\shape italic
+q
+\shape default
+.
+
+\layout Standard
+
+The
+\shape italic
+vector form
+\shape default
+ (not shown above) allows you to pass a boolean vector which is a time saver
+ if you use the some pattern more than once as it avoids having to create
+ the vector from the arguments each time.
+ If
+\family typewriter
+a
+\family default
+ is a boolean vector then
+\family typewriter
+a[0]
+\family default
+ will hold wether to include the first variable
+\family typewriter
+a[1]
+\family default
+ the second etc...
+ For example:
+\layout LyX-Code
+
+vector
+\protected_separator
+a;
+\protected_separator
+
+\protected_separator
+
+\newline
+a[0]
+\protected_separator
+=
+\protected_separator
+false;
+\protected_separator
+a[1]
+\protected_separator
+=
+\protected_separator
+false;
+\protected_separator
+a[2]
+\protected_separator
+=
+\protected_separator
+true;
+\protected_separator
+a[3]
+\protected_separator
+=
+\protected_separator
+true;
+\protected_separator
+a[4]
+\protected_separator
+=
+\protected_separator
+false;
+\protected_separator
+
+\newline
+query
+\protected_separator
+<<
+\protected_separator
+"SELECT
+\protected_separator
+*
+\protected_separator
+FROM
+\protected_separator
+stock
+\protected_separator
+WHERE
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+q.equal_list("
+\protected_separator
+AND
+\protected_separator
+",
+\protected_separator
+a);
+\protected_separator
+
+\layout Standard
+
+will produce the same query as in the above example.
+
+\layout Section
+
+sql_create_c_names
+\layout Standard
+
+You can also specify alternate field names like so:
+\layout LyX-Code
+
+sql_create_c_names_5(stock,
+\protected_separator
+1,
+\protected_separator
+5,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+string,
+\protected_separator
+item,
+\protected_separator
+"item",
+\protected_separator
+//
+\protected_separator
+type,
+\protected_separator
+id,
+\protected_separator
+column
+\protected_separator
+name
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+int,
+\protected_separator
+num,
+\protected_separator
+"quantity",
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+weight,
+\protected_separator
+"weight",
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+double,
+\protected_separator
+price,
+\protected_separator
+"price"
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+MysqlDate,
+\protected_separator
+date,
+\protected_separator
+"shipment")
+\protected_separator
+
+\layout Standard
+
+When
+\series bold
+field_list
+\series default
+ or
+\series bold
+equal_list
+\series default
+ is used it will use the given field names rather than the variable names
+ for example:
+\layout LyX-Code
+
+stock
+\protected_separator
+s("Dinner
+\protected_separator
+Roles",75,0.95,0.97,"1998-05-25");
+\protected_separator
+
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+"Field
+\protected_separator
+List:
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.field_list()
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\newline
+cout
+\protected_separator
+<<
+\protected_separator
+"Equal
+\protected_separator
+List:
+\protected_separator
+"
+\protected_separator
+<<
+\protected_separator
+s.equal_list()
+\protected_separator
+<<
+\protected_separator
+endl;
+\protected_separator
+
+\layout Standard
+
+Would return something like (with a little extra hand formating):
+\layout LyX-Code
+
+Field
+\protected_separator
+List:
+\protected_separator
+item,quantity,weight,price,shipment
+\protected_separator
+
+\protected_separator
+
+\newline
+Equal
+\protected_separator
+List:
+\protected_separator
+item
+\protected_separator
+=
+\protected_separator
+'Dinner
+\protected_separator
+Roles',quantity
+\protected_separator
+=
+\protected_separator
+75,weight
+\protected_separator
+=
+\protected_separator
+0.95,
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+price
+\protected_separator
+=
+\protected_separator
+0.97,shipment
+\protected_separator
+=
+\protected_separator
+'1998-05-25'
+\protected_separator
+
+\layout Section
+
+sql_create_c_names General Format
+\layout Standard
+
+The general format is:
+\layout LyX-Code
+
+sql_create_c_names_#
+\protected_separator
+(NAME,
+\protected_separator
+CMP,
+\protected_separator
+CNST,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+NAME1,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#,
+\protected_separator
+NAME#)
+\protected_separator
+
+\layout Standard
+
+where NAME1 is the name of the first field, etc.
+ Everything else is the same as it is the same as in sql_create_basic_c_order
+ General Format.
+
+\layout Section
+
+sql_create_c_order
+\layout Standard
+
+As in sql_create_basic_c_order you may specify a custom order.
+ The general from is:
+\layout LyX-Code
+
+sql_create_c_order_#
+\protected_separator
+(NAME,
+\protected_separator
+CMP,
+\protected_separator
+CNST,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+ORDER1,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#,
+\protected_separator
+ORDER#)
+\protected_separator
+
+\layout Standard
+
+where everything is the same as in sql_create_basic_c_order General Format.
+
+\layout Section
+
+sql_create_complete
+\layout Standard
+
+You can also specify both a custom order and custom field names.
+ The general from is.
+
+\layout LyX-Code
+
+sql_create_complete_#
+\protected_separator
+(NAME,
+\protected_separator
+CMP,
+\protected_separator
+CNST,
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE1,
+\protected_separator
+ITEM1,
+\protected_separator
+NAME1,
+\protected_separator
+ORDER1,
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+...
+\protected_separator
+
+\protected_separator
+
+\newline
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+
+\protected_separator
+TYPE#,
+\protected_separator
+ITEM#,
+\protected_separator
+NAME#,
+\protected_separator
+ORDER#)
+\protected_separator
+
+\layout Standard
+
+Where everything is the same as in sql_create_c_order General Format and
+ sql_create_c_names General Format.
+
+\layout Section
+
+Changing the table name
+\layout Standard
+
+In order to avoid having even more forms I decided not to allow you to specify
+ a different table name in the actual macro call.
+ The table name is used by
+\series bold
+SQLQuery::insert
+\series default
+,
+\series bold
+replace
+\series default
+, and
+\series bold
+update
+\series default
+.
+ However you can easeally change the default table name, which is the same
+ as the struct name, by changing the reference
+\series bold
+NAME::table()
+\series default
+ returns to a different
+\series bold
+const char *
+\series default
+ For example:
+\layout LyX-Code
+
+stock::table()
+\protected_separator
+=
+\protected_separator
+"in_stock"
+\protected_separator
+
+\protected_separator
+
+\layout Standard
+
+Will change the table name to "in_stock" in the examples used through out
+ this guide.
+
+\layout Section
+
+Seeing the actual code
+\layout Standard
+
+To see the actual code that the macro inserts use sql++pretty.
+ For example:
+\layout LyX-Code
+
+sql++pretty
+\protected_separator
+<
+\protected_separator
+test.cc
+\protected_separator
+|
+\protected_separator
+less
+\protected_separator
+
+\protected_separator
+
+\layout Section
+
+Adding functionality
+\layout Standard
+
+The best way to add functionality is through inheritance.
+ Even though you could paste the code outputted from pretty.pl and modify
+ it this is not recommended because it won't reflect future enhancements.
+
+\layout Section
+
+Other notes
+\layout Standard
+
+Macros are defined for structures with up to 25 items.
+ If you need more modify the underlying perl script custom.pl.
+ This perl script is used to generate the header file.
+ It in no way tries to parse C++ code.
+
+\layout Standard
+
+The header file that the script custom.pl creates is close to a meg.
+ However, please note that the 1 meg header file (custom-macros.hh) is NOTHING
+ but macros.
+ Therefor the compiler has to do very little work when reading is.
+
+\layout Standard
+
+Also, everything included by the macro call is done in such a way that you
+ can safely include the macro call in a header file and not have to worry
+ about duplicate function calls or anything of the like.
+
+\layout Chapter
+
+Long Names
+\layout Standard
+
+By default the Mysql++ API uses both short names with out the
+\series bold
+ Mysql
+\series default
+ or
+\series bold
+mysql_
+\series default
+prefix and long names with the
+\series bold
+Mysql
+\series default
+ or
+\series bold
+mysql_
+\series default
+prefix.
+ If this causes name problems define the macro
+\series bold
+MYSQL_NO_SHORT_NAMES
+\series default
+ before including
+\series bold
+mysql++
+\series default
+.
+ This will force the use of long names only.
+ The short and long names are mapped as follows:
+\layout Standard
+\added_space_top 0.3cm \added_space_bottom 0.3cm \align center \LyXTable
+multicol5
+33 2 0 0 -1 -1 -1 -1
+1 1 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+1 0 0 0
+2 1 0 "" ""
+2 1 1 "" ""
+1 8 1 1 0 0 0 "" ""
+1 8 1 1 0 0 0 "" ""
+0 2 1 0 0 0 0 "" ""
+0 2 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+0 8 1 0 0 0 0 "" ""
+
+
+\series bold
+Short Name
+\newline
+Long Name
+\series default
+
+\newline
+BadQuery
+\newline
+MysqlBadQuery
+\newline
+Connection
+\newline
+MysqlConnection
+\newline
+ResNSel
+\newline
+ResNSel
+\newline
+ResUse
+\newline
+ResUse MysqlResUse
+\newline
+Result
+\newline
+MysqlRes
+\newline
+Field
+\newline
+MysqlField
+\newline
+Fields
+\newline
+MysqlFields
+\newline
+ResIter
+\newline
+MysqlResIter
+\newline
+ResultIter
+\newline
+MysqlResIter
+\newline
+Row
+\newline
+MysqlRow
+\newline
+MutableRow
+\newline
+MysqlMutableRow
+\newline
+FieldNames
+\newline
+MysqlFieldNames
+\newline
+Query
+\newline
+MysqlQuery
+\newline
+BadConversion
+\newline
+MysqlBadConversion
+\newline
+ColData
+\newline
+MysqlColData
+\newline
+MutableColData
+\newline
+MysqlMutableColData
+\newline
+quote
+\newline
+mysql_quote
+\newline
+quote_only
+\newline
+mysql_quote_only
+\newline
+quote_double_only
+\newline
+mysql_quote_double_only
+\newline
+escape
+\newline
+mysql_escape
+\newline
+do_nothing
+\newline
+mysql_do_nothing
+\newline
+ignore
+\newline
+mysql_ignore
+\newline
+Date
+\newline
+MysqDate
+\newline
+Time
+\newline
+MysqlTime
+\newline
+DateTime
+\newline
+MysqlDateTime
+\newline
+Set
+\newline
+MysqlSet
+\newline
+Null
+\newline
+MysqlNull
+\newline
+null_type
+\newline
+mysql_null_type
+\newline
+null
+\newline
+mysql_null
+\newline
+NullisNull
+\newline
+MysqlNullisNull
+\newline
+NullisZero
+\newline
+MysqlNullisZero
+\newline
+NullisBlank
+\newline
+MysqlNullisBlank
+\layout Part*
+
+Appendices
+\layout LaTeX
+
+
+\backslash
+appendix
+\layout Chapter
+
+Changelog
+\layout Section*
+
+1.5 (Dec 1 1999) Sinisa Milivojevic
+\layout Itemize
+
+Fixed bug in template queries, introduced in 1.4 (!)
+\layout Itemize
+
+Fixed connect bug
+\layout Itemize
+
+Fixed several bug in type_info classes
+\layout Itemize
+
+Added additional robustness in classes
+\layout Itemize
+
+Added additional methods for SQL type info
+\layout Itemize
+
+Changed Changelog and README
+\layout Section*
+
+1.4 (Nov 25 1999) Sinisa Milivojevic
+\layout Itemize
+
+Fixed bug in store and storein methods
+\layout Itemize
+
+Fixed one serious memory leak
+\layout Itemize
+
+Fixed a very serious bug generated by gcc 2.95.xx !!
+\layout Itemize
+
+Added robustness in classes, so that e.g.
+ same query and row objects can be re-used
+\layout Itemize
+
+Changed sinisa_ex example to reflect and demonstrate this stability
+\layout Itemize
+
+Changed Changelog and README
+\layout Itemize
+
+Few other bug fixes and small improvements and speed-ups
+\layout Section*
+
+1.3 (Nov 10 1999) Sinisa Milivojevic
+\layout Itemize
+
+Fixed several erronous definitions
+\layout Itemize
+
+Further changed source to be 2.95.2 compatible
+\layout Itemize
+
+Expunged unused statements, especially dubious ones, like use of pointer_tracker
+\layout Itemize
+
+Corrected bug in example file fieldinf1
+\layout Itemize
+
+Finally fixed mysql_init in Connection constructor, which provided much
+ greater stability !
+\layout Itemize
+
+Added read and get options, so that clients, like mysqlgui can use it
+\layout Itemize
+
+Changed Changelog and README
+\layout Itemize
+
+Many other bug fixes.
+\layout Section*
+
+1.2 (Oct 15 1999) Sinisa Milivojevic
+\layout Itemize
+
+First offical release.
+ Version 1.0 and 1.1 were releases by Sinisa before I (Kevin Atkinson) made
+ him the offical maintainer,
+\layout Itemize
+
+Many manual fixes.
+\layout Itemize
+
+Changed README and Changelog
+\layout Itemize
+
+Changed source to be compilable by gcc 2.95.xx, tribute to Kevin Atkinson
+
+\layout Itemize
+
+Added methods in Connection class which are necessary for fullfilling administra
+tive functions with MySQL
+\layout Itemize
+
+Added many bug fixes in code pertaining to missing class initializers ,
+ as notified by Michael Rendell
+\layout Itemize
+
+Sinisa Milivojevic is now the offical maintainer.
+\layout Section*
+
+1.1 (Aug 2 1999) Sinisa Milivojevic
+\layout Itemize
+
+Added several bug fixes
+\layout Itemize
+
+Fixed memory leak problems and variables overlapping problems.
+\layout Itemize
+
+Added automake and autoconf support by loic@ceic.com
+\layout Itemize
+
+Added Makefile for manual
+\layout Itemize
+
+Added support for cygwin
+\layout Itemize
+
+Added example sinisa_ex (let modesty prevail) which used to crash a lot
+ when memory allocation, memory leak and overlap problems were present.
+ Smooth running of this example proves that all those bugs are fixed
+\layout Itemize
+
+Corrected bugs in sql_query.cc regarding delete versus delete[] and string
+ length in manip.cc
+\layout Itemize
+
+Changed manual
+\layout Itemize
+
+Changed README
+\layout Itemize
+
+Many other smaller things
+\layout Section*
+
+1.0 (June 9 1999) Michael Widenius
+\layout Itemize
+
+Added patches from Orion Poplawski to support the UnixWare
+ 7.0 compiler
+\layout Section*
+
+.64.1.1a (Sep 27 1998)
+\layout Itemize
+
+Fixed several bugs that caused my library to fail to compile with egcs 1.1.
+ Hopefully it will still compile with egcs 1.0 however I have not been able
+ to test it with egcs 1.0.
+\layout Itemize
+
+Removed some problem causing debug output in sql++pretty.
+\layout Section*
+
+.64.1a (Aug 1 1998)
+\layout Itemize
+
+Added an (almost) full guide to using Template Queries.
+\layout Itemize
+
+Fixed it so the SQLQuery will throw an exception when all the template parameter
+s are not provided.
+\layout Itemize
+
+Proofread and speedchecked the manual (it really needed it).
+\layout Itemize
+
+Other minor document fixes.
+\layout Section*
+
+.64.0.1a (July 31 1998)
+\layout Itemize
+
+Reworked the Class Reference section a bit.
+\layout Itemize
+
+Minor document fixes
+\layout Itemize
+
+Added more examples for SSQLS.
+\layout Itemize
+
+Changed the syntax of equal_list for SSQLS from equal_list (cchar *, Manip,
+ cchar *) to (cchar *, cchar *, Manip).
+\layout Itemize
+
+Added set methods to SSQLS.
+ These new methods do the same thing as there corresponding constructors.
+\layout Itemize
+
+Added methods for creating a mysql_type_info from a C++ type_info.
+\layout Section*
+
+.64.a (July 24 1998)
+\layout Itemize
+
+Changed the names of all the classes so they no longer have to have Mysql
+ in the begging of it.
+ However if this creates a problem you can define a macro to
+\emph on
+only
+\emph default
+ use the old names instead.
+
+\layout Itemize
+
+The Specialized SQL Structures (formally known as Custom Mysql Structures)
+ changed from mysql_ to sql_.
+\layout Itemize
+
+Added the option of using exceptions thoughout the API.
+\layout Itemize
+
+ColData (formally known as MysqlStrings) will now throw an exception if
+ there is a problem in the conversion.
+\layout Itemize
+
+Added a null adapter.
+\layout Itemize
+
+Added Mutable Result Sets
+\layout Itemize
+
+Added a very basic runtime type identification for SQL types
+\layout Itemize
+
+Changed the document format from POD to LyX .
+\layout Itemize
+
+Am now using a modified version of Perceps to extract the class information
+ directly from the code to make my life easier.
+\layout Itemize
+
+Added an option of defining a macro to avoid using the automatic conversion
+ with binary operators.
+\layout Itemize
+
+Other small fixed I probully forgot to mentune.
+\layout Section*
+
+.63.1.a
+\layout Itemize
+
+Added Custom Mysql Structures.
+\layout Itemize
+
+Fixed the Copy constructor of class Mysql
+\layout Itemize
+
+Started adding code so that class Mysql lets it children now when it is
+ leaving
+\layout Itemize
+
+Attempted to compile it into a library but still need help.
+ As default it will compile as a regular program.
+\layout Itemize
+
+Other small fixes.
+\layout Section*
+
+.62.a (May 3 1998)
+\layout Itemize
+
+Added Template Queries
+\layout Itemize
+
+Created s separate SQLQuery object that is independent of an SQL connection.
+\layout Itemize
+
+You no longer have to import the data for the test program as the program
+ creates the database and tables it needs.
+\layout Itemize
+
+Many small bug fixes.
+\layout Section*
+
+.61.1.a (April 28 1998)
+\layout Itemize
+
+Cleaned up the example code in test.cc and included it in the manual.
+\layout Itemize
+
+Added an interface layout plan to the manual.
+\layout Itemize
+
+Added a reverse iterator.
+\layout Itemize
+
+Fixed a bug with row.hh (It wasn't being included because of a typo).
+\layout Section*
+
+.61.0.a
+\layout Itemize
+
+Major interface changes.
+ I warned you that the interface may change while it is in pre-alpha state
+ and I wasn't kidding.
+\layout Itemize
+
+Created a new and Separate Query Object.
+ You can no longer execute queries from the Mysql object instead you have
+ to create a query object with Mysql::query() and use it to execute queries.
+\layout Itemize
+
+Added the comparison operators to MysqlDate, MysqlTime and MysqlDateTime.
+ Fixed a few bugs in the MysqlDate...
+ that effected the stream output and the conversion of them to strings.
+\layout Itemize
+
+Reflected the MysqlDate...
+ changes in the manual.
+\layout Itemize
+
+Added a new MysqlSet object and a bunch of functions for working with mysql
+ set strings.
+
+\layout Section*
+
+.60.3a (April 24 1998)
+\layout Itemize
+
+Changed strtoq and strtouq to strtoll and strtull for metter compatibility
+ Minor Manual fix.
+\layout Itemize
+
+Changed makefile to make it more compatible with Solaris (Thanks Chris H)
+\layout Itemize
+
+Fixed bug in comparison functions so that they would compare in he right
+ direction.
+\layout Itemize
+
+Added some items to the to do list be sure to have a look.
+\layout Chapter
+
+To Do
+\layout Standard
+
+These are in the order I plan on implementing them.
+\layout Itemize
+
+Improve the runtime type identification system for the sql types which will
+ be needed for the mutable results sets and the binary operators in particular.
+\layout Itemize
+
+Improve the mutable results sets so that they can be assigned types that
+ are not strings setting the sql type aproprestly.
+ Also allow the SQLtype to be fixed so that when the programmer assigned
+ a type to the data field that is not compatible with that sql type it will
+ through an exception.
+ For example setting an string to an int.
+\layout Itemize
+
+Change the behavior of MysqlString when used with binary operators.
+ Instead of converting to the type on the other side of the operator have
+ it convert to the type the Mysql server said it originally was.
+\layout Itemize
+
+Improve the Null adapters to make them more intelligently.
+\layout Itemize
+
+Be able to store the result set in an assignable container that stores the
+ results in the format they were originally stored in on the server.
+ (Not sure what the best way to go about this is.
+ If you have any ideas let me know.)
+\layout Itemize
+
+Better handling of the destruction of the Mysql class.
+ Have it first tell all its children that its parent is getting destroys
+ and have then respond appropreatly.
+ (Partly implemented as of version .63.1.a)
+\layout Itemize
+
+Create a container to hold Mysql enums and sets as a bit set as opposed
+ to a list of STL set.
+
+\layout Itemize
+
+Have a more intelligent MysqlRes that can reexecute to refresh the data.
+
+\layout Itemize
+
+Create full fledged client side cursors
+\layout Standard
+
+If you have anything else you want to see let us know at sinisa@cytanet.com.cy
+ or monty@mysql.com.
+
+\layout Chapter
+
+Credits
+\layout Standard
+
+The following is an informal list of programs and people I would like to
+ thank.
+\layout Itemize
+
+egcs - for the great compiler (egcs.cygnus.com)
+\layout Itemize
+
+Perl - for making my life in general a lot easier (www.perl.com)
+\layout Itemize
+
+Lyx - as a great tool for helping me with this manual (www.lyx.org)
+\layout Itemize
+
+perceps - As a great tool for extracting documentation from the source (friga.mer.
+utexas.edu/mark/perl/perceps/)
+\layout Itemize
+
+latex2html - For making the html version of this document possible (www-dsed.llnl.
+gov/files/programs/unix/latex2html/)
+\layout Itemize
+
+lynx - For manking the text version of this document possible.
+\layout Itemize
+
+Mysql - for obvious reasons (www.tcx.se)
+\layout Itemize
+
+Xemacs - the editor of choice
+\layout Itemize
+
+Debian/GNU Linux - The platform I developed this on (www.debian.org)
+\layout Itemize
+
+Chris Halverson - For helping me get it to compile under Solaris.
+\layout Itemize
+
+Fredric Fredricson - For a long talk about automatic conversions.
+\layout Itemize
+
+Michael Widenius - Mysql developer who has been very supportive of my efforts.
+\layout Itemize
+
+Paul J.
+ Lucas -For the original idea of treating the query object like a stream.
+\layout Itemize
+
+Scott Barron - For helping me with the shared libraries.
+\layout Itemize
+
+Jools Enticknap - For giving me the Template Queries Idea.
+\layout Itemize
+
+M.
+ S.
+ Sriram - For a detailed dission of how the Template Queries should be implement
+ed, the suggestion to throw exceptions on bad queries, and the idea of having
+ a back-end independent query object (ie SQLQuery).
+\layout Itemize
+
+Sinisa Milivojevic - For becoming the new offical maintainer.
+\layout Standard
+
+If you fell that I forgot something please let me know.
+\layout Chapter
+
+Copyright
+\layout Standard
+
+The Mysql++ API is copyright 1998 by Kevin Atkinson and 1999 by MySQL and
+ is released under the LGPL license .
+\layout Standard
+
+The intent of doing this is allow developers to use my library to develop
+ commercial programs and to allow it be distributed with commercial databases.
+\layout Section
+
+LGPL
+\layout Standard
+\align center
+GNU LIBRARY GENERAL PUBLIC LICENSE
+\newline
+Version 2, June 1991
+\layout Standard
+
+Copyright (C) 1991 Free Software Foundation, Inc.
+
+\layout Quote
+
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+\layout Standard
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+ document, but changing it is not allowed.
+\layout Standard
+
+[This is the first released version of the library GPL.
+ It is numbered 2 because it goes with version 2 of the ordinary GPL.]
+\layout Standard
+\align center
+Preamble
+\layout Standard
+
+The licenses for most software are designed to take away your freedom to
+ share and change it.
+ By contrast, the GNU General Public Licenses are intended to guarantee
+ your freedom to share and change free software--to make sure the software
+ is free for all its users.
+\layout Standard
+
+This license, the Library General Public License, applies to some specially
+ designated Free Software Foundation software, and to any other libraries
+ whose authors decide to use it.
+ You can use it for your libraries, too.
+\layout Standard
+
+When we speak of free software, we are referring to freedom, not price.
+ Our General Public Licenses are designed to make sure that you have the
+ freedom to distribute copies of free software (and charge for this service
+ if you wish), that you receive source code or can get it if you want it,
+ that you can change the software or use pieces of it in new free programs;
+ and that you know you can do these things.
+\layout Standard
+
+To protect your rights, we need to make restrictions that forbid anyone
+ to deny you these rights or to ask you to surrender the rights.
+ These restrictions translate to certain responsibilities for you if you
+ distribute copies of the library, or if you modify it.
+\layout Standard
+
+For example, if you distribute copies of the library, whether gratis or
+ for a fee, you must give the recipients all the rights that we gave you.
+ You must make sure that they, too, receive or can get the source code.
+ If you link a program with the library, you must provide complete object
+ files to the recipients so that they can relink them with the library,
+ after making changes to the library and recompiling it.
+ And you must show them these terms so they know their rights.
+\layout Standard
+
+Our method of protecting your rights has two steps: (1) copyright the library,
+ and (2) offer you this license which gives you legal permission to copy,
+ distribute and/or modify the library.
+\layout Standard
+
+Also, for each distributor's protection, we want to make certain that everyone
+ understands that there is no warranty for this free library.
+ If the library is modified by someone else and passed on, we want its recipient
+s to know that what they have is not the original version, so that any problems
+ introduced by others will not reflect on the original authors' reputations.
+\layout Standard
+
+Finally, any free program is threatened constantly by software patents.
+ We wish to avoid the danger that companies distributing free software will
+ individually obtain patent licenses, thus in effect transforming the program
+ into proprietary software.
+ To prevent this, we have made it clear that any patent must be licensed
+ for everyone's free use or not licensed at all.
+\layout Standard
+
+Most GNU software, including some libraries, is covered by the ordinary
+ GNU General Public License, which was designed for utility programs.
+ This license, the GNU Library General Public License, applies to certain
+ designated libraries.
+ This license is quite different from the ordinary one; be sure to read
+ it in full, and don't assume that anything in it is the same as in the
+ ordinary license.
+\layout Standard
+
+The reason we have a separate public license for some libraries is that
+ they blur the distinction we usually make between modifying or adding to
+ a program and simply using it.
+ Linking a program with a library, without changing the library, is in some
+ sense simply using the library, and is analogous to running a utility program
+ or application program.
+ However, in a textual and legal sense, the linked executable is a combined
+ work, a derivative of the original library, and the ordinary General Public
+ License treats it as such.
+\layout Standard
+
+Because of this blurred distinction, using the ordinary General Public License
+ for libraries did not effectively promote software sharing, because most
+ developers did not use the libraries.
+ We concluded that weaker conditions might promote sharing better.
+\layout Standard
+
+However, unrestricted linking of non-free programs would deprive the users
+ of those programs of all benefit from the free status of the libraries
+ themselves.
+ This Library General Public License is intended to permit developers of
+ non-free programs to use free libraries, while preserving your freedom
+ as a user of such programs to change the free libraries that are incorporated
+ in them.
+ (We have not seen how to achieve this as regards changes in header files,
+ but we have achieved it as regards changes in the actual functions of the
+ Library.) The hope is that this will lead to faster development of free
+ libraries.
+\layout Standard
+
+The precise terms and conditions for copying, distribution and modification
+ follow.
+ Pay close attention to the difference between a "work based on the library"
+ and a "work that uses the library".
+ The former contains code derived from the library, while the latter only
+ works together with the library.
+\layout Standard
+
+Note that it is possible for a library to be covered by the ordinary General
+ Public License rather than by this special one.
+\layout Standard
+\align center
+GNU LIBRARY GENERAL PUBLIC LICENSE
+\newline
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+\layout Standard
+
+0.
+ This License Agreement applies to any software library which contains a
+ notice placed by the copyright holder or other authorized party saying
+ it may be distributed under the terms of this Library General Public License
+ (also called "this License").
+ Each licensee is addressed as "you".
+\layout Standard
+
+A "library" means a collection of software functions and/or data prepared
+ so as to be conveniently linked with application programs (which use some
+ of those functions and data) to form executables.
+\layout Standard
+
+The "Library", below, refers to any such software library or work which
+ has been distributed under these terms.
+ A "work based on the Library" means either the Library or any derivative
+ work under copyright law: that is to say, a work containing the Library
+ or a portion of it, either verbatim or with modifications and/or translated
+ straightforwardly into another language.
+ (Hereinafter, translation is included without limitation in the term "modificat
+ion".)
+\layout Standard
+
+"Source code" for a work means the preferred form of the work for making
+ modifications to it.
+ For a library, complete source code means all the source code for all modules
+ it contains, plus any associated interface definition files, plus the scripts
+ used to control compilation and installation of the library.
+\layout Standard
+
+Activities other than copying, distribution and modification are not covered
+ by this License; they are outside its scope.
+ The act of running a program using the Library is not restricted, and output
+ from such a program is covered only if its contents constitute a work based
+ on the Library (independent of the use of the Library in a tool for writing
+ it).
+ Whether that is true depends on what the Library does and what the program
+ that uses the Library does.
+ 1.
+ You may copy and distribute verbatim copies of the Library's complete source
+ code as you receive it, in any medium, provided that you conspicuously
+ and appropriately publish on each copy an appropriate copyright notice
+ and disclaimer of warranty; keep intact all the notices that refer to this
+ License and to the absence of any warranty; and distribute a copy of this
+ License along with the Library.
+\layout Standard
+
+You may charge a fee for the physical act of transferring a copy, and you
+ may at your option offer warranty protection in exchange for a fee.
+\layout Standard
+
+2.
+ You may modify your copy or copies of the Library or any portion of it,
+ thus forming a work based on the Library, and copy and distribute such
+ modifications or work under the terms of Section 1 above, provided that
+ you also meet all of these conditions:
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+a) The modified work must itself be a software library.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+b) You must cause the files modified to carry prominent notices stating
+ that you changed the files and the date of any change.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+c) You must cause the whole of the work to be licensed at no charge to all
+ third parties under the terms of this License.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+d) If a facility in the modified Library refers to a function or a table
+ of data to be supplied by an application program that uses the facility,
+ other than as an argument passed when the facility is invoked, then you
+ must make a good faith effort to ensure that, in the event an application
+ does not supply such function or table, the facility still operates, and
+ performs whatever part of its purpose remains meaningful.
+\layout Standard
+
+(For example, a function in a library to compute square roots has a purpose
+ that is entirely well-defined independent of the application.
+ Therefore, Subsection 2d requires that any application-supplied function
+ or table used by this function must be optional: if the application does
+ not supply it, the square root function must still compute square roots.)
+\layout Standard
+
+These requirements apply to the modified work as a whole.
+ If identifiable sections of that work are not derived from the Library,
+ and can be reasonably considered independent and separate works in themselves,
+ then this License, and its terms, do not apply to those sections when you
+ distribute them as separate works.
+ But when you distribute the same sections as part of a whole which is a
+ work based on the Library, the distribution of the whole must be on the
+ terms of this License, whose permissions for other licensees extend to
+ the entire whole, and thus to each and every part regardless of who wrote
+ it.
+\layout Standard
+
+Thus, it is not the intent of this section to claim rights or contest your
+ rights to work written entirely by you; rather, the intent is to exercise
+ the right to control the distribution of derivative or collective works
+ based on the Library.
+\layout Standard
+
+In addition, mere aggregation of another work not based on the Library with
+ the Library (or with a work based on the Library) on a volume of a storage
+ or distribution medium does not bring the other work under the scope of
+ this License.
+\layout Standard
+
+3.
+ You may opt to apply the terms of the ordinary GNU General Public License
+ instead of this License to a given copy of the Library.
+ To do this, you must alter all the notices that refer to this License,
+ so that they refer to the ordinary GNU General Public License, version
+ 2, instead of to this License.
+ (If a newer version than version 2 of the ordinary GNU General Public License
+ has appeared, then you can specify that version instead if you wish.) Do
+ not make any other change in these notices.
+\layout Standard
+
+Once this change is made in a given copy, it is irreversible for that copy,
+ so the ordinary GNU General Public License applies to all subsequent copies
+ and derivative works made from that copy.
+\layout Standard
+
+This option is useful when you wish to copy part of the code of the Library
+ into a program that is not a library.
+\layout Standard
+
+4.
+ You may copy and distribute the Library (or a portion or derivative of
+ it, under Section 2) in object code or executable form under the terms
+ of Sections 1 and 2 above provided that you accompany it with the complete
+ corresponding machine-readable source code, which must be distributed under
+ the terms of Sections 1 and 2 above on a medium customarily used for software
+ interchange.
+\layout Standard
+
+If distribution of object code is made by offering access to copy from a
+ designated place, then offering equivalent access to copy the source code
+ from the same place satisfies the requirement to distribute the source
+ code, even though third parties are not compelled to copy the source along
+ with the object code.
+\layout Standard
+
+5.
+ A program that contains no derivative of any portion of the Library, but
+ is designed to work with the Library by being compiled or linked with it,
+ is called a "work that uses the Library".
+ Such a work, in isolation, is not a derivative work of the Library, and
+ therefore falls outside the scope of this License.
+\layout Standard
+
+However, linking a "work that uses the Library" with the Library creates
+ an executable that is a derivative of the Library (because it contains
+ portions of the Library), rather than a "work that uses the library".
+ The executable is therefore covered by this License.
+ Section 6 states terms for distribution of such executables.
+\layout Standard
+
+When a "work that uses the Library" uses material from a header file that
+ is part of the Library, the object code for the work may be a derivative
+ work of the Library even though the source code is not.
+ Whether this is true is especially significant if the work can be linked
+ without the Library, or if the work is itself a library.
+ The threshold for this to be true is not precisely defined by law.
+\layout Standard
+
+If such an object file uses only numerical parameters, data structure layouts
+ and accessors, and small macros and small inline functions (ten lines or
+ less in length), then the use of the object file is unrestricted, regardless
+ of whether it is legally a derivative work.
+ (Executables containing this object code plus portions of the Library will
+ still fall under Section 6.)
+\layout Standard
+
+Otherwise, if the work is a derivative of the Library, you may distribute
+ the object code for the work under the terms of Section 6.
+ Any executables containing that work also fall under Section 6, whether
+ or not they are linked directly with the Library itself.
+\layout Standard
+
+6.
+ As an exception to the Sections above, you may also compile or link a "work
+ that uses the Library" with the Library to produce a work containing portions
+ of the Library, and distribute that work under terms of your choice, provided
+ that the terms permit modification of the work for the customer's own use
+ and reverse engineering for debugging such modifications.
+\layout Standard
+
+You must give prominent notice with each copy of the work that the Library
+ is used in it and that the Library and its use are covered by this License.
+ You must supply a copy of this License.
+ If the work during execution displays copyright notices, you must include
+ the copyright notice for the Library among them, as well as a reference
+ directing the user to the copy of this License.
+ Also, you must do one of these things:
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+a) Accompany the work with the complete corresponding machine-readable source
+ code for the Library including whatever changes were used in the work (which
+ must be distributed under Sections 1 and 2 above); and, if the work is
+ an executable linked with the Library, with the complete machine-readable
+ "work that uses the Library", as object code and/or source code, so that
+ the user can modify the Library and then relink to produce a modified executabl
+e containing the modified Library.
+ (It is understood that the user who changes the contents of definitions
+ files in the Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+b) Accompany the work with a written offer, valid for at least three years,
+ to give the same user the materials specified in Subsection 6a, above,
+ for a charge no more than the cost of performing this distribution.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+c) If distribution of the work is made by offering access to copy from a
+ designated place, offer equivalent access to copy the above specified materials
+ from the same place.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+d) Verify that the user has already received a copy of these materials or
+ that you have already sent this user a copy.
+\layout Standard
+
+For an executable, the required form of the "work that uses the Library"
+ must include any data and utility programs needed for reproducing the executabl
+e from it.
+ However, as a special exception, the source code distributed need not include
+ anything that is normally distributed (in either source or binary form)
+ with the major components (compiler, kernel, and so on) of the operating
+ system on which the executable runs, unless that component itself accompanies
+ the executable.
+\layout Standard
+
+It may happen that this requirement contradicts the license restrictions
+ of other proprietary libraries that do not normally accompany the operating
+ system.
+ Such a contradiction means you cannot use both them and the Library together
+ in an executable that you distribute.
+\layout Standard
+
+7.
+ You may place library facilities that are a work based on the Library side-by-s
+ide in a single library together with other library facilities not covered
+ by this License, and distribute such a combined library, provided that
+ the separate distribution of the work based on the Library and of the other
+ library facilities is otherwise permitted, and provided that you do these
+ two things:
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+a) Accompany the combined library with a copy of the same work based on
+ the Library, uncombined with any other library facilities.
+ This must be distributed under the terms of the Sections above.
+\layout Standard
+\pextra_type 1 \pextra_width 0.5in
+
+b) Give prominent notice with the combined library of the fact that part
+ of it is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+\layout Standard
+
+8.
+ You may not copy, modify, sublicense, link with, or distribute the Library
+ except as expressly provided under this License.
+ Any attempt otherwise to copy, modify, sublicense, link with, or distribute
+ the Library is void, and will automatically terminate your rights under
+ this License.
+ However, parties who have received copies, or rights, from you under this
+ License will not have their licenses terminated so long as such parties
+ remain in full compliance.
+\layout Standard
+
+9.
+ You are not required to accept this License, since you have not signed
+ it.
+ However, nothing else grants you permission to modify or distribute the
+ Library or its derivative works.
+ These actions are prohibited by law if you do not accept this License.
+ Therefore, by modifying or distributing the Library (or any work based
+ on the Library), you indicate your acceptance of this License to do so,
+ and all its terms and conditions for copying, distributing or modifying
+ the Library or works based on it.
+\layout Standard
+
+10.
+ Each time you redistribute the Library (or any work based on the Library),
+ the recipient automatically receives a license from the original licensor
+ to copy, distribute, link with or modify the Library subject to these terms
+ and conditions.
+ You may not impose any further restrictions on the recipients' exercise
+ of the rights granted herein.
+ You are not responsible for enforcing compliance by third parties to this
+ License.
+\layout Standard
+
+11.
+ If, as a consequence of a court judgment or allegation of patent infringement
+ or for any other reason (not limited to patent issues), conditions are
+ imposed on you (whether by court order, agreement or otherwise) that contradict
+ the conditions of this License, they do not excuse you from the conditions
+ of this License.
+ If you cannot distribute so as to satisfy simultaneously your obligations
+ under this License and any other pertinent obligations, then as a consequence
+ you may not distribute the Library at all.
+ For example, if a patent license would not permit royalty-free redistribution
+ of the Library by all those who receive copies directly or indirectly through
+ you, then the only way you could satisfy both it and this License would
+ be to refrain entirely from distribution of the Library.
+\layout Standard
+
+If any portion of this section is held invalid or unenforceable under any
+ particular circumstance, the balance of the section is intended to apply,
+ and the section as a whole is intended to apply in other circumstances.
+\layout Standard
+
+It is not the purpose of this section to induce you to infringe any patents
+ or other property right claims or to contest validity of any such claims;
+ this section has the sole purpose of protecting the integrity of the free
+ software distribution system which is implemented by public license practices.
+ Many people have made generous contributions to the wide range of software
+ distributed through that system in reliance on consistent application of
+ that system; it is up to the author/donor to decide if he or she is willing
+ to distribute software through any other system and a licensee cannot impose
+ that choice.
+\layout Standard
+
+This section is intended to make thoroughly clear what is believed to be
+ a consequence of the rest of this License.
+\layout Standard
+
+12.
+ If the distribution and/or use of the Library is restricted in certain
+ countries either by patents or by copyrighted interfaces, the original
+ copyright holder who places the Library under this License may add an explicit
+ geographical distribution limitation excluding those countries, so that
+ distribution is permitted only in or among countries not thus excluded.
+ In such case, this License incorporates the limitation as if written in
+ the body of this License.
+\layout Standard
+
+13.
+ The Free Software Foundation may publish revised and/or new versions of
+ the Library General Public License from time to time.
+ Such new versions will be similar in spirit to the present version, but
+ may differ in detail to address new problems or concerns.
+\layout Standard
+
+Each version is given a distinguishing version number.
+ If the Library specifies a version number of this License which applies
+ to it and "any later version", you have the option of following the terms
+ and conditions either of that version or of any later version published
+ by the Free Software Foundation.
+ If the Library does not specify a license version number, you may choose
+ any version ever published by the Free Software Foundation.
+\layout Standard
+
+14.
+ If you wish to incorporate parts of the Library into other free programs
+ whose distribution conditions are incompatible with these, write to the
+ author to ask for permission.
+ For software which is copyrighted by the Free Software Foundation, write
+ to the Free Software Foundation; we sometimes make exceptions for this.
+ Our decision will be guided by the two goals of preserving the free status
+ of all derivatives of our free software and of promoting the sharing and
+ reuse of software generally.
+\layout Standard
+\align center
+NO WARRANTY
+\layout Standard
+
+15.
+ BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+ THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
+ PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+ EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH
+ YOU.
+ SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
+ SERVICING, REPAIR OR CORRECTION.
+\layout Standard
+
+16.
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
+ THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
+ ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
+ THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS
+ OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
+ THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGES.
+\layout Standard
+\align center
+END OF TERMS AND CONDITIONS
+\layout Standard
+\align center
+How to Apply These Terms to Your New Libraries
+\layout Standard
+
+If you develop a new library, and you want it to be of the greatest possible
+ use to the public, we recommend making it free software that everyone can
+ redistribute and change.
+ You can do so by permitting redistribution under these terms (or, alternatively
+, under the terms of the ordinary General Public License).
+\layout Standard
+
+To apply these terms, attach the following notices to the library.
+ It is safest to attach them to the start of each source file to most effectivel
+y convey the exclusion of warranty; and each file should have at least the
+ "copyright" line and a pointer to where the full notice is found.
+\layout Quote
+
+
+\newline
+Copyright (C)
+\layout Quote
+
+This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2 of the License, or (at
+ your option) any later version.
+\layout Quote
+
+This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE.
+ See the GNU Library General Public License for more details.
+\layout Quote
+
+You should have received a copy of the GNU Library General Public License
+ along with this library; if not, write to the Free Foundation, Inc., 59
+ Temple Place, Suite 330, Boston, MA 02111-1307 USA
+\layout Standard
+
+Also add information on how to contact you by electronic and paper mail.
+\layout Standard
+
+You should also get your employer (if you work as a programmer) or your
+ school, if any, to sign a "copyright disclaimer" for the library, if necessary.
+ Here is a sample; alter the names:
+\layout Quote
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob'
+ (a library for tweaking knobs) written by James Random Hacker.
+\layout Quote
+
+, 1 April 1990 Ty Coon, President of Vice
+\layout Standard
+
+That's all there is to it!
+\layout Chapter
+
+Feedback
+\layout Standard
+
+Since October 1999, all maintenance has been transferred to Sinisa Milivojevic
+ (sinisa@cytanet.com.cy) and Michael Widenius (monty@mysql.com).
+\layout Standard
+
+Send your feedback to any of these addresses, or even better to the mailing
+ list mysql-plusplus@lists.mysql.com.
+\the_end
ADDED doc/pretty.pl
Index: doc/pretty.pl
==================================================================
--- /dev/null
+++ doc/pretty.pl
@@ -0,0 +1,75 @@
+use FileHandle;
+use IPC::Open2;
+
+if ($ARGV[0] =~ /^--command\=(.+)/) {
+ $command = $1;
+} else {
+ $command = "g++ -E";
+}
+
+$/ = undef;
+$orgcode = ;
+
+($macro) = $orgcode =~ /(sql_create_.+? *\(.+?\))/s;
+
+$out = << "---";
+
+#include
+
+$macro
+
+---
+
+$/ = "\n";
+
+$temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
+
+#print $out;
+
+open OUT, ">$temp_dir/${$}.cc";
+print OUT $out;
+close OUT;
+
+system "$command $temp_dir/${$}.cc > $temp_dir/${$}.ii";
+
+open IN, "$temp_dir/${$}.ii";
+while () {
+ next if /^\#/;
+ $code .= $_;
+}
+close IN;
+
+unlink "$temp_dir/${$}.cc","$temp_dir/${$}.ii";
+
+$_ = $code;
+s/\s+/ /g;
+s/ *public: */public:\n/g;
+s/ *private: */public:\n/g;
+s/ *\; */\;\n/g;
+s/ *\{ */ \{\n/g;
+s/ *\} */ \}\n\n/g;
+s/ *\n */\n/g;
+s/\{\s+}/\{\}/g;
+s/\}\s+\;/\}\;\n/g;
+
+$code = "";
+foreach (split /\n/) {
+ if (/\}/ && !/\{\}/ ) {
+ $indent -= 2;
+ $ind = ' 'x$indent;
+ }
+ $code .= "$ind$_\n" unless /\:$/;
+ $code .= "$_\n" if /\:$/;
+ if (/\{/ && !/\{\}/ ) {
+ $indent += 2;
+ $ind = ' 'x$indent;
+ }
+}
+
+$orgcode =~ s/(sql_create_.+? *\(.+?\))/\n$code\n/s;
+
+print $orgcode;
+
+
+
+
ADDED doc/sql++pretty
Index: doc/sql++pretty
==================================================================
--- /dev/null
+++ doc/sql++pretty
@@ -0,0 +1,75 @@
+use FileHandle;
+use IPC::Open2;
+
+if ($ARGV[0] =~ /^--command\=(.+)/) {
+ $command = $1;
+} else {
+ $command = "g++ -E";
+}
+
+$/ = undef;
+$orgcode = ;
+
+($macro) = $orgcode =~ /(sql_create_.+? *\(.+?\))/s;
+
+$out = << "---";
+
+#include
+
+$macro
+
+---
+
+$/ = "\n";
+
+$temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
+
+#print $out;
+
+open OUT, ">$temp_dir/${$}.cc";
+print OUT $out;
+close OUT;
+
+system "$command $temp_dir/${$}.cc > $temp_dir/${$}.ii";
+
+open IN, "$temp_dir/${$}.ii";
+while () {
+ next if /^\#/;
+ $code .= $_;
+}
+close IN;
+
+unlink "$temp_dir/${$}.cc","$temp_dir/${$}.ii";
+
+$_ = $code;
+s/\s+/ /g;
+s/ *public: */public:\n/g;
+s/ *private: */public:\n/g;
+s/ *\; */\;\n/g;
+s/ *\{ */ \{\n/g;
+s/ *\} */ \}\n\n/g;
+s/ *\n */\n/g;
+s/\{\s+}/\{\}/g;
+s/\}\s+\;/\}\;\n/g;
+
+$code = "";
+foreach (split /\n/) {
+ if (/\}/ && !/\{\}/ ) {
+ $indent -= 2;
+ $ind = ' 'x$indent;
+ }
+ $code .= "$ind$_\n" unless /\:$/;
+ $code .= "$_\n" if /\:$/;
+ if (/\{/ && !/\{\}/ ) {
+ $indent += 2;
+ $ind = ' 'x$indent;
+ }
+}
+
+$orgcode =~ s/(sql_create_.+? *\(.+?\))/\n$code\n/s;
+
+print $orgcode;
+
+
+
+
DELETED doc/ssqls-pretty
Index: doc/ssqls-pretty
==================================================================
--- doc/ssqls-pretty
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/perl
-use FileHandle;
-use IPC::Open2;
-
-if ($ARGV[0] =~ /^--command\=(.+)/) {
- $command = $1;
-} else {
- $command = "g++ -E";
-}
-
-if (-e 'lib/mysql++.h') {
- $command .= " -I lib";
-}
-else {
- $command .= " -I /usr/include/mysql++/";
-}
-
-$/ = undef;
-$orgcode = ;
-
-($macro) = $orgcode =~ /(sql_create_.+? *\(.+?\))/s;
-
-$out = << "---";
-
-#include
-
-$macro
-
----
-
-$/ = "\n";
-
-$temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
-
-#print $out;
-
-open OUT, ">$temp_dir/${$}.cc";
-print OUT $out;
-close OUT;
-
-system "$command $temp_dir/${$}.cc > $temp_dir/${$}.ii";
-
-open IN, "$temp_dir/${$}.ii";
-while () {
- next if /^\#/;
- $code .= $_;
-}
-close IN;
-
-unlink "$temp_dir/${$}.cc","$temp_dir/${$}.ii";
-
-$_ = $code;
-s/\s+/ /g;
-s/ *public: */public:\n/g;
-s/ *private: */public:\n/g;
-s/ *\; */\;\n/g;
-s/ *\{ */ \{\n/g;
-s/ *\} */ \}\n\n/g;
-s/ *\n */\n/g;
-s/\{\s+}/\{\}/g;
-s/\}\s+\;/\}\;\n/g;
-
-$code = "";
-foreach (split /\n/) {
- if (/\}/ && !/\{\}/ ) {
- $indent -= 2;
- $ind = ' 'x$indent;
- }
- $code .= "$ind$_\n" unless /\:$/;
- $code .= "$_\n" if /\:$/;
- if (/\{/ && !/\{\}/ ) {
- $indent += 2;
- $ind = ' 'x$indent;
- }
-}
-
-$orgcode =~ s/(sql_create_.+? *\(.+?\))/\n$code\n/s;
-
-print $orgcode;
-
-
-
-
DELETED doc/userman/LICENSE
Index: doc/userman/LICENSE
==================================================================
--- doc/userman/LICENSE
+++ /dev/null
@@ -1,59 +0,0 @@
-MySQL++ User Manual License
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-I. COPYRIGHT
-
- The copyright to the MySQL++ User Manual is owned by its authors.
-
-
-II. LICENSE
-
- The MySQL++ User Manual may be reproduced and distributed in whole
- or in part, in any medium physical or electronic, provided that
- this license notice is displayed in the reproduction. Commercial
- redistribution is permitted and encouraged. Thirty days advance
- notice via email to the authors of redistribution is appreciated,
- to give the authors time to provide updated documents.
-
-
- A. REQUIREMENTS OF MODIFIED WORKS
-
- All modified documents, including translations,
- anthologies, and partial documents, must meet the
- following requirements:
-
- 1. The modified version must be labeled as such.
-
- 2. The person making the modifications must be
- identified.
-
- 3. Acknowledgement of the original author must be
- retained.
-
- 4. The location of the original unmodified
- document be identified.
-
- 5. The original authors' names may not be used
- to assert or imply endorsement of the
- resulting document without the original
- authors' permission.
-
- In addition it is requested that:
-
- 1. The modifications (including deletions)
- be noted.
-
- 2. The authors be notified by email of the
- modification in advance of redistribution,
- if an email address is provided in
- the document.
-
- Mere aggregation of the MySQL++ User Manual with other
- documents or programs on the same media shall not cause
- this license to apply to those other works.
-
- All translations, derivative documents, or modified
- documents that incorporate the MySQL++ User Manual may
- not have more restrictive license terms than these,
- except that you may require distributors to make the
- resulting document available in source format.
DELETED doc/userman/Makefile
Index: doc/userman/Makefile
==================================================================
--- doc/userman/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-## ------------------------
-## Things you may need to diddle for your local system
-## ------------------------
-
-FOPDIR=/usr/local/fop
-
-
-## ------------------------
-## Input files
-## ------------------------
-
-HTML_DIR=../html/userman
-BASENAME=userman
-DOCFILE=$(BASENAME).dbx
-PDFFILE=$(BASENAME).pdf
-FOFILE=$(BASENAME).fo
-COMMON_SS=common.xsl
-FO_SS=fo.xsl
-HTML_SS=html.xsl
-EX_TXT=cgi_jpeg.txt custom1.txt custom2.txt custom3.txt custom4.txt \
- custom5.txt custom6.txt fieldinf1.txt for_each.txt load_jpeg.txt \
- resetdb.txt simple1.txt simple2.txt simple3.txt stock.txt \
- store_if.txt tquery.txt xaction.txt
-
-
-## ------------------------
-## Major output rules
-## ------------------------
-
-html: $(HTML_DIR)/index.html
-
-pdf: $(PDFFILE)
-
-
-## ------------------------
-## Standard Makefile targets
-## ------------------------
-
-# Notice that this is not the first target in the file, as is standard.
-# PDF generation takes longer than HTML generation, so to keep the code-
-# test-debug-rebuild cycle short, we generate only the HTML manual by
-# default. You can explicitly say "make pdf" or "make all" when you're
-# sure the DocBook file's contents are correct.
-all: html pdf
-
-clean:
- rm -f tags *.fo $(HTML_DIR)/*.html *.log *.out *.pdf *.txt
-
-
-## ------------------------
-## How to make output files
-## ------------------------
-
-$(PDFFILE): $(DOCFILE) $(FO_SS) $(COMMON_SS)
- xsltproc --xinclude $(FO_SS) $(DOCFILE) > $(FOFILE)
- $(FOPDIR)/fop -q -fo $(FOFILE) $(PDFFILE)
- cp $(PDFFILE) ../pdf
-
-$(HTML_DIR)/index.html: $(DOCFILE) $(EX_TXT) $(HTML_SS) $(COMMON_SS)
- @xmllint --xinclude --postvalid --noent --noout $(DOCFILE)
- xsltproc --xinclude -o $(HTML_DIR)/ $(HTML_SS) $(DOCFILE)
-
-
-## ------------------------
-## Dependency rules
-## ------------------------
-
-$(EX_TXT):
- @./mktxt $@
DELETED doc/userman/README
Index: doc/userman/README
==================================================================
--- doc/userman/README
+++ /dev/null
@@ -1,128 +0,0 @@
-The user manual is written in XML DocBook format, version 4.2.
-It uses the official DocBook XSL stylesheets, and will build with
-versions as old as 1.58.1. (Why these versions? They're what comes
-with Red Hat Linux 9, the oldest system I still use.) We restrict
-ourselves to Simplified DocBook 1.1 as much as practical, to make it
-easier for new people to get started hacking on the manual.
-
-To make the HTML version of the user manual, just type 'make' in this
-directory. (Or 'make html' if you want to be pedantic.) To make the
-PDF version of the manual, say 'make pdf'. To make both versions,
-say 'make all'.
-
-
-
-The most likely cause of build failures is not having the right
-processing programs installed. The DocBook processing model looks
-like this:
-
- DocBook --[XSLT proc.]-+-> HTML
- ^ |
- | +-> XSL-FO --[XSL-FO proc.]--> PDF
- |
- {XSL stylesheets}
-
-"DocBook" above is a file in DocBook XML format. In this case,
-it's in userman.dbx.
-
-There are many alternatives for the tools in the square brackets:
-
- The first replaceable piece is an XSLT processor, which
- translates XML into other text formats, such as HTML or other
- varieties of XML. We use xsltproc from the Gnome project.
- (http://xmlsoft.org/XSLT/) There are numerous alternatives,
- but each supports different extensions to the standard,
- so it's simplest if everyone uses the same processor for a
- given document.
-
- We use the XSLT processor to do two transforms. One is
- directly to HTML. The other is to XSL-FO, an XML-based page
- layout language. We do this intermediary transform because
- XSLT is not good at creating binary formats like PDF.
-
- The second replaceable piece in the diagram above is an
- XSL-FO processor, which converts XSL-FO to a more directly
- useful page layout format, like PDF. We've chosen FOP from
- the Apache Project (http://xml.apache.org/fop/), because it's
- the best of the free-as-in-freedom XSL-FO processors.
-
- FOP isn't without its faults. If you'd like to try some of
- the commercial XSL-FO processors, RenderX's XEP (renderx.com)
- is avalable in a free-as-in-beer version that adds watermarks
- to your pages. Another popular option is Antenna House's XSL
- Formatter (antennahouse.com), but there is no free offering.
- The low-end commercial version of each of these is around $300.
- Another relatively inexpensive option is Lunasil's Xinc
- (lunasil.com), which is available in a personal-use edition
- for under $100.
-
-The third replaceable piece above is the DocBook XSL stylesheet set.
-The stylesheets are the XSLT processor's rules, controlling how
-the input XML gets transformed to the output format. The standard
-DocBook stylesheet set (link below) includes stylesheets for HTML
-and XSL-FO output. If you don't have them on your system, the XSLT
-processor will try to download them using your Internet connection
-during processing. This slows processing quite a bit even if you
-have a fast Internet connection, and it obviously doesn't work when
-your net connection is down.
-
-A better option is to have a copy of the stylesheets on your system.
-It's likely that there is a pre-built package for your system:
-
- Red Hat Linux: docbook-style-xsl RPM (same for Fedora Core)
- Mac OS X: docbook-xsl Fink package (http://fink.sf.net)
- Cygwin: docbook-xml?? package (?? = DocBook version)
-
-(Please send the name of the package for your system to the mailing
-list if it isn't listed above, and I'll add it to the list.)
-
-If you can't find a package for your system, you can get the DocBook
-stylesheets from the source: http://docbook.sourceforge.net/ They're
-a bit tricky to set up correctly, so it's better to use a pre-built
-package if you can.
-
-If you are still having problems, post the details about it to the
-MySQL++ mailing list, and I'll try to help you debug the problem.
-You might also find the FOP and/or DocBook mailing lists helpful.
-
-
-
-
-If you're looking to hack on the manual, here are some helpful resources
-for getting up to speed on DocBook:
-
- Mills' "Installing And Using An XML/SGML DocBook Editing Suite" article:
-
- http://tinyurl.com/8alb2
-
- This is the best tutorial I've found.
-
-
- Walsh and Muellner's _Simplified DocBook: The Definitive Guide_ book:
-
- http://www.docbook.org/tdg/simple/en/html/sdocbook.html
-
- This is the most accessible reference.
-
-
- Walsh and Muellner's _DocBook: The Definitive Guide_ book, second
- edition, online version:
-
- http://www.docbook.org/tdg/en/html/docbook.html
-
- This is the official DocBook referece; the "Simplified" guide is a
- subset of this book.
-
-
- DocBook FAQ:
-
- http://www.dpawson.co.uk/docbook/
-
- Go here when you have a question that the tutorials and references
- do not answer.
-
-
- The official DocBook site:
-
- http://docbook.org/
-
DELETED doc/userman/common.xsl
Index: doc/userman/common.xsl
==================================================================
--- doc/userman/common.xsl
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED doc/userman/fo.xsl
Index: doc/userman/fo.xsl
==================================================================
--- doc/userman/fo.xsl
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED doc/userman/html.xsl
Index: doc/userman/html.xsl
==================================================================
--- doc/userman/html.xsl
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- http://dev.mysql.com/doc/mysql/en/
-
- .html
-
-
- ()
-
-
-
-
-
-
-
-
-
- ../refman/classmysqlpp_1_1
-
- .html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ../refman/structmysqlpp_1_1
-
- .html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
DELETED doc/userman/mktxt
Index: doc/userman/mktxt
==================================================================
--- doc/userman/mktxt
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-# Script to convert C++ source files to a text format, with 4 spaces for
-# every tab, and with the leading block comment removed. Used to
-# reformat the example programs so they can be xincluded directly into
-# the DocBook during XSLT processing.
-
-TXTFILE=$1
-SRCFILE=`echo ../../examples/$TXTFILE | sed -e s/\\\\.txt/.cpp/`
-if [ ! -e $SRCFILE ]
-then
- SRCFILE=`echo ../../examples/$TXTFILE | sed -e s/\\\\.txt/.h/`
-fi
-CLINE=`grep -n '\*\*/' $SRCFILE |cut -f1 -d:`
-LINE=`echo $CLINE + 2 |bc`
-
-#echo Converting $SRCFILE to $TXTFILE, starting at line $LINE...
-
-expand -t4 $SRCFILE | tail -n +$LINE > $TXTFILE
-
DELETED doc/userman/userman.dbx
Index: doc/userman/userman.dbx
==================================================================
--- doc/userman/userman.dbx
+++ /dev/null
@@ -1,3234 +0,0 @@
-
-
-
-
-
- MySQL++ User Manual
-
-
-
- Kevin
- Atkinson
-
-
-
- Sinisa
- Milivojevic
-
-
-
- Monty
- Widenius
-
-
-
- Warren
- Young
-
-
-
-
- 1998-2001, 2005-2007
- Kevin Atkinson (original author)
- MySQL AB
- Educational Technology Resources
-
-
- $Date: 2007-06-28 00:17:10 -0600 (Thu, 28 Jun 2007) $
-
-
-
-
- Introduction
-
- MySQL++ is a powerful C++ wrapper for MySQL's C API.
- Its purpose is to make working with queries as easy as working
- with STL containers.
-
- The latest version of MySQL++ can be found at
- the official web
- site.
-
- Support for MySQL++ can be had on the mailing
- list. That page hosts the mailing list archives, and
- tells you how you can subscribe.
-
-
-
- A Brief History of MySQL++
-
- MySQL++ was created in 1998 by Kevin Atkinson. It
- started out MySQL-specific, but there were early efforts to
- try and make it database-independent, and call it SQL++. This
- is where the old library name "sqlplus" came from. This is
- also why the old versions prefixed some class names with
- "Mysql" but not others: the others were supposed to be the
- database-independent parts.
-
- Then in 1999, Sinisa Milivojevic unofficially
- took over maintenance of the library, releasing versions
- 1.0 and 1.1. (All of Kevin's releases were pre-1.0 point
- releases.) Kevin gave over maintenance to Sinisa officially
- with 1.2, and ceased to have any involvement with the library's
- maintenance. Sinisa went on to maintain the library through
- 1.7.9, released in mid-2001. Since Sinisa is an employee of
- MySQL AB, it seems
- to be during this time that the dream of multiple-database
- compatibility died.
-
- With version 1.7.9, MySQL++ went into a period of stasis,
- lasting over three years. During this time, Sinisa ran the
- MySQL++ mailing list and supported its users, but made no
- new releases. There were many patches submitted during this
- period, some of which were ignored, others which were just
- put on the MySQL++ web site for people to try. A lot of these
- patches were mutually-incompatible, and not all of them gave
- a fully-functional copy of MySQL++.
-
- In early August of 2004, the current maintainer (Warren
- Young) got fed up with this situation and took over. He
- released 1.7.10 later that month.
-
-
-
-
- If You Have Questions...
-
- If you want to email someone to ask questions about
- this library, we greatly prefer that you send mail to the
- MySQL++ mailing
- list. The mailing list is archived, so if you have
- questions, do a search to see if the question has been asked
- before.
-
- You may find people's individual email addresses in
- various files within the MySQL++ distribution. Please do not
- send mail to them unless you are sending something that is
- inherently personal. Not all of the principal developers of
- MySQL++ are still active in its development; those who have
- dropped out have no wish to be bugged about MySQL++. Those of
- us still active in MySQL++ development monitor the mailing
- list, so you aren't getting any extra "coverage" by sending
- messages to additional email addresses.
-
-
-
-
-
- Overview
-
- MySQL++ has developed into a very complex and powerful
- library, with many different ways to accomplish the same
- task. Unfortunately, this means that figuring out how to perform
- a simple task can be frustrating for new users. In this section
- we will provide an overview of the most important user-facing
- components of the library.
-
- The overall process for using MySQL++ is similar to that
- of most other database access APIs:
-
-
- Open the connection
- Form and execute the query
- Iterate through the result
- setGo to 2
- :)
-
-
- There is, however, a lot of extra functionality along each
- step of the way.
-
-
-
- The Connection Object
-
- A object
- manages the connection to the MySQL server. You need at
- least one of these objects to do anything. Because the
- other MySQL++ objects your program will use often depend (at
- least indirectly) on the Connection
- instance, the Connection object needs
- to live at least as long as all other MySQL++ objects in
- your program.
-
-
-
-
- The Query Object
-
- Most often, you create SQL queries using a object created by the
- Connection object.
-
- Query is subclassed
- from std::stringstream
- which means you can write to it like any other
- C++ stream to form a query. The library includes
- stream
- manipulators that make it easy to generate
- syntactically-correct SQL.
-
- You can also set up with
- this class. Template queries work something like C's
- printf() function: you set up a fixed
- query string with tags inside that indicate where to insert
- the variable parts. If you have multiple queries that are
- structurally similar, you simply set up one template query,
- and use that in the various locations of your program.
-
- A third method for building queries is to use
- Query with
- (SSQLS). This feature presents your results as a C++ data
- structure, instead of making you access the data through
- MySQL++ intermediary classes. It also reduces the amount of
- embedded SQL code your program needs.
-
-
-
-
- Result Sets
-
- The field data in a result set are stored in a special
- std::string-like class called ColData.
- This class has conversion operators that let you
- automatically convert these objects to any of the basic C
- data types. Additionally, MySQL++ defines classes like , which you can initialize
- from a MySQL DATETIME string. These
- automatic conversions are protected against bad conversions,
- and can either set a warning flag or throw an exception,
- depending on how you set the library up.
-
- As for the result sets as a whole, MySQL++ has a number
- of different ways of representing them:
-
-
- Queries That Do Not Return Data
-
- Not all SQL queries return data. An example is
- CREATE TABLE. For these types
- of queries, there is a special result type () that simply reports the
- state resulting from the query: whether the query was
- successful, how many rows it impacted (if any), etc.
-
-
-
- Queries That Return Data: Dynamic Method
-
- The easiest way to retrieve data from MySQL
- uses a object,
- which includes one or more objects. Because these classes are
- std::vector-like containers, you
- can treat the result set as a two-dimensional array. For
- example, you can get the 5th item on the 2nd row by simply
- saying result.at(1).at(4). You
- can also access row elements by field name, like this:
- result.at(2)["price"].
-
- An alternate way of accessing your query results
- is through a
- object. This class acts more like an STL input iterator
- than a container: you walk through your result set one item
- at a time, always going forward. You can't seek around in
- the result set, and you can't know how many results are
- in the set until you find the end. This method is more
- efficient when there can be arbitrarily many results,
- which could pose a memory allocation problem with the
- previous technique.
-
-
-
- Queries That Return Data: Static Method
-
- The (SSQLS) feature
- method above defines C++ structures that match the table
- structures in your database schema.
-
- We call it the "static" method because the table
- structure is fixed at compile time. Indeed, some schema
- changes require that you update your SSQLS definitions
- and recompile, or else the program could crash or throw
- "bad conversion" exceptions when MySQL++ tries to stuff
- the new data into an outdated data structure. (Not all
- changes require a recompile. Adding a column to a table
- is safe, for instance, as the program will ignore the
- new column until you update the SSQLS definition.)
-
- The advantage of this method is that your program
- will require very little embedded SQL code. You can
- simply execute a query, and receive your results as C++
- data structures, which can be accessed just as you would
- any other structure. The results can be accessed through
- the Row object, or you can ask the library to dump the
- results into a sequential or set-associative STL container
- for you. Consider this:
-
-
-vector<mystruct> v;
-Query q = connection.query();
-q << "SELECT * FROM mytable";
-q.storein(v);
-for (vector<mystruct>::iterator it = v.begin(); it != v.end(); ++it) {
- cout << "Price: " << it->price << endl;
-}
-
- Isn't that slick?
-
-
-
-
-
- Exceptions
-
- By default, the library throws whenever it encounters an error. You
- can ask the library to set an error flag instead, if you
- like, but the exceptions carry more information. Not only do
- they include a string member telling you why the exception
- was thrown, there are several exception types, so you can
- distinguish between different error types within a single
- try block.
-
-
-
-
-
- Tutorial
-
- This tutorial is meant to give you a jump start in using
- MySQL++. While it is a very complicated and powerful library,
- it's possible to make quite functional programs without tapping
- but a fraction of its power. This section will introduce you to
- the most useful fraction.
-
- This tutorial assumes you know C++ fairly well, in particular
- the Standard Template Library (STL) and exceptions.
-
-
-
- Running the Examples
-
- All of the examples are complete running programs. If
- you built the library from source, the examples should
- have been built as well. If you installed it via the RPM
- package, the example source code and a simplified Makefile
- is in the examples subdirectory of the mysql++-devel
- package's documentation directory. (This is usually
- /usr/share/doc/mysql++-devel-*, but it
- can vary on different Linuxes.)
-
- Before you get started, please read through any of
- the README* files included with the MySQL++ distribution
- that are relevant to your platform. We won't repeat all of
- that here.
-
- Most of the examples require a test database, created
- by resetdb. You run it like so:
-
- ./exrun resetdb [host [user [password [port]]]]
-
- exrun is a shell script that
- ensures that the MySQL++ example program you give as its
- first argument finds the correct shared library version. If
- you run the example program directly, it will search the
- system directories for the MySQL++ shared library. That
- will only work correctly if you've installed the library
- before running the examples. You should run the examples
- before installing the library to ensure that the library
- is working correctly, thus exrun. See
- README.examples for more details. (We've
- been using POSIX file and path names for simplicity above, but
- there's a Windows version of exrun, called
- exrun.bat. It works the same way.)
-
- As for the remaining program arguments, they are all
- optional, but they must be in the order listed. If you leave
- off the port number, it uses the default value, 3306. If you
- leave off the password, it assumes you don't need one to
- log in. If you leave off the user name, it uses the name
- you used when logging on to the computer. And if you leave
- off the host name, it assumes the MySQL server is running on
- the local host. A typical invocation is:
-
- ./exrun resetdb localhost root nunyabinness
-
- For resetdb, the user name needs to
- be for an account with permission to create databases. Once
- the database is created, you can use any account that
- has read and write permissions for the sample database,
- mysql_cpp_data.
-
- You may also have to re-run resetdb
- after running some of the other examples, as they change
- the database.
-
-
-
-
- A Simple Example
-
- The following example demonstrates
- how to open a connection, execute a simple
- query, and display the results. This is
- examples/simple1.cpp:
-
-
-
- This example simply gets the entire "item" column from
- the example table, and prints those values out.
-
- Notice that MySQL++'s objects work similarly to the STL
- std::vector container. The only trick
- is that you can't use subscripting notation if the argument
- is ever 0, because of the way we do overloading, so it's
- safer to call at() instead.
-
- The only thing that isn't explicit in the code above is
- that we delegate command line argument parsing and connection
- establishment to connect_to_db() in
- the util module. This function exists
- to give the examples a consistent interface, not to hide
- important details.
-
-
-
-
- A More Complicated Example
-
- The simple1 example above
- was pretty trivial. Let's get a little deeper. Here is
- examples/simple2.cpp:
-
-
-
- The main point of this example is that we're accessing
- fields in the row objects by name, instead of index. This is
- slower, but obviously clearer. We're also printing out the
- entire table, not just one column.
-
-
-
-
- Exceptions
-
- By default, MySQL++ uses exceptions to signal
- errors. Most of the examples have a full set of exception
- handlers. This is worthy of emulation.
-
- All of MySQL++'s custom exceptions derive
- from a common base class, . That in turn derives from Standard C++'s
- std::exception class. Since the library
- can indirectly cause exceptions to come from the Standard C++
- Library, it's possible to catch all exceptions from MySQL++
- by just catching std::exception by
- reference. However, it's better to have individual catch blocks
- for each of the concrete exception types that you expect, and
- add a handler for either Exception or
- std::exception to act as a "catch-all"
- for unexpected exceptions.
-
- Some of these exceptions are optional. When exceptions
- are disabled on a MySQL++ object, it signals errors in some
- other way, typically by returning an error code or setting
- an error flag. Classes that support this feature derive
- from .
- Moreover, when such an object creates another object
- that also derives from this interface, it passes on its
- exception flag. Since everything flows from the object, disabling
- exceptions on it at the start of the program disables all
- optional exceptions. You can see this technique at work in the
- simple[1-3] examples, which keeps them,
- well, simple.
-
- Real-world code typically can't afford to lose out on the
- additional information and control offered by exceptions. But
- at the same time, it is still sometimes useful to disable
- exceptions temporarily. To do this, put the section of
- code that you want to not throw exceptions inside a block,
- and create a
- object at the top of that block. When created, it saves the
- exception flag of the OptionalExceptions
- derivative you pass to it, and then disables exceptions
- on it. When the NoExceptions
- object goes out of scope at the end of the block,
- it restores the exceptions flag to its previous state.
- See examples/resetdb.cpp to see this
- technique at work.
-
- When one OptionalExceptions
- derivative passes its exceptions flag to another such object,
- it is only passing a copy. This means that the two objects'
- flags operate independently. There's no way to globally
- enable or disable this flag on existing objects in a single
- call. If you're using the NoExceptions
- feature and you're still seeing optional exceptions thrown, you
- disabled exceptions on the wrong object. The exception thrower
- could be unrelated to the object you disabled exceptions on,
- it could be its parent, or it could be a child created before
- you changed the exception throwing flag.
-
- Some of the exceptions MySQL++ can throw are not
- optional:
-
-
- The largest set of non-optional exceptions
- are those from the Standard C++ Library. For instance,
- if your code said "row[21]"
- on a row containing only 5 fields, the
- std::vector underlying the row
- object will throw an exception. (It will, that is,
- if it conforms to the standard.) You might consider
- wrapping your program's main loop in a try block catching
- std::exceptions, just in case you
- trigger one of these exceptions.
-
- ColData will always throw
- when you
- ask it to do an improper type conversion. For example,
- you'll get an exception if you try to convert "1.25"
- to int, but not when you convert "1.00"
- to int. In the latter case, MySQL++
- knows that it can safely throw away the fractional
- part.
-
- If you use template queries and
- don't pass enough parameters when instantiating the
- template, Query will throw
- a
- exception.
-
- If you pass a bad option value to
- Connection::set_option, it will
- throw a BadOption
- exception.
-
-
- It's educational to modify the examples to force
- exceptions. For instance, misspell a field name, use
- an out-of-range index, or change a type to force a
- ColData conversion error.
-
-
-
-
- Quoting and Escaping
-
- SQL syntax often requires certain data to be
- quoted. Consider this query:
-
-
-SELECT * FROM stock WHERE item = 'Hotdog Buns'
-
- Because the string "Hotdog Buns" contains a space,
- it must be quoted. With MySQL++, you don't have to add these
- quote marks manually:
-
-
-string s = "Hotdog Buns";
-Query q = conn.query();
-q << "SELECT * FROM stock WHERE item = " << quote_only << s;
-
- That code produces the same query string as in the
- previous example. We used the MySQL++ quote_only
- manipulator, which causes single quotes to be added
- around the next item inserted into the stream. This
- works for various string types, for any type of data
- that can be converted to MySQL++'s ColData type, and for . (The next section introduces the SSQLS
- feature.)
-
- Quoting is pretty simple, but SQL syntax also often
- requires that certain characters be "escaped". Imagine if the
- string in the previous example was "Frank's Brand Hotdog Buns"
- instead. The resulting query would be:
-
-
-SELECT * FROM stock WHERE item = 'Frank's Brand Hotdog Buns'
-
- That's not valid SQL syntax. The correct syntax
- is:
-
-
-SELECT * FROM stock WHERE item = 'Frank''s Brand Hotdog Buns'
-
- As you might expect, MySQL++ provides that feature,
- too, through its escape manipulator. But here,
- we want both quoting and escaping. That brings us to the most
- widely useful manipulator:
-
-
-string s = "Frank's Brand Hotdog Buns";
-Query q = conn.query();
-q << "SELECT * FROM stock WHERE item = " << quote << s;
-
- The quote manipulator both quotes strings,
- and escapes any characters that are special in SQL.
-
-
-
-
- Specialized SQL Structures
-
-
- Retrieving data
-
- The next example introduces one of the most powerful
- features of MySQL++: (SSQLS). This
- is examples/custom1.cpp:
-
-
-
- Here is the stock.h header used by that example,
- and many others:
-
-
-
- As you can see, SSQLS is very powerful. It allows
- you to have a C++ structure paralleling your SQL table
- structure and use it easily with STL code.
-
-
-
- Adding data
-
- SSQLS can also be used to add data to a table. This
- is examples/custom2.cpp:
-
-
-
- That's all there is to it!
-
- There is one subtlety: MySQL++ automatically quotes
- and escapes the data when building SQL queries using SSQLS
- structures. It's efficient, too: MySQL++ is smart enough
- to apply quoting and escaping only for those data types
- that actually require it.
-
- Because this example modifies the sample database,
- you may want to run resetdb after running this
- program.
-
-
-
- Modifying data
-
- It almost as easy to modify data with SSQLS. This
- is examples/custom3.cpp:
-
-
-
- When you run the example you will notice that in the
- WHERE clause only the 'item' field is checked for. This
- is because SSQLS also also less-than-comparable.
-
- Don't forget to run resetdb after running the
- example.
-
-
-
- Less-than-comparable
-
- SSQLS structures can be sorted and
- stored in STL associative containers as
- demonstrated in the next example. This is
- examples/custom4.cpp:
-
-
-
- For more details on the SSQLS feature, see the
- chapter.
-
-
-
-
-
- C++ Equivalents of SQL Column Types
-
- In MySQL++ version 2.1, the new
- sql_types.h header declares typedefs
- for all MySQL column types. These typedefs all begin with
- sql_ and end with a lowercase version of
- the standard SQL type name. For instance, the MySQL++ typedef
- corresponding to TINYINT UNSIGNED
- is mysqlpp::sql_tinyint_unsigned.
- You do not have to use these typedefs; you could use an
- unsigned char here if you wanted to. For
- that matter, you could use a plain int
- in most cases; MySQL++ is quite tolerant of this sort of
- thing. The typedefs exist for style reasons, for those who
- want their C++ code to use the closest equivalent type for
- any given SQL type.
-
- Most of these typedefs use standard C++ data types, but
- a few are aliases for a MySQL++ specific type. For instance,
- the SQL type DATETIME is mirrored in
- MySQL++ by mysqlpp::DateTime. For
- consistency, sql_types.h includes a
- typedef alias for DateTime called
- mysqlpp::sql_datetime.
-
-
-
-
- Handling SQL Nulls
-
- There is no equivalent of SQL's null in the standard C++
- type system.
-
- The primary distinction is one of type: in SQL, null
- is a column attribute, which affects whether that column
- can hold a SQL null. Just like the const
- keyword in the C++ type system, this effectively doubles the
- number of SQL data types. To emulate this, MySQL++ provides
- the Null template
- to allow the creation of distinct "nullable" versions of
- existing C++ types. So for example, if you have a TINY
- INT UNSIGNED column that can have nulls, the proper
- declaration for MySQL++ would be:
-
-
-mysqlpp::Null<mysqlpp::sql_tinyint_unsigned> myfield;
-
- Template instantiations are first-class types in
- the C++ language, on par with any other type. You can
- use Null template instantiations
- anywhere you'd use the plain version of that type. (You can
- see a complete list of Null template
- instantiations for all column types that MySQL understands
- at the top of lib/type_info.cpp.)
-
- There's a secondary distinction between SQL null and
- anything available in the standard C++ type system: SQL null
- is a distinct value, equal to nothing else. We can't use
- C++'s NULL for this because it is ambiguous,
- being equal to 0 in integer context. MySQL++ provides the
- global null object, which you can assign
- to a Null template instance to make
- it equal to SQL null:
-
-
-myfield = mysqlpp::null;
-
- The final aspect of MySQL++'s null handling is that,
- by default, it will enforce the uniqueness of the SQL null
- value. If you try to convert a SQL null to a plain C++
- data type, MySQL++ will throw a exception. If you insert
- a SQL null into a C++ stream, you get "(NULL)". If
- you don't like this behavior, you can change it, by
- passing a different value for the second parameter to
- template Null. By default, this
- parameter is ,
- meaning that we should enforce the uniqueness of the null
- type. To relax this distinction, you can instantiate the
- Null template with a different
- behavior type:
- or . Consider
- this code:
-
-
-mysqlpp::Null<unsigned char, mysqlpp::NullisZero> myfield;
-
-myfield = mysqlpp::null;
-cout << myfield << endl;
-
-int x = myfield;
-cout << x << endl;
-
- This will print "0" twice. If you had used the
- default for the second Null
- template parameter, the first output statement would
- have printed "(NULL)", and the second would have thrown a
- BadNullConversion exception.
-
-
-
-
- Creating Transaction Sets
-
- MySQL++ v2.1 added the class, which makes it easier to use
- transactions in an exception-safe manner. Normally you create
- the Transaction object on the stack
- before you issue the queries in your transaction set. Then,
- when all the queries in the transaction set have been issued,
- you call Transaction::commit(),
- which commits the transaction set. If the
- Transaction object goes out of scope
- before you call commit(), the transaction
- set is rolled back. This ensures that if some code throws an
- exception after the transaction is started but before it is
- committed, the transaction isn't left unresolved.
-
- examples/xaction.cpp illustrates
- this:
-
-
-
-
-
-
- Which Query Type to Use?
-
- There are three major ways to execute a query in
- MySQL++: Query::execute(),
- Query::store(), and
- Query::use(). Which should you use,
- and why?
-
- execute() is for queries
- that do not return data per se. For
- instance, CREATE INDEX. You do
- get back some information from the MySQL server, which
- execute() returns to its caller in a
- object. In addition to
- the obvious — a flag stating whether the query succeeded
- or not — this object also contains things like the
- number of rows that the query affected. If you only need the
- success status, there's Query::exec(),
- which just returns bool.
-
- If your query does pull data from the database,
- the simplest option is store().
- This returns a object,
- which contains an in-memory copy of the result set. The nice
- thing about this is that Result is a
- sequential container, like std::vector,
- so you can iterate through it forwards and backwards, access
- elements with subscript notation, etc. There are also the
- storein() methods, which actually
- put the result set into an STL container of your choice. The
- downside of these methods is that a sufficiently large result
- set will give your program memory problems.
-
- For these large result sets, the superior option is a
- use() query. This returns a object, which is similar to
- Result, but without all of the random-access features. This
- is because a "use" query tells the database server to
- send the results back one row at a time, to be processed
- linearly. It's analogous to a C++ stream's input iterator,
- as opposed to a random-access iterator that a container like
- vector offers. By accepting this limitation, you can process
- arbitrarily large result sets. This technique is demonstrated
- in examples/simple3.cpp:
-
-
-
- This example does the same thing as
- simple2, only with a "use" query instead
- of a "store" query. If your program uses exceptions, you should
- instead look at examples/usequery.cpp,
- which does the same thing as simple3,
- but with exception-awareness.
-
-
-
-
- Conditional Result Row Handling
-
- Query::store() is fine if
- you really need all the rows the query returns. It sometimes
- happens that you can't express the full selection criteria
- in a SQL query. Instead of storing the full result set,
- then picking over it to find the rows you want to keep,
- use Query::store_if(). This is
- examples/store_if.cpp:
-
-
-
- I doubt anyone really needs to select rows from
- a table that have a prime number in a given field. This
- example is meant to be just barely more complex than SQL
- can manage, to avoid obscuring the point. Point being, the
- Query::store_if() call here gives
- you a container full of results meeting a criterion that you
- probably can't express in SQL. You will no doubt have much
- more useful criteria in your own programs.
-
- If you need a more complex query than the one
- store_if() knows how to build when
- given an SSQLS examplar, there are two overloads that let
- you use your own query string. One overload takes the query
- string directly, and the other uses the query string built
- with Query's stream interface.
-
-
-
-
- Executing Code for Each Row In a Result Set
-
- SQL is more than just a database query language. Modern
- database engines can actually do some calculations on the data
- on the server side. But, this isn't always the best way to
- get something done. When you need to mix code and a query,
- MySQL++'s new Query::for_each()
- facility might be just what you need. This is
- examples/for_each.cpp:
-
-
-
- You only need to read the main()
- function to get a good idea of what the program
- does. The key line of code passes an SSQLS examplar and
- a functor to Query::for_each().
- for_each() uses the SSQLS instance to
- build a select * from TABLE
- query, stock in
- this case. It runs that query internally, calling
- gather_stock_stats on each row. This
- is a pretty contrived example; you could actually do this in
- SQL, but we're trying to prevent the complexity of the code
- from getting in the way of the demonstration here.
-
- Just as with store_if(),
- described above, there are two other overloads for
- for_each() that let you use your
- own query string.
-
-
-
-
- Getting Field Meta-Information
-
- The following example demonstrates how to get
- information about the fields in a result set, such
- as the name of the field and the SQL type. This is
- examples/fieldinf1.cpp:
-
-
-
-
-
-
- Dealing with Binary Data
-
- The tricky part about dealing with binary data in
- MySQL++ is to ensure that you don't ever treat the data as a
- C string, which is really easy to do accidentally. C strings
- treat zero bytes as special end-of-string characters, but
- they're not special at all in binary data. Recent releases
- of MySQL++ do a better job of letting you keep data in
- forms that don't have this problem, but it's still possible
- to do it incorrectly. These examples demonstrate correct
- techniques.
-
-
- Loading a binary file into a BLOB column
-
- This example shows how to insert binary data
- into a MySQL table's BLOB column with MySQL++,
- and also how to get the value of the auto-increment
- column from the previous insert. (This MySQL feature
- is usually used to create unique IDs for rows as
- they're inserted.) The program requires one command
- line parameter over that required by the other examples
- you've seen so far, the path to a JPEG file. This is
- examples/load_jpeg.cpp:
-
-
-
- Notice that we used the escape
- manipulator when building the INSERT query above. This
- is because we're not using one of the MySQL++ types that
- does automatic escaping and quoting.
-
-
-
- Serving images from BLOB column via CGI
-
- This example is also a very short one, considering
- the function that it performs. It retreives data loaded
- by load_jpeg and prints it out in
- the form a web server can accept for a CGI call. This
- is examples/cgi_jpeg.cpp:
-
-
-
- You install this in a web server's
- CGI program directory (usually called
- cgi-bin), then call it with a URL like
- http://my.server.com/cgi-bin/cgi_jpeg?id=1.
- That retrieves the JPEG with ID 1 from the table and
- returns it to the web server, which will send it on to
- the browser.
-
-
-
-
-
-
- Template Queries
-
- Another powerful feature of MySQL++ is being able
- to set up template queries. These are kind of like C's
- printf() facility: you give MySQL++ a string
- containing the fixed parts of the query and placeholders for
- the variable parts, and you can later substitute in values into
- those placeholders.
-
- The following program demonstrates how to use this
- feature. This is examples/tquery.cpp:
-
-
-
- The line just before the call to
- query.parse() sets the template, and the
- parse call puts it into effect. From that point on, you can re-use
- this query by calling any of several Query member functions that
- accept query template parameters. In this example, we're using
- Query::execute().
-
- Let's dig into this feature a little deeper.
-
-
-
- Setting up Template Queries
-
- To set up a template query, you simply insert it into the
- Query object, using numbered placeholders wherever you want
- to be able to change the query. Then, you call the parse()
- function to tell the Query object that the query string is
- a template query, and it needs to parse it:
-
-
-query << "select (%2:field1, %3:field2) from stock where %1:wheref = %0q:what";
-query.parse();
-
- The format of the placeholder is:
-
-
-%###(modifier)(:name)(:)
-
- Where '###' is a number up to three digits. It is
- the order of parameters given to a object, starting from 0.
-
- 'modifier' can be any one of the following:
-
-
-
-
-
-
-
- %
- Print an actual "%"
-
-
- ""
- Don't quote or escape no matter what.
-
-
- q
- This will quote and escape
- the item using the MySQL C API
- function if it is a string or char *,
- or another MySQL-specific type
- that needs to be quoted.
-
-
- Q
- Quote but don't escape
- based on the same rules as for 'q'. This
- can save a bit of processing time if you
- know the strings will never need
- quoting
-
-
- r
- Always quote and escape
- even if it is a number.
-
-
- R
- Always quote but
- don't escape even if it is
- a number.
-
-
-
-
-
-
- ":name" is for an optional name which aids in filling
- SQLQueryParms. Name can contain any alpha-numeric characters
- or the underscore. You can have a trailing colon, which will
- be ignored. If you need to represent an actual colon after
- the name, follow the name with two colons. The first one will
- end the name and the second one won't be processed.
-
-
-
-
- Setting the Parameters at Execution Time
-
- To specify the parameters when you want to execute
- a query simply use Query::store(const
- SQLString &parm0, [..., const SQLString
- &parm11]). This type of multiple overload
- also exists for Query::storein(),
- Query::use() and
- Query::execute(). 'parm0'
- corresponds to the first parameter, etc. You may specify up
- to 25 parameters. For example:
-
-
-Result res = query.store("Dinner Rolls", "item", "item", "price")
-
- with the template query provided above would
- produce:
-
-
-select (item, price) from stock where item = "Dinner Rolls"
-
- The reason we didn't put the template parameters in
- numeric order...
-
-
-select (%0:field1, %1:field2) from stock where %2:wheref = %3q:what
-
- ...will become apparent shortly.
-
-
-
-
- Parameter Types and Function Overloads
-
- There are quite a few overloads for each of
- Query's query execution
- functions. (store(),
- use(),
- execute()...) It's possible to
- have code that looks like it should work, but which doesn't,
- because it's calling the wrong overload. For instance:
-
-
-query.storein(my_vector, "1");
-query.storein(my_vector, 1);
-
- The first one works, and the second does
- not. The cause is a vestigial second parameter to one
- of storein()'s overloads that's
- compatible with integers. Being vestigial, it's only getting
- in the way right now, but we can't fix it until the next
- major version of the libary, where it will be okay to break
- the ABI. Until then, we're stuck with it.
-
- If the MySQL server keeps rejecting your template
- queries, try explicitly casting the parameters to
- SQLString:
-
-
-query.storein(my_vector, SQLString(1));
-
- This ensures that your code calls one of the overloads
- meant to handle template query parameters. I don't recommend
- doing this habitually, because it will clutter your code. For
- the most part, MySQL++'s interface is set up to do the right
- thing. It's just that there are still a few corner cases
- that can't be fixed until the next time we can redesign the
- interface.
-
-
-
- Default Parameters
-
- The template query mechanism allows you to set
- default parameter values. You simply assign a value
- for the parameter to the appropriate position in the
- Query::def array. You can refer to the
- parameters either by position or by name:
-
-
-query.def[1] = "item";
-query.def["wheref"] = "item";
-
- Both do the same thing.
-
- This mechanism works much like C++'s default function
- parameter mechanism: if you set defaults for the parameters at
- the end of the list, you can call one of
- Query's query execution methods without
- passing all of the values. If the query takes four parameters
- and you've set defaults for the last three, you can execute the
- query using as little as just one explicit parameter.
-
- Now you can see why we numbered the template query
- parameters the way we did a few sections earlier. We ordered
- them so that the ones less likely to change have higher
- numbers, so we don't always have to pass them. We can just give
- them defaults and take those defaults when applicable. This
- is most useful when some parameters in a template query vary
- less often than other parameters. For example:
-
-
-query.def["field1"] = "item";
-query.def["field2"] = "price";
-Result res1 = query.store("Hamburger Buns", "item");
-Result res2 = query.store(1.25, "price");
-
- This stores the result of the following queries
- in res1 and res2,
- respectively:
-
-
-select (item, price) from stock where item = "Hamburger Buns"
-select (item, price) from stock where price = 1.25
-
- Default parameters are useful in this example because
- we have two queries to issue, and parameters 2 and 3 remain
- the same for both, while parameters 0 and 1 vary.
-
- Some have been tempted into using this mechanism as a
- way to set all of the template parameters in a query:
-
-
-query.def["what"] = "Hamburger Buns";
-query.def["wheref"] = "item";
-query.def["field1"] = "item";
-query.def["field2"] = "price";
-Result res1 = query.store();
-
- This can work, but it is not designed
- to. In fact, it's known to fail horribly in one
- common case. You will not get sympathy if you complain on
- the mailing list about it not working. If your code doesn't
- actively reuse at least one of the parameters in subsequent
- queries, you're abusing MySQL++, and it is likely to take
- its revenge on you.
-
-
-
-
- Error Handling
-
- If for some reason you did not specify all the parameters
- when executing the query and the remaining parameters do not
- have their values set via Query::def,
- the query object will throw a object. If this happens, you
- can get an explanation of what happened by calling
- BadParamCount::what(), like so:
-
-
-query.def["field1"] = "item";
-query.def["field2"] = "price";
-Result res = query.store(1.25);
-
- This would throw BadParamCount
- because the wheref is not specified.
-
- In theory, this exception should never be thrown. If
- the exception is thrown it probably a logic error in your
- program.
-
-
-
-
-
- Specialized SQL Structures
-
- The Specialized SQL Structure (SSQLS) feature lets you
- easily define C++ structures that match the form of your SQL
- tables. Because of the extra functionality that this feature builds
- into these structures, MySQL++ can populate them automatically
- when retrieving data from the database; with queries returning
- many records, you can ask MySQL++ to populate an STL container of
- your SSQLS records with the results. When updating the database,
- MySQL++ can use SSQLS structures to match existing data, and it
- can insert SSQLS structures directly into the database.
-
- You define an SSQLS using one of several macros. (These
- are in the file custom.h, and in the file that it includes,
- custom-macros.h.) There are a bunch of different macros, for
- different purposes. The following sections will discuss each macro
- type separately, beginning with the easiest and most generally
- useful.
-
-
-
- sql_create
-
- This is the most basic sort of SSQLS declaration:
-
-
-sql_create_5(stock, 1, 0,
- string, item,
- int, num,
- double, weight,
- double, price,
- mysqlpp::Date, date)
-
- This creates a C++ structure called
- stock containing five member
- variables (item, num,
- weight, price and
- date), along with some constructors and
- other member functions useful with MySQL++.
-
- One of the generated constructors takes a reference
- to a mysqlpp::Row object, allowing you to easily populate a
- vector of stocks like so:
-
-
-vector<stock> result;
-query.storein(result);
-
- That's all there is to it. The only requirements are
- that the table structure be compatible with the SSQLS's member
- variables, and that the fields are in the same order.
-
- The general format of this set of macros is:
-
-
-sql_create_#(NAME, COMPCOUNT, SETCOUNT, TYPE1, ITEM1, ... TYPE#, ITEM#)
-
- Where # is the number of member variables,
- NAME is the name of the structure you
- wish to create, TYPEx is the type of
- a member variable, and ITEMx is that
- variable's name.
-
- The COMPCOUNT and
- SETCOUNT arguments are described in
- the next section.
-
-
-
-
- SSQLS Comparison and Initialization
-
- sql_create_x
- adds member functions and operators to each SSQLS that
- allow you to compare one SSQLS instance to another. These
- functions compare the first COMPCOUNT
- fields in the structure. In the example above,
- COMPCOUNT is 1, so only the
- item field will be checked when comparing
- two stock structures.
-
- This feature works best when your table's "key"
- fields are the first ones in the table schema and you set
- COMPCOUNT equal to the number of key
- fields. That way, a check for equality between two SSQLS
- structures in your C++ code will give the same results as a
- check for equality in SQL.
-
- COMPCOUNT must
- be at least 1. The current implementation of
- sql_create_x cannot
- create an SSQLS without comparison member functions.
-
- Because our stock structure
- is less-than-comparable, you can use it in STL algorithms
- and containers that require this, such as STL's associative
- containers:
-
-
-std::set<stock> result;
-query.storein(result);
-cout << result.lower_bound(stock("Hamburger"))->item << endl;
-
- This will print the first item in the result set that
- begins with "Hamburger".
-
- The third parameter to
- sql_create_x is
- SETCOUNT. If this is nonzero, it adds an
- initialization constructor and a set()
- member function taking the given number of arguments,
- for setting the first N fields of the
- structure. For example, you could change the above example
- like so:
-
-
-sql_create_5(stock, 1, 2,
- string, item,
- int, num,
- double, weight,
- double, price,
- mysqlpp::Date, date)
-
-stock foo("Hotdog", 52);
-
- In addition to this 2-parameter constructor, this version
- of the stock SSQLS will have a similar
- 2-parameter set() member function.
-
- The COMPCOUNT and
- SETCOUNT values cannot be equal. If
- they are, the macro will generate two initialization
- constructors with identical parameter lists, which
- is illegal in C++. Why does this happen? It's often
- convenient to be able to say something like x
- == stock("Hotdog"). This requires that there
- be a constructor taking COMPCOUNT
- arguments to create the temporary stock
- instance used in the comparison. It is easy to work around
- this limitation. Using our stock
- example structure, if you wanted comparisons to consider all
- 5 fields and also be able to initialize all 5 fields at once,
- you would pass 5 for COMPCOUNT and
- 0 for SETCOUNT. You would still get
- a 5-parameter initialization constructor and a 5-parameter
- set() function.
-
-
-
-
- Retrieving a Table Subset
-
- It's not necessary to retrieve an entire table
- row using SSQLS, as long as the fields you want are
- grouped together at the start of the table schema.
- examples/custom6.cpp illustrates
- this:
-
-
-
- (See the simple1 example in the for another way to accomplish the same
- thing.)
-
- This example illustrates an important point: you
- could not use the 5-member stock
- structure in this example. The reason is, when you assign a
- Row object to an SSQLS, the function
- that copies the row's data into the structure expects to
- see as many fields in the row as are in the SSQLS. Your
- program will crash when the code tries to access fields
- beyond those that exist in the Row
- object. The converse is not true, however: if you change
- the SELECT statement above so that
- it retrieves more than one column, the code will still
- work, because the extra fields in each row will simply be
- ignored.
-
- Realize that the second and third parameters to
- sql_create_1 can't be anything other
- than 1 and 0, respectively. As discussed above, the second
- parameter must be at least 1, but since there is only one
- field in the structure, it cannot be higher than 1. Since
- the third parameter cannot be equal to the second, only 0
- works there.
-
-
-
-
- Additional Features of Specialized SQL
- Structures
-
- Up to this point, we haven't been using all of the
- features in the SSQLS structures we've been generating. We
- could have used the sql_create_basic_*
- macros instead, which would have worked just as well for
- what we've seen so far, and the generated code would have
- been smaller.
-
- Why is it worth ignoring the "basic" variants of these
- macros, then? Consider this:
-
-
-query.insert(s);
-
- This does exactly what you think it does: it inserts
- 's' into the database. This is possible because a standard
- SSQLS has functions that the query object can call to get
- the list of fields and such, which it uses to build an
- insert query. query::update() and
- query::replace() also rely on this
- SSQLS feature. A basic SSQLS lacks these functions.
-
- Another feature of standard SSQLSes you might find a use
- for is changing the table name used in queries. By default,
- the table in the MySQL database is assumed to have the same
- name as the SSQLS structure type. But if this is inconvenient,
- you can globally change the table name used in queries like
- this:
-
-
-stock::table() = "MyStockData";
-
-
-
-
- Harnessing SSQLS Internals
-
- Continuing the discussion in the previous section,
- there is a further set of methods that the non-"basic"
- versions of the sql_create macros define
- for each SSQLS. These methods are mostly for use within the
- library, but some of them are useful enough that you might
- want to harness them for your own ends. Here is some pseudocode
- showing how the most useful of these methods would be defined
- for the stock structure used in all
- the custom*.cpp examples:
-
-
-// Basic form
-template <class Manip>
-stock_value_list<Manip> value_list(cchar *d = ",",
- Manip m = mysqlpp::quote) const;
-
-template <class Manip>
-stock_field_list<Manip> field_list(cchar *d = ",",
- Manip m = mysqlpp::do_nothing) const;
-
-template <class Manip>
-stock_equal_list<Manip> equal_list(cchar *d = ",",
- cchar *e = " = ", Manip m = mysqlpp::quote) const;
-
-
-// Boolean argument form
-template <class Manip>
-stock_cus_value_list<Manip> value_list([cchar *d, [Manip m,] ]
- bool i1, bool i2 = false, ... , bool i5 = false) const;
-
-// List form
-template <class Manip>
-stock_cus_value_list<Manip> value_list([cchar *d, [Manip m,] ]
- stock_enum i1, stock_enum i2 = stock_NULL, ...,
- stock_enum i5 = stock_NULL) const;
-
-// Vector form
-template <class Manip>
-stock_cus_value_list<Manip> value_list([cchar *d, [Manip m,] ]
- vector<bool> *i) const;
-
-...Plus the obvious equivalents for field_list() and equal_list()
-
- Rather than try to learn what all of these methods do at
- once, let's ease into the subject. Consider this code:
-
-
-stock s("Dinner Rolls", 75, 0.95, 0.97, "1998-05-25");
-cout << "Value list: " << s.value_list() << endl;
-cout << "Field list: " << s.field_list() << endl;
-cout << "Equal list: " << s.equal_list() << endl;
-
- That would produce something like:
-
-
-Value list: 'Dinner Rolls',75,0.95,0.97,'1998-05-25'
-Field list: item,num,weight,price,date
-Equal list: item = 'Dinner Rolls',num = 75,weight = 0.95, price = 0.97,date = '1998-05-25'
-
- That is, a "value list" is a list of data member values
- within a particular SSQLS instance, a "field list" is a list
- of the fields (columns) within that SSQLS, and an "equal list"
- is a list in the form of an SQL equals clause.
-
- Just knowing that much, it shouldn't surprise you
- to learn that Query::insert() is
- implemented more or less like this:
-
-
-*this << "INSERT INTO " << v.table() << " (" << v.field_list() <<
- ") VALUES (" << v.value_list() << ")";
-
- where 'v' is the SSQLS you're asking the Query object
- to insert into the database.
-
- Now let's look at a complete example,
- which uses one of the more complicated forms of
- equal_list(). This example
- builds a query with fewer hard-coded strings than
- the most obvious technique requires, which makes
- it more robust in the face of change. Here is
- examples/custom5.cpp:
-
-
-
- This example uses the list form of
- equal_list(). The
- arguments stock_weight
- and stock_price are enum
- values equal to the position of these columns
- within the stock table.
- sql_create_x generates
- this enum for you automatically.
-
- The boolean argument form of that
- equal_list() call would look like
- this:
-
-
-query << "select * from stock where " <<
- res[0].equal_list(" and ", false, false, true, true, false);
-
- It's a little more verbose, as you can see. And if you
- want to get really complicated, use the vector form:
-
-
-vector<bool> v(5, false);
-v[stock_weight] = true;
-v[stock_price] = true;
-query << "select * from stock where " <<
- res[0].equal_list(" and ", v);
-
- This form makes the most sense if you are building many
- other queries, and so can re-use that vector object.
-
- Many of these methods accept manipulators and custom
- delimiters. The defaults are suitable for building SQL queries,
- but if you're using these methods in a different context,
- you may need to override these defaults. For instance, you
- could use these methods to dump data to a text file using
- different delimiters and quoting rules than SQL.
-
- At this point, we've seen all the major aspects of the
- SSQLS feature. The final sections of this chapter look at
- some of the peripheral aspects.
-
-
-
-
- Alternate Creation Methods
-
- If for some reason you want your SSQLS data members
- to have different names than used in the MySQL database,
- you can do so like this:
-
-
-sql_create_c_names_5(stock, 1, 5,
- string, item, "item",
- int, num, "quantity",
- double, weight, "weight",
- double, price, "price"
- mysqlpp::Date, date, "shipment")
-
- If you want your SSQLS to have its data members in a
- different order from those in the MySQL table, you can do it
- like this:
-
-
-sql_create_c_order_5(stock, 2, 5,
- mysqlpp::Date, date, 5,
- double, price, 4,
- string, item, 1,
- int, num, 2,
- double, weight, 3)
-
- You can combine the custom names and custom ordering
- like this:
-
-
-sql_create_complete_5(stock, 2, 5,
- mysqlpp::date, date, "shipment", 5,
- double, price, "price", 4,
- string, item, "item", 1,
- int, num, "quantity", 2,
- double, weight, "weight", 3)
-
- All three of these macro types have "basic" variants
- that work the same way. Again, basic SSQLSes lack the features
- necessary for automatic insert, update and replace query
- creation.
-
-
-
-
- Expanding SSQLS Macros
-
- If you ever need to see the code that a given
- SSQLS declaration expands out to, use the utility
- doc/ssqls-pretty, like so:
-
-
-doc/ssqls-pretty < myprog.cpp |less
-
- This Perl script locates the first SSQLS declaration
- in that file, then uses the C++ preprocessor to expand that
- macro. (The script assumes that your system's preprocessor
- is called cpp, and that its command line
- interface follows Unix conventions.)
-
- If you run it from the top MySQL++ directory, as shown
- above, it will use the header files in the distribution's
- lib subdirectory. Otherwise, it
- assumes the MySQL++ headers are in their default location,
- /usr/include/mysql++. If you want to
- use headers in some other location, you'll need to change
- the directory name in -I flag at the top
- of the script.
-
-
-
-
- Extending the SSQLS Mechanism
-
- The SSQLS headers — custom.h and custom-macros.h
- — are automatically generated by the Perl script
- custom.pl. Although it is possible to
- change this script to get additional functionality, it's
- usually better to do that through inheritance.
-
- A regular user may find it helpful to change the the
- limit on the maximum number of SSQLS data members allowed.
- It's 25 out of the box. A smaller value may speed up
- compile time, or you may require a higher value because
- you have more complex tables than that. Simply change the
- max_data_members variable at the top of
- custom.pl and say make.
- The limit for Visual C++ is 31, according to one report. There
- doesn't seem to be a practical limit with GCC 3.3 at least:
- I set the limit to 100 and the only thing that happened
- is that custom-macros.h went from 1.3 MB to 18 MB and the
- build time for examples/custom.* got a
- lot longer.
-
-
-
- SSQLS and BLOB Columns
-
- It takes special care to use SSQLS with BLOB
- columns. It's safest to declare the SSQLS field as of
- type mysqlpp::sql_blob. This
- is currently a typedef alias for ColData, which is the form the
- data is in just before the SSQLS mechanism populates the
- structure. Thus, when the data is copied from the internal
- MySQL++ data structures into your SSQLS, you get a direct
- copy of the ColData object's contents,
- without interference.
-
- Because ColData derives
- from std::string and C++
- strings handle binary data just fine, you might think
- you can use std::string instead
- of sql_blob, but the current
- design of ColData converts to
- std::string via a C string. As a
- result, the BLOB data is truncated at the first embedded
- null character during population of the SSQLS. There's
- no way to fix that without completely redesigning either
- ColData or the SSQLS mechanism.
-
- The sql_blob typedef may be
- changed to alias a different type in the future, so using it
- instead of ColData ensures that your
- code tracks these library changes automatically. Besides,
- ColData is only intended to be an
- internal mechanism within MySQL++. The only reason the layering
- is so thin here is because it's the only way to prevent BLOB
- data from being corrupted while staying within the current
- library interface design.
-
- You can see this technique in action in the
- cgi_jpeg example:
-
-
-
-
-
-
-
- Using Unicode with MySQL++
-
-
- A Short History of Unicode
- ...with a focus on relevance to MySQL++
-
- In the old days, computer operating systems only
- dealt with 8-bit character sets. That only allows for 256
- possible characters, but the modern Western languages have
- more characters combined than that alone. Add in all the
- other languages of the world plus the various symbols people
- use in writing, and you have a real mess!
-
- Since no standards body held sway over things like
- international character encoding in the early days of
- computing, many different character sets were invented. These
- character sets weren't even standardized between operating
- systems, so heaven help you if you needed to move localized
- Greek text on a DOS box to a Russian Macintosh! The only
- way we got any international communication done at all was
- to build standards on top of the common 7-bit ASCII subset.
- Either people used approximations like a plain "c" instead
- of the French "ç", or they invented things like
- HTML entities ("ç" in this case) to encode these
- additional characters using only 7-bit ASCII.
-
- Unicode solves this problem. It encodes every character
- used for writing in the world, using up to 4 bytes per
- character. The subset covering the most economically valuable
- cases takes two bytes per character, so most Unicode-aware
- programs deal in 2-byte characters, for efficiency.
-
- Unfortunately, Unicode was invented about two decades
- too late for Unix and C. Those decades of legacy created an
- immense inertia preventing a widespread move away from 8-bit
- characters. MySQL and C++ come out of these older traditions,
- and so they share the same practical limitations. MySQL++
- doesn't have a reason to do anything more than just pass
- data along unchanged, so you still need to be aware of these
- underlying issues.
-
- During the development of the Plan
- 9 operating system (a kind
- of successor to Unix) Ken Thompson invented
- the UTF-8
- encoding. UTF-8 is a superset of 7-bit ASCII and
- is compatible with C strings, since it doesn't use 0 bytes
- anywhere as multi-byte Unicode encodings do. As a result,
- many programs that deal in text will cope with UTF-8 data
- even though they have no explicit support for UTF-8. (Follow
- the last link above to see how the design of UTF-8 allows
- this.) Thus, when explicit support for Unicode was added in
- MySQL v4.1, they chose to make UTF-8 the native encoding,
- to preserve backward compatibility with programs that had no
- Unicode support.
-
-
-
-
- Unicode on Unixy Systems
-
- Linux and Unix have system-wide UTF-8 support these
- days. If your operating system is of 2001 or newer vintage,
- it probably has such support.
-
- On such a system, the terminal I/O code understands
- UTF-8 encoded data, so your program doesn't require any
- special code to correctly display a UTF-8 string. If you
- aren't sure whether your system supports UTF-8 natively,
- just run the simple1 example: if the
- first item has two high-ASCII characters in place of the
- "ü" in "Nürnberger Brats", you know it's not
- handling UTF-8.
-
- If your Unix doesn't support UTF-8 natively, it likely
- doesn't support any form of Unicode at all, for the historical
- reasons I gave above. Therefore, you will have to convert the
- UTF-8 data to the local 8-bit character set. The standard Unix
- function iconv() can help here. If your
- system doesn't have the iconv() facility,
- there is a
- free implementation available from the GNU
- Project. Another library you might check out is IBM's ICU. This is
- rather heavy-weight, so if you just need basic conversions,
- iconv() should suffice.
-
-
-
-
- Unicode on Windows
-
- Each Windows API function that takes a string actually
- comes in two versions. One version supports only 1-byte "ANSI"
- characters (a superset of ASCII), so they end in 'A'. Windows
- also supports the 2-byte subset of Unicode called UCS-2.
- Some call these "wide" characters,
- so the other set of functions end in 'W'. The MessageBox()
- API, for instance, is actually a macro, not a real function. If
- you define the UNICODE macro when building
- your program, the MessageBox() macro
- evaluates to MessageBoxW(); otherwise,
- to MessageBoxA().
-
- Since MySQL uses the UTF-8 Unicode encoding and Windows
- uses UCS-2, you must convert data when passing text between
- MySQL++ and the Windows API. Since there's no point in trying
- for portability — no other OS I'm aware of uses UCS-2
- — you might as well use platform-specific functions
- to do this translation. Since version 2.2.2, MySQL++ ships
- with two Visual C++ specific examples showing how to do this
- in a GUI program. (In earlier versions of MySQL++, we did
- Unicode conversion in the console mode programs, but this
- was unrealistic.)
-
- How you handle Unicode data depends on whether you're
- using the native Windows API, or the newer .NET API. First,
- the native case:
-
-
-// Convert a C string in UTF-8 format to UCS-2 format.
-void ToUCS2(LPTSTR pcOut, int nOutLen, const char* kpcIn)
-{
- MultiByteToWideChar(CP_UTF8, 0, kpcIn, -1, pcOut, nOutLen);
-}
-
-// Convert a UCS-2 string to C string in UTF-8 format.
-void ToUTF8(char* pcOut, int nOutLen, LPCWSTR kpcIn)
-{
- WideCharToMultiByte(CP_UTF8, 0, kpcIn, -1, pcOut, nOutLen, 0, 0);
-}
-
- These functions leave out some important error checking,
- so see examples/vstudio/mfc/mfc_dlg.cpp
- for the complete version.
-
- If you're building a .NET application (such as, perhaps,
- because you're using Windows Forms), it's better to use the
- .NET libraries for this:
-
-
-// Convert a C string in UTF-8 format to a .NET String in UCS-2 format.
-String^ ToUCS2(const char* utf8)
-{
- return gcnew String(utf8, 0, strlen(utf8), System::Text::Encoding::UTF8);
-}
-
-// Convert a .NET String in UCS-2 format to a C string in UTF-8 format.
-System::Void ToUTF8(char* pcOut, int nOutLen, String^ sIn)
-{
- array<Byte>^ bytes = System::Text::Encoding::UTF8->GetBytes(sIn);
- nOutLen = Math::Min(nOutLen - 1, bytes->Length);
- System::Runtime::InteropServices::Marshal::Copy(bytes, 0,
- IntPtr(pcOut), nOutLen);
- pcOut[nOutLen] = '\0';
-}
-
- Unlike the native API versions, these examples are
- complete, since the .NET platform handles a lot of things
- behind the scenes for us. We don't need any error-checking
- code for such simple routines.
-
- All of this assumes you're using Windows NT or one of
- its direct descendants: Windows 2000, Windows XP, Windows
- Vista, or any "Server" variant of Windows. Windows 95 and its
- descendants (98, ME, and CE) do not support UCS-2. They still
- have the 'W' APIs for compatibility, but they just smash the
- data down to 8-bit and call the 'A' version for you.
-
-
-
-
- For More Information
- The Unicode
- FAQs page has copious information on
- this complex topic.
-
- When it comes to Unix
- and UTF-8 specific items, the UTF-8
- and Unicode FAQ for Unix/Linux is a
- quicker way to find basic information.
-
-
-
-
-
- Important Underlying C API Limitations
-
- Since MySQL++ is built on top of the MySQL C API
- (libmysqlclient), it shares all of its limitations. The
- following points out some of these limitations that frequently
- bite newbies. Some of these may be papered over at the MySQL++
- layer in future releases, but it's best to write your program as
- if they were permanent fixtures of the universe.
-
-
-
- Only one active query per
- connection. This one bites MySQL++ newbies most
- often in multithreaded programs. If the program has only
- one Connection object and each thread gets their Query
- objects from it, it's inevitable that one of those query
- objects will try to execute while another query is already
- running on that single connection. The safest course is
- to have a separate Connection object per thread, and for
- your code to get Query objects in a thread only from that
- thread's Connection object. Alternately, you can confine
- MySQL database access to a single thread.
-
-
-
- You must consume all rows from a query
- before you can start a new query. This one
- bites MySQL++ newbies most often when they try code
- like this:
-
-
-Connection c(...);
-Query q = c.query();
-Result r1 = q.use("select garbage from plink where foobie='tamagotchi'");
-Result r2 = q.use("select blah from bonk where bletch='smurf'");
-
- This will fail because a "use" query consumes rows
- only on demand, so the MySQL server is still keeping
- information around about the first query when the second
- one comes in on the connection. When you try the second
- query, MySQL++ will throw an exception containing an
- obscure MySQL C API error message about "commands out
- of sync".
-
- This is not the only situation where this can happen,
- but all of these issues boil down to the fact that MySQL
- requires that certain operations complete before you can
- start a new one.
-
-
-
- The Result object
- must outlive the use of any Row
- objects it returns. This is because the
- Row objects refer back to the
- Result object that created them for
- certain data. (Field names, for example.) MySQL does this
- for efficiency, because there is some information about a
- row that is the same for all rows in a result set. We could
- avoid this in MySQL++ by making redundant copies of this
- data for each row, but that would be quite wasteful.
-
- Beware of some of the more obscure ways this can
- happen. For example:
-
-
-Connection c(...);
-Query q = c.query();
-Result res = q.store("...");
-Row row = res.at(0);
-res = q.store("...");
-
- At this point, the row variable's
- contents are likely no longer usable. The program may run,
- but the row object will use data (field names, etc.) from
- the second query, not the first.
-
-
-
-
-
-
- Incompatible Library Changes
-
- This chapter documents those library changes since the
- epochal 1.7.9 release that break end-user programs. You can dig
- this stuff out of the ChangeLog, but the ChangeLog focuses more
- on explaining and justifying the facets of each change, while
- this section focuses on how to migrate your code between these
- library versions.
-
- Since pure additions do not break programs, those changes
- are still documented only in the ChangeLog.
-
-
-
- API Changes
-
- This section documents files, functions, methods and
- classes that were removed or changed in an incompatible
- way. If your program uses the changed item, you will have to
- change something in your program to get it to compile after
- upgrading to each of these versions.
-
-
- v1.7.10
-
- Removed Row::operator[]()
- overloads except the one for size_type,
- and added Row::lookup_by_name()
- to provide the "subscript by string" functionality.
- In practical terms, this change means that the
- row["field"] syntax no longer works; you
- must use the new lookup_by_name
- method instead.
-
- Renamed the generated library on POSIX
- systems from libsqlplus to
- libmysqlpp.
-
-
-
-
- v1.7.19
-
- Removed
- SQLQuery::operator=(), and the
- same for its Query subclass. Use
- the copy constructor instead, if you need to copy one
- query to another query object.
-
-
-
-
- v1.7.20
-
- The library used to have two names for many core
- classes: a short one, such as Row
- and a longer one, MysqlRow. The
- library now uses the shorter names exclusively.
-
- All symbols within MySQL++ are in the
- mysqlpp namespace now if you
- use the new mysql++.h header. If
- you use the older sqlplus.hh or
- mysql++.hh headers, these symbols
- are hoist up into the global namespace. The older headers
- cause the compiler to emit warnings if you use them,
- and they will go away someday.
-
-
-
-
- v2.0.0
-
-
- Connection class changes
-
-
- Connection::create_db()
- and drop_db() return
- true on success. They
- returned false in
- v1.7.x! This change will
- only affect your code if you have exceptions
- disabled.
-
- Renamed
- Connection::real_connect()
- to connect(), made several
- more of its parameters default, and removed the
- old connect() method, as
- it's now a strict subset of the new one. The only
- practical consequence is that if your program was
- using real_connect(),
- you will have to change it to
- connect().
-
- Replaced
- Connection::read_option()
- with new set_option()
- mechanism. In addition to changing the name,
- programs using this function will have to use
- the new Connection::Option
- enumerated values, accept a true
- return value as meaning success instead of 0,
- and use the proper argument type. Regarding the
- latter, read_option()
- took a const char* argument, but
- because it was just a thin wrapper over the
- MySQL C API function , the actual value being pointed
- to could be any of several types. This new
- mechanism is properly type-safe.
-
-
-
-
-
- Exception-related changes
-
-
- Classes
- Connection,
- Query,
- Result,
- ResUse, and
- Row now derive from
- which gives these classes a common interface
- for disabling exceptions. In addition, almost
- all of the per-method exception-disabling
- flags were removed. The preferred method
- for disabling exceptions on these objects
- is to create an instance of the new class
- on the stack, which disables exceptions on an
- OptionalExceptions subclass
- as long as the NoExceptions
- instance is in scope. You can instead call
- disable_exceptions()
- on any of these objects, but if you only want
- them disabled temporarily, it's easy to forget
- to re-enable them later.
-
- In the previous version of
- MySQL++, those classes that supported optional
- exceptions that could create instances of other
- such classes were supposed to pass this flag
- on to their children. That is, if you created
- a Connection object
- with exceptions enabled, and then asked it to
- create a Query object,
- the Query object also had
- exceptions disabled. The problem is, this didn't
- happen in all cases where it should have in v1.7.
- This bug is fixed in v2.0. If your program begins
- crashing due to uncaught exceptions after upgrading
- to v2.0, this is the most likely cause. The most
- expeditious fix in this situation is to use the
- new NoExceptions feature to
- return these code paths to the v1.7 behavior. A
- better fix is to rework your program to avoid or
- deal with the new exceptions.
-
- All custom MySQL++ exceptions
- now derive from the new interface. The practical
- upshot of this is that the variability
- between the various exception types has been
- eliminated. For instance, to get the error
- string, the BadQuery
- exception had a string member called
- error plus a method called
- what(). Both did the same
- thing, and the what()
- method is more common, so the error string was
- dropped from the interface. None of the example
- programs had to be changed to work with the new
- exceptions, so if your program handles MySQL++
- exceptions the same way they do, your program
- won't need to change, either.
-
- Renamed
- SQLQueryNEParams exception
- to BadParamCount to match
- style of other exception names.
-
- Added
- ,
- ,
- ,
- ,
- ,
- , and
-
- exception types, to fix overuse of
- BadQuery. Now the latter
- is used only for errors on query execution. If
- your program has a "catch-all" block taking
- a std::exception for
- each try block containing MySQL++ statements,
- you probably won't need to change your
- program. Otherwise, the new exceptions will
- likely show up as program crashes due to unhandled
- exceptions.
-
-
-
-
-
- Query class changes
-
-
- In previous versions,
- Connection
- had a querying interface similar to class
- Query's. These methods were
- intended only for Query's
- use; no example ever used this interface directly,
- so no end-user code is likely to be affected by
- this change.
-
- A more likely problem
- arising from the above change is code that
- tests for query success by calling the
- Connection object's
- success() method or by
- casting it to bool. This will now
- give misleading results, because queries no longer
- go through the Connection
- object. Class Query has
- the same success-testing interface, so use it
- instead.
-
- Query
- now derives from
- std::ostream instead of
- std::stringstream.
-
-
-
-
-
- Result/ResUse class changes
-
-
- Renamed
- ResUse::mysql_result()
- to raw_result() so it's
- database server neutral.
-
- Removed
- ResUse::eof(),
- as it wrapped the deprecated and
- unnecessary MySQL C API function . See
- the simple3 and
- usequery examples to see
- the proper way to test for the end of a result
- set.
-
-
-
-
-
- Row class changes
-
-
- Removed "field name" form of
- Row::field_list().
- It was pointless.
-
- Row
- subscripting works more
- like v1.7.9: one can subscript a
- Row with a string (e.g.
- row["myfield"]), or with
- an integer (e.g. row[5]).
- lookup_by_name() was
- removed. Because row[0]
- is ambiguous (0 could mean the first field, or be
- a null pointer to const char*), there
- is now Row::at(), which
- can look up any field by index.
-
-
-
-
-
- Miscellaneous changes
-
-
- Where possible, all distributed
- Makefiles only build dynamic libraries. (Shared
- objects on most Unices, DLLs on Windows,
- etc.) Unless your program is licensed under
- the GPL or LGPL, you shouldn't have been using
- the static libraries from previous versions
- anyway.
-
- Removed the backwards-compatibility
- headers sqlplus.hh and
- mysql++.hh. If you were
- still using these, you will have to change
- to mysql++.h, which
- will put all symbols in namespace
- mysqlpp.
-
- Can no longer use arrow operator
- (->) on the iterators
- into the Fields,
- Result
- and Row
- containers.
-
-
-
-
-
- v2.2.0
-
- Code like this will have to change:
-
-
-Query q = con.query();
-q << "delete from mytable where myfield=%0:myvalue";
-q.parse();
-q.def["myvalue"] = some_value;
-q.execute();
-
- ...to something more like this:
-
-
-Query q = con.query();
-q << "delete from mytable where myfield=%0";
-q.parse();
-q.execute(some_value);
-
- The first code snippet abuses the default template
- query parameter mechanism (Query::def)
- to fill out the template instead of using one of the
- overloaded forms of execute(),
- store() or
- use() taking one or more
- SQLString parameters. The purpose
- of Query::def is to allow for default
- template parameters over multiple queries. In the first
- snippet above, there is only one parameter, so in order
- to justify the use of template queries in the first
- place, it must be changing with each query. Therefore,
- it isn't really a "default" parameter at all. We did not
- make this change maliciously, but you can understand why
- we are not in any hurry to restore this "feature".
-
- (Incidentally, this change was made to allow better
- support for BLOB columns.)
-
-
-
-
- v2.3.0
-
- Connection::set_option()
- calls now set the connection option immediately, instead
- of waiting until just before the connnection is actually
- established. Code that relied on the old behavior could see
- unhandled exceptions, since option setting errors are now
- thrown from a different part of the code. You want to wrap
- the actual set_option() call now,
- not Connection::connect()
-
- FieldNames and
- FieldTypes are no longer exported
- from the library. If you are using these classes directly
- from Visual C++ or MinGW, your code won't be able to
- dynamically link to a DLL version of the library any
- more. These are internal classes, however, so no one
- should be using them directly.
-
-
-
-
-
- ABI Changes
-
- This section documents those library changes that require
- you to rebuild your program so that it will link with the
- new library. Most of the items in the previous section are
- also ABI changes, but this section is only for those items
- that shouldn't require any code changes in your program.
-
- If you were going to rebuild your program after
- installing the new library anyway, you can probably ignore
- this section.
-
-
-
- v1.7.18
-
- The Query classes now subclass
- from stringstream instead of the
- deprecated strstream.
-
-
-
-
- v1.7.19
-
- Fixed several const-incorrectnesses
- in the Query classes.
-
-
-
-
- v1.7.22
-
- Removed "reset query" parameters from several
- Query class members. This is not
- an API change, because the parameters were given default
- values, and the library would ignore any value other than
- the default. So, any program that tried to make them take
- another value wouldn't have worked anyway.
-
-
-
-
- v1.7.24
-
- Some freestanding functions didn't get moved into
- namespace mysqlpp when that namespace was
- created. This release fixed that. It doesn't affect the
- API if your program's C++ source files say using
- namespace mysqlpp within them.
-
-
-
-
- v2.0.0
-
- Removed Connection::infoo().
- (I'd call this an API change if I thought there were any
- programs out there actually using this...)
-
- Collapsed the Connection
- constructor taking a bool (for setting the throw_exceptions
- flag) and the default constructor into a single constructor
- using a default for the parameter.
-
- Classes Connection and
- Query are now derived from the
- Lockable interface, instead of
- implementing their own lock/unlock functions.
-
- In several instances, functions that took
- objects by value now take them by const reference,
- for efficiency.
-
- Merged SQLQuery class's
- members into class Query.
-
- Merged RowTemplate class's
- members into class Row.
-
- Reordered member variable declarations in some
- classes. The most common instance is when the private
- section was declared before the public section; it is now
- the opposite way. This can change the object's layout
- in memory, so a program linking to the library must be
- rebuilt.
-
- Simplified the date and time class hierarchy.
- used to
- derive from mysql_date,
- used to derive
- from mysql_time, and used to derive from
- both of those. All three of these classes used to derive
- from mysql_dt_base. All of the
- mysql_* classes' functionality and
- data has been folded into the leaf classes, and now the
- only thing shared between them is their dependence on the
- template. Since
- the leaf classes' interface has not changed and end-user
- code shouldn't have been using the other classes, this
- shouldn't affect the API in any practical way.
-
- mysql_type_info now always
- initializes its private num member.
- Previously, this would go uninitialized if you used
- the default constructor. Now there is no default
- ctor, but the ctor taking one argument (which sets
- num) has a default.
-
-
-
-
-
-
- Licensing
-
- The primary copyright holders on the MySQL++ library and
- its documentation are Kevin Atkinson (1998), MySQL AB (1999
- through 2001) and Educational Technology Resources, Inc. (2004
- through the date of this writing). There are other contributors,
- who also retain copyrights on their additions; see the ChangeLog
- file in the MySQL++ distribution tarball for details.
-
- The MySQL++ library and its Reference Manual are released
- under the GNU Lesser General Public License (LGPL), reproduced
- below.
-
- The MySQL++ User Manual — excepting some example
- code from the library reproduced within it — is offered
- under a license closely based on the Linux Documentation Project
- License (LDPL) v2.0, included below. (The MySQL++ documentation
- isn't actually part of the Linux Documentation Project, so
- the main changes are to LDP-related language. Also, generic
- language such as "author's (or authors')" has been replaced
- with specific language, because the license applies to only
- this one document.)
-
- These licenses basically state that you are free to use,
- distribute and modify these works, whether for personal or
- commercial purposes, as long as you grant the same rights to
- those you distribute the works to, whether you changed them or
- not. See the licenses below for full details.
-
-
-
-
- GNU Lesser General Public License
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is
- permitted to copy and distribute verbatim copies of this license
- document, but changing it is not allowed.
-
- [This is the first released version of the Lesser GPL.
- It also counts as the successor of the GNU Library Public License,
- version 2, hence the version number 2.1.]
-
-
- Preamble
-
- The licenses for most software are designed to take
- away your freedom to share and change it. By contrast, the
- GNU General Public Licenses are intended to guarantee your
- freedom to share and change free software--to make sure the
- software is free for all its users.
-
- This license, the Lesser General Public License, applies
- to some specially designated software packages--typically
- libraries--of the Free Software Foundation and other authors
- who decide to use it. You can use it too, but we suggest
- you first think carefully about whether this license or the
- ordinary General Public License is the better strategy to use
- in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to
- freedom of use, not price. Our General Public Licenses are
- designed to make sure that you have the freedom to distribute
- copies of free software (and charge for this service if you
- wish); that you receive source code or can get it if you want
- it; that you can change the software and use pieces of it in
- new free programs; and that you are informed that you can do
- these things.
-
- To protect your rights, we need to make restrictions
- that forbid distributors to deny you these rights or to ask
- you to surrender these rights. These restrictions translate
- to certain responsibilities for you if you distribute copies
- of the library or if you modify it.
-
- For example, if you distribute copies of the library,
- whether gratis or for a fee, you must give the recipients all
- the rights that we gave you. You must make sure that they,
- too, receive or can get the source code. If you link other
- code with the library, you must provide complete object
- files to the recipients, so that they can relink them
- with the library after making changes to the library and
- recompiling it. And you must show them these terms so they
- know their rights.
-
- We protect your rights with a two-step method: (1)
- we copyright the library, and (2) we offer you this license,
- which gives you legal permission to copy, distribute and/or
- modify the library.
-
- To protect each distributor, we want to make it very
- clear that there is no warranty for the free library. Also,
- if the library is modified by someone else and passed on, the
- recipients should know that what they have is not the original
- version, so that the original author's reputation will not be
- affected by problems that might be introduced by others.
-
- Finally, software patents pose a constant threat to the
- existence of any free program. We wish to make sure that a
- company cannot effectively restrict the users of a free program
- by obtaining a restrictive license from a patent holder.
- Therefore, we insist that any patent license obtained for
- a version of the library must be consistent with the full
- freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered
- by the ordinary GNU General Public License. This license,
- the GNU Lesser General Public License, applies to certain
- designated libraries, and is quite different from the ordinary
- General Public License. We use this license for certain
- libraries in order to permit linking those libraries into
- non-free programs.
-
- When a program is linked with a library, whether
- statically or using a shared library, the combination of
- the two is legally speaking a combined work, a derivative of
- the original library. The ordinary General Public License
- therefore permits such linking only if the entire combination
- fits its criteria of freedom. The Lesser General Public
- License permits more lax criteria for linking other code with
- the library.
-
- We call this license the "Lesser" General Public License
- because it does Less to protect the user's freedom than the
- ordinary General Public License. It also provides other
- free software developers Less of an advantage over competing
- non-free programs. These disadvantages are the reason we
- use the ordinary General Public License for many libraries.
- However, the Lesser license provides advantages in certain
- special circumstances.
-
- For example, on rare occasions, there may be a special
- need to encourage the widest possible use of a certain
- library, so that it becomes a de-facto standard. To achieve
- this, non-free programs must be allowed to use the library.
- A more frequent case is that a free library does the same job
- as widely used non-free libraries. In this case, there is
- little to gain by limiting the free library to free software
- only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library
- in non-free programs enables a greater number of people to
- use a large body of free software. For example, permission
- to use the GNU C Library in non-free programs enables many
- more people to use the whole GNU operating system, as well
- as its variant, the GNU/Linux operating system.
-
- Although the Lesser General Public License is Less
- protective of the users' freedom, it does ensure that the
- user of a program that is linked with the Library has the
- freedom and the wherewithal to run that program using a
- modified version of the Library.
-
- The precise terms and conditions for copying,
- distribution and modification follow. Pay close attention
- to the difference between a "work based on the library" and
- a "work that uses the library". The former contains code
- derived from the library, whereas the latter must be combined
- with the library in order to run.
-
-
-
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
- MODIFICATION
-
- 0. This License Agreement applies to any software
- library or other program which contains a notice placed by
- the copyright holder or other authorized party saying it
- may be distributed under the terms of this Lesser General
- Public License (also called "this License"). Each licensee
- is addressed as "you".
-
- A "library" means a collection of software functions
- and/or data prepared so as to be conveniently linked with
- application programs (which use some of those functions and
- data) to form executables.
-
- The "Library", below, refers to any such software
- library or work which has been distributed under these terms.
- A "work based on the Library" means either the Library or any
- derivative work under copyright law: that is to say, a work
- containing the Library or a portion of it, either verbatim
- or with modifications and/or translated straightforwardly
- into another language. (Hereinafter, translation is included
- without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form
- of the work for making modifications to it. For a library,
- complete source code means all the source code for all modules
- it contains, plus any associated interface definition files,
- plus the scripts used to control compilation and installation
- of the library.
-
- Activities other than copying, distribution and
- modification are not covered by this License; they are outside
- its scope. The act of running a program using the Library
- is not restricted, and output from such a program is covered
- only if its contents constitute a work based on the Library
- (independent of the use of the Library in a tool for writing
- it). Whether that is true depends on what the Library does
- and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the
- Library's complete source code as you receive it, in any
- medium, provided that you conspicuously and appropriately
- publish on each copy an appropriate copyright notice and
- disclaimer of warranty; keep intact all the notices that
- refer to this License and to the absence of any warranty;
- and distribute a copy of this License along with the
- Library.
-
- You may charge a fee for the physical act of transferring
- a copy, and you may at your option offer warranty protection
- in exchange for a fee.
-
- 2. You may modify your copy or copies of the Library or
- any portion of it, thus forming a work based on the Library,
- and copy and distribute such modifications or work under the
- terms of Section 1 above, provided that you also meet all of
- these conditions:
-
-
- a) The modified work must itself be a software
- library.
-
- b) You must cause the files modified to carry
- prominent notices stating that you changed the files and
- the date of any change.
-
- c) You must cause the whole of the work to be
- licensed at no charge to all third parties under the
- terms of this License.
-
- d) If a facility in the modified Library refers
- to a function or a table of data to be supplied by an
- application program that uses the facility, other than as
- an argument passed when the facility is invoked, then you
- must make a good faith effort to ensure that, in the event
- an application does not supply such function or table,
- the facility still operates, and performs whatever part
- of its purpose remains meaningful.
-
- (For example, a function in a library to compute
- square roots has a purpose that is entirely well-defined
- independent of the application. Therefore, Subsection 2d
- requires that any application-supplied function or table
- used by this function must be optional: if the application
- does not supply it, the square root function must still
- compute square roots.)
-
-
- These requirements apply to the modified work as a whole.
- If identifiable sections of that work are not derived from
- the Library, and can be reasonably considered independent and
- separate works in themselves, then this License, and its terms,
- do not apply to those sections when you distribute them as
- separate works. But when you distribute the same sections
- as part of a whole which is a work based on the Library,
- the distribution of the whole must be on the terms of this
- License, whose permissions for other licensees extend to the
- entire whole, and thus to each and every part regardless of
- who wrote it.
-
- Thus, it is not the intent of this section to claim
- rights or contest your rights to work written entirely by
- you; rather, the intent is to exercise the right to control
- the distribution of derivative or collective works based on
- the Library.
-
- In addition, mere aggregation of another work not
- based on the Library with the Library (or with a work based
- on the Library) on a volume of a storage or distribution
- medium does not bring the other work under the scope of this
- License.
-
- 3. You may opt to apply the terms of the ordinary GNU
- General Public License instead of this License to a given
- copy of the Library. To do this, you must alter all the
- notices that refer to this License, so that they refer to the
- ordinary GNU General Public License, version 2, instead of
- to this License. (If a newer version than version 2 of the
- ordinary GNU General Public License has appeared, then you
- can specify that version instead if you wish.) Do not make
- any other change in these notices.
-
- Once this change is made in a given copy, it is
- irreversible for that copy, so the ordinary GNU General Public
- License applies to all subsequent copies and derivative works
- made from that copy.
-
- This option is useful when you wish to copy part
- of the code of the Library into a program that is not a
- library.
-
- 4. You may copy and distribute the Library (or a
- portion or derivative of it, under Section 2) in object code
- or executable form under the terms of Sections 1 and 2 above
- provided that you accompany it with the complete corresponding
- machine-readable source code, which must be distributed under
- the terms of Sections 1 and 2 above on a medium customarily
- used for software interchange.
-
- If distribution of object code is made by offering access
- to copy from a designated place, then offering equivalent
- access to copy the source code from the same place satisfies
- the requirement to distribute the source code, even though
- third parties are not compelled to copy the source along with
- the object code.
-
- 5. A program that contains no derivative of any portion
- of the Library, but is designed to work with the Library by
- being compiled or linked with it, is called a "work that uses
- the Library". Such a work, in isolation, is not a derivative
- work of the Library, and therefore falls outside the scope
- of this License.
-
- However, linking a "work that uses the Library" with
- the Library creates an executable that is a derivative of
- the Library (because it contains portions of the Library),
- rather than a "work that uses the library". The executable
- is therefore covered by this License. Section 6 states terms
- for distribution of such executables.
-
- When a "work that uses the Library" uses material from a
- header file that is part of the Library, the object code for
- the work may be a derivative work of the Library even though
- the source code is not. Whether this is true is especially
- significant if the work can be linked without the Library,
- or if the work is itself a library. The threshold for this
- to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters,
- data structure layouts and accessors, and small macros and
- small inline functions (ten lines or less in length), then the
- use of the object file is unrestricted, regardless of whether
- it is legally a derivative work. (Executables containing
- this object code plus portions of the Library will still fall
- under Section 6.)
-
- Otherwise, if the work is a derivative of the Library,
- you may distribute the object code for the work under the
- terms of Section 6. Any executables containing that work
- also fall under Section 6, whether or not they are linked
- directly with the Library itself.
-
- 6. As an exception to the Sections above, you may
- also combine or link a "work that uses the Library" with
- the Library to produce a work containing portions of the
- Library, and distribute that work under terms of your choice,
- provided that the terms permit modification of the work for
- the customer's own use and reverse engineering for debugging
- such modifications.
-
- You must give prominent notice with each copy of the
- work that the Library is used in it and that the Library
- and its use are covered by this License. You must supply a
- copy of this License. If the work during execution displays
- copyright notices, you must include the copyright notice for
- the Library among them, as well as a reference directing the
- user to the copy of this License. Also, you must do one of
- these things:
-
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including
- whatever changes were used in the work (which must
- be distributed under Sections 1 and 2 above); and,
- if the work is an executable linked with the Library,
- with the complete machine-readable "work that uses the
- Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce
- a modified executable containing the modified Library.
- (It is understood that the user who changes the contents
- of definitions files in the Library will not necessarily
- be able to recompile the application to use the modified
- definitions.)
-
- b) Use a suitable shared library mechanism for
- linking with the Library. A suitable mechanism is one
- that (1) uses at run time a copy of the library already
- present on the user's computer system, rather than copying
- library functions into the executable, and (2) will
- operate properly with a modified version of the library,
- if the user installs one, as long as the modified version
- is interface-compatible with the version that the work
- was made with.
-
- c) Accompany the work with a written offer, valid for
- at least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering
- access to copy from a designated place, offer equivalent
- access to copy the above specified materials from the
- same place.
-
- e) Verify that the user has already received a
- copy of these materials or that you have already sent
- this user a copy.
-
-
- For an executable, the required form of the "work that
- uses the Library" must include any data and utility programs
- needed for reproducing the executable from it. However,
- as a special exception, the materials to be distributed need
- not include anything that is normally distributed (in either
- source or binary form) with the major components (compiler,
- kernel, and so on) of the operating system on which the
- executable runs, unless that component itself accompanies
- the executable.
-
- It may happen that this requirement contradicts the
- license restrictions of other proprietary libraries that do not
- normally accompany the operating system. Such a contradiction
- means you cannot use both them and the Library together in
- an executable that you distribute.
-
- 7. You may place library facilities that are a work
- based on the Library side-by-side in a single library together
- with other library facilities not covered by this License,
- and distribute such a combined library, provided that the
- separate distribution of the work based on the Library and
- of the other library facilities is otherwise permitted,
- and provided that you do these two things:
-
-
- a) Accompany the combined library with a copy of
- the same work based on the Library, uncombined with any
- other library facilities. This must be distributed under
- the terms of the Sections above.
-
- b) Give prominent notice with the combined library of
- the fact that part of it is a work based on the Library,
- and explaining where to find the accompanying uncombined
- form of the same work.
-
-
- 8. You may not copy, modify, sublicense, link with,
- or distribute the Library except as expressly provided
- under this License. Any attempt otherwise to copy, modify,
- sublicense, link with, or distribute the Library is void, and
- will automatically terminate your rights under this License.
- However, parties who have received copies, or rights, from
- you under this License will not have their licenses terminated
- so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License,
- since you have not signed it. However, nothing else grants
- you permission to modify or distribute the Library or its
- derivative works. These actions are prohibited by law if
- you do not accept this License. Therefore, by modifying or
- distributing the Library (or any work based on the Library),
- you indicate your acceptance of this License to do so, and
- all its terms and conditions for copying, distributing or
- modifying the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work
- based on the Library), the recipient automatically receives
- a license from the original licensor to copy, distribute,
- link with or modify the Library subject to these terms and
- conditions. You may not impose any further restrictions
- on the recipients' exercise of the rights granted herein.
- You are not responsible for enforcing compliance by third
- parties with this License.
-
- 11. If, as a consequence of a court judgment or
- allegation of patent infringement or for any other reason
- (not limited to patent issues), conditions are imposed
- on you (whether by court order, agreement or otherwise)
- that contradict the conditions of this License, they do not
- excuse you from the conditions of this License. If you cannot
- distribute so as to satisfy simultaneously your obligations
- under this License and any other pertinent obligations, then
- as a consequence you may not distribute the Library at all.
- For example, if a patent license would not permit royalty-free
- redistribution of the Library by all those who receive copies
- directly or indirectly through you, then the only way you
- could satisfy both it and this License would be to refrain
- entirely from distribution of the Library.
-
- If any portion of this section is held invalid or
- unenforceable under any particular circumstance, the balance
- of the section is intended to apply, and the section as a
- whole is intended to apply in other circumstances.
-
- It is not the purpose of this section to induce you
- to infringe any patents or other property right claims or
- to contest validity of any such claims; this section has the
- sole purpose of protecting the integrity of the free software
- distribution system which is implemented by public license
- practices. Many people have made generous contributions to
- the wide range of software distributed through that system
- in reliance on consistent application of that system; it is
- up to the author/donor to decide if he or she is willing to
- distribute software through any other system and a licensee
- cannot impose that choice.
-
- This section is intended to make thoroughly clear
- what is believed to be a consequence of the rest of this
- License.
-
- 12. If the distribution and/or use of the Library
- is restricted in certain countries either by patents or by
- copyrighted interfaces, the original copyright holder who
- places the Library under this License may add an explicit
- geographical distribution limitation excluding those countries,
- so that distribution is permitted only in or among countries
- not thus excluded. In such case, this License incorporates the
- limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised
- and/or new versions of the Lesser General Public License from
- time to time. Such new versions will be similar in spirit
- to the present version, but may differ in detail to address
- new problems or concerns.
-
- Each version is given a distinguishing version number.
- If the Library specifies a version number of this License which
- applies to it and "any later version", you have the option of
- following the terms and conditions either of that version or of
- any later version published by the Free Software Foundation.
- If the Library does not specify a license version number,
- you may choose any version ever published by the Free Software
- Foundation.
-
- 14. If you wish to incorporate parts of the Library
- into other free programs whose distribution conditions are
- incompatible with these, write to the author to ask for
- permission. For software which is copyrighted by the Free
- Software Foundation, write to the Free Software Foundation;
- we sometimes make exceptions for this. Our decision will be
- guided by the two goals of preserving the free status of all
- derivatives of our free software and of promoting the sharing
- and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE,
- THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED
- BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING
- THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
- "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
- IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
- LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE,
- YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
- CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW
- OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY
- OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS
- PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
- GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
- OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT
- NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE
- OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
- THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
- HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
-
-
-
- How to Apply These Terms to Your New
- Libraries
-
- If you develop a new library, and you want it to be of
- the greatest possible use to the public, we recommend making
- it free software that everyone can redistribute and change.
- You can do so by permitting redistribution under these terms
- (or, alternatively, under the terms of the ordinary General
- Public License).
-
- To apply these terms, attach the following notices to
- the library. It is safest to attach them to the start of
- each source file to most effectively convey the exclusion of
- warranty; and each file should have at least the "copyright"
- line and a pointer to where the full notice is found.
-
-
-
- Also add information on how to contact you by electronic
- and paper mail.
-
- You should also get your employer (if you work as
- a programmer) or your school, if any, to sign a "copyright
- disclaimer" for the library, if necessary. Here is a sample;
- alter the names:
-
-
- Yoyodyne, Inc., hereby disclaims all copyright
- interest in the library `Frob' (a library for tweaking
- knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
-
- Ty Coon, President of Vice
-
-
- That's all there is to it!
-
-
-
-
-
-
- MySQL++ User Manual License
-
-
- I. COPYRIGHT
-
- The copyright to the MySQL++ User Manual is owned by
- its authors.
-
-
-
- II. LICENSE
-
- The MySQL++ User Manual may be reproduced and
- distributed in whole or in part, in any medium physical or
- electronic, provided that this license notice is displayed
- in the reproduction. Commercial redistribution is permitted
- and encouraged. Thirty days advance notice via email to the
- authors of redistribution is appreciated, to give the authors
- time to provide updated documents.
-
-
- A. REQUIREMENTS OF MODIFIED WORKS
-
- All modified documents, including translations,
- anthologies, and partial documents, must meet the following
- requirements:
-
-
- The modified version must be labeled
- as such.
-
- The person making the modifications
- must be identified.
-
- Acknowledgement of the original author
- must be retained.
-
- The location of the original unmodified
- document be identified.
-
- The original authors' names may
- not be used to assert or imply endorsement of the
- resulting document without the original authors'
- permission.
-
-
- In addition it is requested that:
-
-
- The modifications (including deletions)
- be noted.
-
- The authors be notified by email of the
- modification in advance of redistribution, if an email
- address is provided in the document.
-
-
- Mere aggregation of the MySQL++ User Manual with
- other documents or programs on the same media shall not
- cause this license to apply to those other works.
-
- All translations, derivative documents, or modified
- documents that incorporate the MySQL++ User Manual may
- not have more restrictive license terms than these,
- except that you may require distributors to make the
- resulting document available in source format.
-
-
-
-
-
-
ADDED examples/Makefile.am
Index: examples/Makefile.am
==================================================================
--- /dev/null
+++ examples/Makefile.am
@@ -0,0 +1,24 @@
+noinst_PROGRAMS = resetdb simple1 custom1 custom2 custom3 custom4 complic1 fieldinf1
+
+noinst_HEADERS = util.hh
+
+LDADD = $(top_builddir)/sqlplusint/libsqlplus.la @MYSQL_LIBS@
+INCLUDES = -I$(top_srcdir)/sqlplusint @MYSQL_CFLAGS@
+
+simple1_SOURCES = simple1.cc
+
+# sinisa_ex_SOURCES = sinisa_ex.cc
+
+resetdb_SOURCES = resetdb.cc util.cc
+
+custom1_SOURCES = custom1.cc
+
+custom2_SOURCES = custom2.cc util.cc
+
+custom3_SOURCES = custom3.cc util.cc
+
+custom4_SOURCES = custom4.cc
+
+complic1_SOURCES = complic1.cc
+
+fieldinf1_SOURCES = fieldinf1.cc
DELETED examples/cgi_jpeg.cpp
Index: examples/cgi_jpeg.cpp
==================================================================
--- examples/cgi_jpeg.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/***********************************************************************
- cgi_jpeg.cpp - Example code showing how to fetch JPEG data from a BLOB
- column and send it back to a browser that requested it by ID.
-
- Use load_jpeg.cpp to load JPEG files into the database we query.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004-2007 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include
-#include
-
-using namespace std;
-using namespace mysqlpp;
-
-#define IMG_DATABASE "mysql_cpp_data"
-#define IMG_HOST "localhost"
-#define IMG_USER "root"
-#define IMG_PASSWORD "nunyabinness"
-
-sql_create_2(images,
- 1, 2,
- mysqlpp::sql_int_unsigned, id,
- mysqlpp::sql_blob, data)
-
-int
-main()
-{
- unsigned int img_id = 0;
- char* cgi_query = getenv("QUERY_STRING");
- if (cgi_query) {
- if ((strlen(cgi_query) < 4) || memcmp(cgi_query, "id=", 3)) {
- cout << "Content-type: text/plain" << endl << endl;
- cout << "ERROR: Bad query string" << endl;
- return 1;
- }
- else {
- img_id = atoi(cgi_query + 3);
- }
- }
- else {
- cerr << "Put this program into a web server's cgi-bin "
- "directory, then" << endl;
- cerr << "invoke it with a URL like this:" << endl;
- cerr << endl;
- cerr << " http://server.name.com/cgi-bin/cgi_jpeg?id=2" <<
- endl;
- cerr << endl;
- cerr << "This will retrieve the image with ID 2." << endl;
- cerr << endl;
- cerr << "You will probably have to change some of the #defines "
- "at the top of" << endl;
- cerr << "examples/cgi_jpeg.cpp to allow the lookup to work." <<
- endl;
- return 1;
- }
-
- Connection con(use_exceptions);
- try {
- con.connect(IMG_DATABASE, IMG_HOST, IMG_USER, IMG_PASSWORD);
- Query query = con.query();
- query << "SELECT * FROM images WHERE id = " << img_id;
- ResUse res = query.use();
- if (res) {
- images img = res.fetch_row();
- cout << "Content-type: image/jpeg" << endl;
- cout << "Content-length: " << img.data.length() << "\n\n";
- cout << img.data;
- }
- else {
- cout << "Content-type: text/plain" << endl << endl;
- cout << "ERROR: No such image with ID " << img_id << endl;
- }
- }
- catch (const BadQuery& er) {
- // Handle any query errors
- cout << "Content-type: text/plain" << endl << endl;
- cout << "QUERY ERROR: " << er.what() << endl;
- return 1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cout << "Content-type: text/plain" << endl << endl;
- cout << "GENERAL ERROR: " << er.what() << endl;
- return 1;
- }
-
- return 0;
-}
ADDED examples/complic1.cc
Index: examples/complic1.cc
==================================================================
--- /dev/null
+++ examples/complic1.cc
@@ -0,0 +1,68 @@
+
+#include
+#include
+#include
+
+int main() {
+ try { // its in one big try block
+
+ Connection con(use_exceptions);
+ con.connect("mysql_cpp_data");
+ // Here I broke making the connection into two calls.
+ // The first one creates the Connection object with the
+ // use exceptions option turned on and the second one
+ // makes the connection
+
+ Query query = con.query();
+
+ query << "select * from stock";
+ Result res = query.store();
+
+ cout << "Query: " << query.preview() << endl;
+ cout << "Records Found: " << res.size() << endl << endl;
+
+ Row row;
+ cout.setf(ios::left);
+ cout << setw(17) << "Item"
+ << setw(4) << "Num"
+ << setw(7) << "Weight"
+ << setw(7) << "Price"
+ << "Date" << endl
+ << endl;
+
+ Result::iterator i;
+
+ cout.precision(3);
+ for (i = res.begin(); i != res.end(); i++) {
+ row = *i;
+ cout << setw(17) << row["item"] << setw(4) << row[1]
+ << setw(7) << (double)row[2]
+ // This is converting the row to a double so that we
+ // can set the precision of it.
+ // ColData has the nice feature that it will convert to
+ // any of the basic c++ types. if there is a problem
+ // in the conversion it will throw an exception (which I
+ // cache below). To test it try changing the 2 in row[2]
+ // to row[0]
+ << setw(7) << (double)row[3];
+ Date date = row["sdate"];
+ // The ColData is implicitly converted to a date here.
+ cout.setf(ios::right);
+ cout.fill('0');
+ cout << setw(2) << date.month << "-" << setw(2) << date.day << endl;
+ cout.fill(' ');
+ cout.unsetf(ios::right);
+ }
+ return 0;
+ } catch (BadQuery er) { // handle any connection or
+ // query errors that may come up
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ } catch (BadConversion er) { // handle bad conversions
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
+
+
ADDED examples/custom1.cc
Index: examples/custom1.cc
==================================================================
--- /dev/null
+++ examples/custom1.cc
@@ -0,0 +1,78 @@
+
+#include
+#include
+#include
+#include
+#include
+
+sql_create_5 (stock, // struct name,
+ 1, 5, // I'll explain these latter
+ string, item, // type, id
+ int, num,
+ double, weight,
+ double, price,
+ Date, sdate)
+
+// this is calling a very complex macro which will create a custom
+// struct "stock" which has the variables:
+// string item
+// int num
+// ...
+// Date sdate
+// defined as well methods to help populate the class from a mysql row
+// among other things that I'll get too in a latter example
+
+int main () {
+ try { // its in one big try block
+ Connection con (use_exceptions);
+ con.connect ("mysql_cpp_data");
+ Query query = con.query ();
+ query << "select * from stock";
+
+ vector < stock > res;
+ query.storein (res);
+ // this is storing the results into a vector of the custom struct
+ // "stock" which was created my the macro above.
+
+ cout.setf (ios::left);
+ cout << setw (17) << "Item"
+ << setw (4) << "Num"
+ << setw (7) << "Weight"
+ << setw (7) << "Price"
+ << "Date" << endl
+ << endl;
+
+ // Now we we iterate through the vector using an iterator and
+ // produce output similar to that using Row
+ // Notice how we call the actual variables in i and not an index
+ // offset. This is because the macro at the begging of the file
+ // set up an *actual* struct of type stock which contains the
+ // variables item, num, weight, price, and data.
+
+ cout.precision(3);
+ vector ::iterator i;
+ for (i = res.begin (); i != res.end (); i++) {
+ cout << setw (17) << i->item.c_str ()
+ // unfortunally the gnu string class does not respond to format
+ // modifers so I have to convert it to a conat char *.
+ << setw (4) << i->num
+ << setw (7) << i->weight
+ << setw (7) << i->price
+ << i->sdate
+ << endl;
+ }
+ return 0;
+
+ } catch (BadQuery er){ // handle any connection
+ // or query errors that may come up
+ cerr << "Error: " << er.error << endl;
+ return -1;
+
+ } catch (BadConversion er) {
+ // we still need to cache bad conversions incase something goes
+ // wrong when the data is converted into stock
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
DELETED examples/custom1.cpp
Index: examples/custom1.cpp
==================================================================
--- examples/custom1.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/***********************************************************************
- custom1.cpp - Example that produces the same results as simple1, but it
- uses a Specialized SQL Structure to store the results instead of a
- MySQL++ Result object.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "stock.h"
-#include "util.h"
-
-#include
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- // Wrap all MySQL++ interactions in one big try block, so any
- // errors are handled gracefully.
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Retrieve the entire contents of the stock table, and store
- // the data in a vector of 'stock' SSQLS structures.
- mysqlpp::Query query = con.query();
- query << "select * from stock";
- vector res;
- query.storein(res);
-
- // Display the result set
- print_stock_header(res.size());
- vector::iterator it;
- for (it = res.begin(); it != res.end(); ++it) {
- print_stock_row(it->item, it->num, it->weight, it->price,
- it->sdate);
- }
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions; e.g. type mismatch populating 'stock'
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
ADDED examples/custom2.cc
Index: examples/custom2.cc
==================================================================
--- /dev/null
+++ examples/custom2.cc
@@ -0,0 +1,49 @@
+
+#include
+#include
+#include
+#include
+#include "util.hh"
+// util.hh/cc contains the print_stock_table function
+
+sql_create_5(stock, 1, 5, string, item, int, num,
+ double, weight, double, price, Date, sdate)
+
+int main() {
+ try { // its in one big try block
+
+ Connection con(use_exceptions);
+ con.connect("mysql_cpp_data");
+ Query query = con.query();
+
+ stock row;
+ // create an empty stock object
+
+ /* row.item = "Hot Dogs";
+ row.num = 100;
+ row.weight = 1.5;
+ row.price = 1.75;
+ row.sdate = "1998-09-25"; */
+ row.set("Hot Dogs", 100, 1.5, 1.75, "1998-09-25");
+ // populate stock
+
+ query.insert(row);
+ // form the query to insert the row
+ // the table name is the name of the struct by default
+ cout << "Query : " << query.preview() << endl;
+ // show the query about to be executed
+ query.execute();
+ // execute a query that does not return a result set
+
+ print_stock_table(query);
+ // now print the new table;
+
+ } catch (BadQuery er) {
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ } catch (BadConversion er) {
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
DELETED examples/custom2.cpp
Index: examples/custom2.cpp
==================================================================
--- examples/custom2.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/***********************************************************************
- custom2.cpp - Example showing how to insert a row using the Specialized
- SQL Structures feature of MySQL++.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "stock.h"
-#include "util.h"
-
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Create and populate a stock object. We could also have used
- // the set() member, which takes the same parameters as this
- // constructor.
- stock row("Hot Dogs", 100, 1.5, 1.75, "1998-09-25");
-
- // Form the query to insert the row into the stock table.
- mysqlpp::Query query = con.query();
- query.insert(row);
-
- // Show the query about to be executed.
- cout << "Query: " << query.preview() << endl;
-
- // Execute the query. We use execute() because INSERT doesn't
- // return a result set.
- query.execute();
-
- // Print the new table.
- mysqlpp::Result res;
- get_stock_table(query, res);
- print_stock_rows(res);
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
ADDED examples/custom3.cc
Index: examples/custom3.cc
==================================================================
--- /dev/null
+++ examples/custom3.cc
@@ -0,0 +1,56 @@
+
+#include
+#include
+#include
+#include
+#include "util.hh"
+// util.hh/cc contains the print_stock_table function
+
+sql_create_5(stock, 1, 5, string, item, int, num,
+ double, weight, double, price, Date, sdate)
+
+int main() {
+ try { // its in one big try block
+
+ Connection con(use_exceptions);
+ con.connect("mysql_cpp_data");
+ Query query = con.query();
+
+ query << "select * from stock where item = \"Hotdogs' Buns\" ";
+
+ Result res = query.store();
+ if (res.empty())
+ throw BadQuery("Hotdogs' Buns not found in table, run reset-db");
+ // here we are testing if the query was successful, if not throw a bad query
+ stock row = res[0];
+ // because there should only be one row in this query we don't
+ // need to use a vector. Just store the first row directly in
+ // "row". We can do this because one of the constructors for
+ // stock takes a Row as an parameter.
+
+ stock row2 = row;
+ // Now we need to create a copy so that the replace query knows
+ // what the original values are.
+
+ row.item = "Hotdog Buns"; // now change item
+
+ query.update(row2, row);
+ // form the query to replace the row
+ // the table name is the name of the struct by default
+ cout << "Query : " << query.preview() << endl;
+ // show the query about to be executed
+ query.execute();
+ // execute a query that does not return a result set
+
+ print_stock_table(query);
+ // now print the new table;
+
+ } catch (BadQuery er) {
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ } catch (BadConversion er) {
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
DELETED examples/custom3.cpp
Index: examples/custom3.cpp
==================================================================
--- examples/custom3.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/***********************************************************************
- custom3.cpp - Example showing how to update an SQL row using the
- Specialized SQL Structures feature of MySQL++.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "stock.h"
-#include "util.h"
-
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Build a query to retrieve the stock item that has Unicode
- // characters encoded in UTF-8 form.
- mysqlpp::Query query = con.query();
- query << "select * from stock where item = \"Nürnberger Brats\"";
-
- // Retrieve the row, throwing an exception if it fails.
- mysqlpp::Result res = query.store();
- if (res.empty()) {
- throw mysqlpp::BadQuery("UTF-8 bratwurst item not found in "
- "table, run resetdb");
- }
-
- // Because there should only be one row in the result set,
- // there's no point in storing the result in an STL container.
- // We can store the first row directly into a stock structure
- // because one of an SSQLS's constructors takes a Row object.
- stock row = res.at(0);
-
- // Create a copy so that the replace query knows what the
- // original values are.
- stock orig_row = row;
-
- // Change the stock object's item to use only 7-bit ASCII, and
- // to deliberately be wider than normal column widths printed
- // by print_stock_table().
- row.item = "Nuerenberger Bratwurst";
-
- // Form the query to replace the row in the stock table.
- query.update(orig_row, row);
-
- // Show the query about to be executed.
- cout << "Query: " << query.preview() << endl;
-
- // Run the query with execute(), since UPDATE doesn't return a
- // result set.
- query.execute();
-
- // Print the new table contents.
- get_stock_table(query, res);
- print_stock_rows(res);
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
ADDED examples/custom4.cc
Index: examples/custom4.cc
==================================================================
--- /dev/null
+++ examples/custom4.cc
@@ -0,0 +1,73 @@
+
+#include
+#include
+#include
+#include
+#include
+
+sql_create_5(stock,
+ 1, // This number is used to make a SSQLS less-than-comparable.
+ // If this number is n then if the first n elements are the
+ // same the two SSQLS are the same.
+ // In this case if two two stock's "item" are the same then
+ // the two stock are the same.
+ 5, // this number should generally be the same as the number of
+ // elements in the list unless you have a good reason not to.
+
+ string,item, int,num, double,weight, double,price, Date,sdate)
+
+int main() {
+ try { // its in one big try block
+
+ Connection con(use_exceptions);
+ con.connect("mysql_cpp_data");
+ Query query = con.query();
+
+ query << "select * from stock";
+
+ set res;
+ query.storein(res);
+ // here we are storing the elements in a set not a vector.
+
+ cout.setf (ios::left);
+ cout << setw (17) << "Item"
+ << setw (4) << "Num"
+ << setw (7) << "Weight"
+ << setw (7) << "Price"
+ << "Date" << endl
+ << endl;
+
+ // Now we we iterate through the set. Since it is a set the list will
+ // naturally be in order.
+
+ set::iterator i;
+ cout.precision(3);
+ for (i = res.begin (); i != res.end (); i++) {
+ cout << setw (17) << i->item.c_str ()
+ << setw (4) << i->num
+ << setw (7) << i->weight
+ << setw (7) << i->price
+ << i->sdate
+ << endl;
+ }
+
+ i = res.find(stock("Hamburger Buns"));
+ if (i != res.end())
+ cout << "Hamburger Buns found. Currently " << i->num << " in stock.\n";
+ else
+ cout << "Sorry no Hamburger Buns found in stock\n";
+
+ // Now we are using the set's find method to find out how many
+ // Hamburger Buns are in stock.
+
+ return 0;
+
+ } catch (BadQuery er) {
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ } catch (BadConversion er) {
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
DELETED examples/custom4.cpp
Index: examples/custom4.cpp
==================================================================
--- examples/custom4.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/***********************************************************************
- custom4.cpp - Example very similar to custom1.cpp, except that it
- stores its result set in an STL set container. This demonstrates
- how one can manipulate MySQL++ result sets in a very natural C++
- style.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "stock.h"
-#include "util.h"
-
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Retrieve all rows from the stock table and put them in an
- // STL set. Notice that this works just as well as storing them
- // in a vector, which we did in custom1.cpp. It works because
- // SSQLS objects are less-than comparable.
- mysqlpp::Query query = con.query();
- query << "select * from stock";
- set res;
- query.storein(res);
-
- // Display the result set. Since it is an STL set and we set up
- // the SSQLS to compare based on the item column, the rows will
- // be sorted by item.
- print_stock_header(res.size());
- set::iterator it;
- cout.precision(3);
- for (it = res.begin(); it != res.end(); ++it) {
- print_stock_row(it->item.c_str(), it->num, it->weight,
- it->price, it->sdate);
- }
-
- // Use set's find method to look up a stock item by item name.
- // This also uses the SSQLS comparison setup.
- it = res.find(stock("Hotdog Buns"));
- if (it != res.end()) {
- cout << endl << "Currently " << it->num <<
- " hotdog buns in stock." << endl;
- }
- else {
- cout << endl << "Sorry, no hotdog buns in stock." << endl;
- }
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
DELETED examples/custom5.cpp
Index: examples/custom5.cpp
==================================================================
--- examples/custom5.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/***********************************************************************
- custom5.cpp - Example showing how to use the equal_list() member of
- some SSQLS types to build SELECT queries with custom WHERE clauses.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, (c) 2004, 2005 by Educational Technology Resources, Inc., and
- (c) 2005 by Chris Frey. Others may also hold copyrights on code in
- this file. See the CREDITS file in the top directory of the
- distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "stock.h"
-#include "util.h"
-
-#include
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- try {
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Get all the rows in the stock table.
- mysqlpp::Query query = con.query();
- query << "select * from stock";
- vector res;
- query.storein(res);
-
- if (res.size() > 0) {
- // Build a select query using the data from the first row
- // returned by our previous query.
- query.reset();
- query << "select * from stock where " <<
- res[0].equal_list(" and ", stock_weight, stock_price);
-
- // Display the finished query.
- cout << "Custom query:\n" << query.preview() << endl;
- }
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
DELETED examples/custom6.cpp
Index: examples/custom6.cpp
==================================================================
--- examples/custom6.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/***********************************************************************
- custom6.cpp - Same as custom1, except that it requests only a subset of
- the stock table. See also simple1, for another way to accomplish
- the same thing, without using SSQLS.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-#include
-
-#include
-#include
-#include
-
-using namespace std;
-
-// To store a subset of a row, we define an SSQLS containing just the
-// fields that we will store. There are complications here that are
-// covered in the user manual.
-sql_create_1(stock_subset,
- 1, 0,
- string, item)
-
-int
-main(int argc, char *argv[])
-{
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Retrieve a subset of the stock table, and store the data in
- // a vector of 'stock_subset' SSQLS structures.
- mysqlpp::Query query = con.query();
- query << "select item from stock";
- vector res;
- query.storein(res);
-
- // Display the result set
- cout << "We have:" << endl;
- vector::iterator it;
- for (it = res.begin(); it != res.end(); ++it) {
- cout << '\t' << it->item << endl;
- }
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions; e.g. type mismatch populating 'stock'
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
DELETED examples/dbinfo.cpp
Index: examples/dbinfo.cpp
==================================================================
--- examples/dbinfo.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/***********************************************************************
- dbinfo.cpp - Example showing how to request information about the
- database schema, such as table names, column types, etc.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-#include
-#include
-#include
-
-using namespace std;
-using namespace mysqlpp;
-
-vector yy;
-
-static ostream&
-separator(ostream& os)
-{
- os << endl << "---------------------------" << endl << endl;
- return os;
-}
-
-int
-main(int argc, char* argv[])
-{
- Connection con(use_exceptions);
- try {
- connect_to_db(argc, argv, con, "");
-
- // Show MySQL version
- cout << "MySQL version: " << con.client_info() << separator;
- Query query = con.query();
-
- // Show all the databases we can see
- query << "show databases";
- cout << "Query: " << query.preview() << endl;
-
- Result res = query.store();
- cout << "Databases found: " << res.size();
-
- Row row;
- cout.setf(ios::left);
- Result::iterator i;
- for (i = res.begin(); i != res.end(); ++i) {
- row = *i;
- cout << endl << '\t' << setw(17) << row.at(0);
- }
- cout << separator;
-
- // Show the tables in the mysql database
- con.select_db("mysql");
-
- query.reset();
- query << "show tables";
- cout << "Query: " << query.preview() << endl;
-
- res = query.store();
- cout << "Tables found: " << res.size();
-
- cout.setf(ios::left);
- for (i = res.begin(); i != res.end(); ++i) {
- row = *i;
- string xx(row.at(0));
- cout << endl << '\t' << setw(17) << row.at(0);
- yy.push_back(xx);
- }
- cout << separator;
-
- // Show information about each of the tables we found
- for (unsigned int j = 0; j < yy.size(); ++j) {
- query.reset();
- query << "describe " << yy[j] << "";
- cout << "Query: " << query.preview() << endl;
- res = query.store();
- unsigned int columns = res.num_fields(), counter;
- vector widths;
- for (counter = 0; counter < columns; counter++) {
- string s = res.names(counter);
- if (s.compare("field") == 0) {
- widths.push_back(22);
- }
- else if (s.compare("type") == 0) {
- widths.push_back(20);
- }
- else if (s.compare("null") == 0) {
- widths.push_back(4);
- }
- else if (s.compare("key") == 0) {
- widths.push_back(3);
- }
- else if (s.compare("extra") == 0) {
- widths.push_back(0);
- }
- else {
- widths.push_back(15);
- }
-
- if (widths[counter]) {
- cout << '|' << setw(widths[counter]) <<
- res.names(counter) << '|';
- }
- }
- cout << endl;
-
- for (i = res.begin(); i != res.end(); ++i) {
- row = *i;
- for (counter = 0; counter < columns; counter++) {
- if (widths[counter]) {
- cout << ' ' << setw(widths[counter]) <<
- row.at(counter) << ' ';
- }
- }
- cout << endl;
- }
-
- cout << separator;
- }
-
- // Show the user table contents
- query.reset();
- query << "select * from user";
- cout << "Query: " << query.preview() << endl << endl;
-
- res = query.store();
- int columns = res.num_fields();
- cout << "fields = " << res.num_fields() << ", rows = " <<
- res.size() << endl;
- volatile MYSQL_RES* ress = res.raw_result();
- if (!ress)
- return -1;
- for (i = res.begin(); i != res.end(); ++i) {
- row = *i;
- for (int counter = 0; counter < columns; counter++) {
- cout << row.at(counter) << " ";
- }
- cout << endl;
- }
- }
- catch (const BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
ADDED examples/fieldinf1.cc
Index: examples/fieldinf1.cc
==================================================================
--- /dev/null
+++ examples/fieldinf1.cc
@@ -0,0 +1,66 @@
+
+#include
+#include
+#include
+
+int main() {
+ try { // its in one big try block
+
+ Connection con(use_exceptions);
+ con.connect("mysql_cpp_data");
+ Query query = con.query();
+ query << "select * from stock";
+ Result res = query.store();
+
+ cout << "Query: " << query.preview() << endl;
+ cout << "Records Found: " << res.size() << endl << endl;
+
+ cout << "Query Info:\n";
+ cout.setf(ios::left);
+
+ for (unsigned int i = 0; i < res.names().size(); i++) {
+ cout << setw(2) << i
+ << setw(15) << res.names(i).c_str()
+ // this is the name of the field
+ << setw(15) << res.types(i).sql_name()
+ // this is the SQL identifier name
+ // Result::types(unsigned int) returns a mysql_type_info which in many
+ // ways is like type_info except that it has additional sql type
+ // information in it. (with one of the methods being sql_name())
+ << setw(20) << res.types(i).name()
+ // this is the C++ identifier name which most closely resembles
+ // the sql name (its is implementation defined and often not very readable)
+ << endl;
+ }
+
+ cout << endl;
+
+ if (res.types(0) == typeid(string))
+ cout << "Field 'item' is of an sql type which most closely resembles a\n"
+ << "the c++ string type\n";
+ // this is demonstrating how a mysql_type_info can be compared with a c++
+ // type_info.
+
+ if (res.types(1) == typeid(short int))
+ cout << "Field 'num' is of an sql type which most closely resembles a\n"
+ << "the c++ short int type\n";
+ else if (res.types(1).base_type() == typeid(short int))
+ cout << "Field 'num' base type is of an sql type which most closely \n"
+ << "resembles a the c++ short int type\n";
+ // However you have to be careful as if it can be null the actual type is
+ // Null not TYPE. So you should always use the base_type method
+ // to get at the underlying type. If the type is not null than this base
+ // type would be the same as its type.
+
+ return 0;
+ } catch (BadQuery er) {
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ } catch (BadConversion er) { // handle bad conversions
+ cerr << "Error: Tried to convert \"" << er.data << "\" to a \""
+ << er.type_name << "\"." << endl;
+ return -1;
+ }
+}
+
+
DELETED examples/fieldinf1.cpp
Index: examples/fieldinf1.cpp
==================================================================
--- examples/fieldinf1.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/***********************************************************************
- fieldinf1.cpp - Example showing how to request information about the
- fields in a table, such as their SQL and C++-equivalent types, as
- MySQL++ sees it.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-#include
-
-using namespace std;
-using namespace mysqlpp;
-
-int
-main(int argc, char *argv[])
-{
- try {
- Connection con(use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- Query query = con.query();
- query << "select * from stock";
- cout << "Query: " << query.preview() << endl;
-
- Result res = query.store();
- cout << "Records Found: " << res.size() << endl << endl;
-
- cout << "Query Info:\n";
- cout.setf(ios::left);
-
- for (unsigned int i = 0; i < res.names().size(); i++) {
- cout << setw(2) << i
- // this is the name of the field
- << setw(15) << res.names(i).c_str()
- // this is the SQL identifier name
- // Result::types(unsigned int) returns a mysql_type_info which in many
- // ways is like type_info except that it has additional sql type
- // information in it. (with one of the methods being sql_name())
- << setw(15) << res.types(i).sql_name()
- // this is the C++ identifier name which most closely resembles
- // the sql name (its is implementation defined and often not very readable)
- << setw(20) << res.types(i).name()
- << endl;
- }
-
- cout << endl;
-
- if (res.types(0) == typeid(string)) {
- // this is demonstrating how a mysql_type_info can be
- // compared with a C++ type_info.
- cout << "Field 'item' is of an SQL type which most "
- "closely resembles\nthe C++ string type\n";
- }
-
- if (res.types(1) == typeid(longlong)) {
- cout << "Field 'num' is of an SQL type which most "
- "closely resembles\nC++ long long int type\n";
- }
- else if (res.types(1).base_type() == typeid(longlong)) {
- // you have to be careful as if it can be null the actual
- // type is Null not TYPE. So you should always use
- // the base_type method to get at the underlying type.
- // If the type is not null than this base type would be
- // the same as its type.
- cout << "Field 'num' base type is of an SQL type which "
- "most closely\nresembles the C++ long long int type\n";
- }
- }
- catch (const BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
DELETED examples/for_each.cpp
Index: examples/for_each.cpp
==================================================================
--- examples/for_each.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/***********************************************************************
- for_each.cpp - Demonstrates Query::for_each(), showing how to perform
- an arbitrary action on each row in a result set.
-
- Copyright (c) 2005-2007 by Joel Fielder and Educational Technology
- Resources, Inc. Others may also hold copyrights on code in this file.
- See the CREDITS file in the top directory of the distribution for
- details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-#include "stock.h"
-
-#include
-
-#include
-
-#include
-
-
-// Define a functor to collect statistics about the stock table
-class gather_stock_stats
-{
-public:
- gather_stock_stats() :
- items_(0),
- weight_(0),
- cost_(0)
- {
- }
-
- void operator()(const stock& s)
- {
- items_ += s.num;
- weight_ += (s.num * s.weight);
- cost_ += (s.num * s.price);
- }
-
-private:
- mysqlpp::sql_bigint items_;
- mysqlpp::sql_double weight_, cost_;
-
- friend std::ostream& operator<<(std::ostream& os,
- const gather_stock_stats& ss);
-};
-
-
-// Dump the contents of gather_stock_stats to a stream in human-readable
-// form.
-std::ostream&
-operator<<(std::ostream& os, const gather_stock_stats& ss)
-{
- os << ss.items_ << " items " <<
- "weighing " << ss.weight_ << " stone and " <<
- "costing " << ss.cost_ << " cowrie shells";
- return os;
-}
-
-
-int
-main(int argc, char *argv[])
-{
- try {
- // Connect to the sample database
- mysqlpp::Connection con;
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Gather and display the stats for the entire stock table
- mysqlpp::Query query = con.query();
- std::cout << "There are " << query.for_each(stock(),
- gather_stock_stats()) << '.' << std::endl;
- }
- catch (const mysqlpp::BadQuery& e) {
- // Something went wrong with the SQL query.
- std::cerr << "Query failed: " << e.what() << std::endl;
- return 1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- std::cerr << "Error: " << er.what() << std::endl;
- return 1;
- }
-
- return 0;
-}
DELETED examples/load_jpeg.cpp
Index: examples/load_jpeg.cpp
==================================================================
--- examples/load_jpeg.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/***********************************************************************
- load_jpeg.cpp - Example showing how to insert BLOB data into the
- database from a file.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004-2007 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-
-using namespace std;
-using namespace mysqlpp;
-
-static bool
-is_jpeg(const unsigned char* img_data)
-{
- return (img_data[0] == 0xFF) && (img_data[1] == 0xD8) &&
- ((memcmp(img_data + 6, "JFIF", 4) == 0) ||
- (memcmp(img_data + 6, "Exif", 4) == 0));
-}
-
-
-int
-main(int argc, char *argv[])
-{
- // Assume that the last command line argument is a file. Try to
- // read that file's data into img_data, and check it to see if it
- // appears to be a JPEG file. Bail otherwise.
- string img_data;
- if ((argc > 1) && (argv[1][0] != '-')) {
- ifstream img_file(argv[argc - 1], ios::ate);
- if (img_file) {
- size_t img_size = img_file.tellg();
- if (img_size > 10) {
- img_file.seekg(0, ios::beg);
- char* img_buffer = new char[img_size];
- img_file.read(img_buffer, img_size);
- if (is_jpeg((unsigned char*)img_buffer)) {
- img_data.assign(img_buffer, img_size);
- }
- else {
- cerr << "File does not appear to be a JPEG!" << endl;
- }
- delete[] img_buffer;
- }
- else {
- cerr << "File is too short to be a JPEG!" << endl;
- }
- }
- }
- if (img_data.empty()) {
- print_usage(argv[0], "[jpeg_file]");
- return 1;
- }
- --argc; // pop filename argument off end of list
-
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(mysqlpp::use_exceptions);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Insert image data into the BLOB column in the images table.
- // We're inserting it as an std::string instead of using the raw
- // data buffer allocated above because we don't want the data
- // treated as a C string, which would truncate the data at the
- // first null character.
- Query query = con.query();
- query << "INSERT INTO images (data) VALUES(\"" <<
- mysqlpp::escape << img_data << "\")";
- ResNSel res = query.execute();
-
- // If we get here, insertion succeeded
- cout << "Inserted \"" << argv[argc] <<
- "\" into images table, " << img_data.size() <<
- " bytes, ID " << res.insert_id << endl;
- }
- catch (const BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return -1;
- }
- catch (const BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return -1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return -1;
- }
-
- return 0;
-}
DELETED examples/logo.jpg
Index: examples/logo.jpg
==================================================================
--- examples/logo.jpg
+++ /dev/null
cannot compute difference between binary files
DELETED examples/multiquery.cpp
Index: examples/multiquery.cpp
==================================================================
--- examples/multiquery.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/***********************************************************************
- multiquery.cpp - Example showing how to iterate over result sets upon
- execution of a query that returns more than one result set. You can
- get multiple result sets when executing multiple separate SQL
- statments in a single query, or when dealing with the results of
- calling a stored procedure.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, (c) 2004, 2005 by Educational Technology Resources, Inc.,
- and (c) 2005 by Arnon Jalon. Others may also hold copyrights on
- code in this file. See the CREDITS file in the top directory of
- the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-#include
-#include
-
-using namespace std;
-using namespace mysqlpp;
-
-
-typedef vector IntVectorType;
-
-
-static void
-print_header(IntVectorType& widths, Result& res)
-{
- cout << " |" << setfill(' ');
- for (size_t i = 0; i < res.names().size(); i++) {
- cout << " " << setw(widths.at(i)) << res.names(i) << " |";
- }
- cout << endl;
-}
-
-
-static void
-print_row(IntVectorType& widths, Row& row)
-{
- cout << " |" << setfill(' ');
- for (size_t i = 0; i < row.size(); i++) {
- cout << " " << setw(widths.at(i)) << row.raw_data(i) << " |";
- }
- cout << endl;
-}
-
-
-static void
-print_row_separator(IntVectorType& widths)
-{
- cout << " +" << setfill('-');
- for (size_t i = 0; i < widths.size(); i++) {
- cout << "-" << setw(widths.at(i)) << '-' << "-+";
- }
- cout << endl;
-}
-
-
-static void
-print_result(Result& res, int index)
-{
- // Show how many rows are in result, if any
- int num_results = res.size();
- if (res && (num_results > 0)) {
- cout << "Result set " << index << " has " << num_results <<
- " row" << (num_results == 1 ? "" : "s") << ':' << endl;
- }
- else {
- cout << "Result set " << index << " is empty." << endl;
- return;
- }
-
- // Figure out the widths of the result set's columns
- IntVectorType widths;
- int size = res.columns();
- for (int i = 0; i < size; i++) {
- mysql_type_info mti(res.fields(i));
- widths.push_back((res.names(i).size() > mti.max_length()) ?
- res.names(i).size() : mti.max_length());
- }
-
- // Print result set header
- print_row_separator(widths);
- print_header(widths, res);
- print_row_separator(widths);
-
- // Display the result set contents
- for (int i = 0; i < num_results; ++i) {
- Row row = res.fetch_row();
- print_row(widths, row);
- }
-
- // Print result set footer
- print_row_separator(widths);
-}
-
-
-static void
-print_multiple_results(Query& query)
-{
- try {
- // Execute query and print all result sets
- Result res = query.store();
- print_result(res, 0);
- for (int i = 1; query.more_results(); ++i) {
- res = query.store_next();
- print_result(res, i);
- }
- }
- catch (Exception& err) {
- // Something bad happened....
- cerr << "Multi-query failure: " << err.what() << endl;
- exit(1);
- }
-}
-
-
-int
-main(int argc, char *argv[])
-{
- Connection con;
- try {
- // Enable multi-queries. Notice that we can set connection
- // options before the connection is established, which the
- // underlying MySQL C API does not allow. In this particular
- // case, this is not a mere nicety: the multi-query option has
- // a side effect of setting one of the flags used when
- // establishing the database server connection. We could set it
- // directly, but then we couldn't use connect_to_db().
- con.set_option(Connection::opt_multi_statements, true);
-
- // Connect to database
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
- }
- catch (const BadOption& err) {
- if (err.what_option() == Connection::opt_multi_statements) {
- cerr << "This example only works when MySQL++ is built "
- "against MySQL C API" << endl;
- cerr << "version 4.1.01 or later." << endl;
- }
- else {
- cerr << "Unexpected option failure: " << err.what() << endl;
- }
- return 1;
- }
- catch (const ConnectionFailed& err) {
- cerr << "Failed to connect to database server: " <<
- err.what() << endl;
- return 1;
- }
- catch (const Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return 1;
- }
-
- // Set up query with multiple queries.
- Query query = con.query();
- query << "DROP TABLE IF EXISTS test_table;" << endl <<
- "CREATE TABLE test_table(id INT);" << endl <<
- "INSERT INTO test_table VALUES(10);" << endl <<
- "UPDATE test_table SET id=20 WHERE id=10;" << endl <<
- "SELECT * FROM test_table;" << endl <<
- "DROP TABLE test_table" << endl;
- cout << "Multi-query: " << endl << query.preview() << endl;
-
- // Execute statement and display all result sets.
- print_multiple_results(query);
-
-#if MYSQL_VERSION_ID >= 50000
- // If it's MySQL v5.0 or higher, also test stored procedures, which
- // return their results the same way multi-queries do.
- query.reset();
- query << "DROP PROCEDURE IF EXISTS get_stock;" << endl <<
- "CREATE PROCEDURE get_stock" << endl <<
- "( i_item varchar(20) )" << endl <<
- "BEGIN" << endl <<
- "SET i_item = concat('%', i_item, '%');" << endl <<
- "SELECT * FROM stock WHERE lower(item) like lower(i_item);" << endl <<
- "END" << endl <<
- ";";
- cout << "Stored procedure query: " << endl << query.preview() << endl;
-
- // Create the stored procedure.
- print_multiple_results(query);
-
- // Call the stored procedure and display its results.
- query.reset();
- query << "CALL get_stock('relish')";
- cout << "Query: " << query.preview() << endl;
- print_multiple_results(query);
-#endif
-
- return 0;
-}
ADDED examples/resetdb.cc
Index: examples/resetdb.cc
==================================================================
--- /dev/null
+++ examples/resetdb.cc
@@ -0,0 +1,79 @@
+
+#include
+#include
+
+int main (int argc, char *argv[]) {
+ Connection connection(use_exceptions);
+ try { // the entire main block is one big try block;
+
+ if (argc == 1) connection.connect("");
+ else if (argc == 2) connection.connect("",argv[1]);
+ else if (argc == 3) connection.connect("",argv[1],argv[2]);
+ else if (argc <= 4) connection.connect("",argv[1],argv[2],argv[3]);
+ // create a new object and connect based on any (if any) arguments
+ // passed to main();
+
+ try {
+ connection.select_db("mysql_cpp_data");
+ } catch (BadQuery er) {
+ // if it couldn't connect to the database assume that it doesn't exist
+ // and try created it. If that does not work exit with an error.
+ connection.create_db("mysql_cpp_data");
+ connection.select_db("mysql_cpp_data");
+ }
+
+ Query query = connection.query(); // create a new query object
+
+ try { // ignore any errors here
+ // I hope to make this simpler soon
+ query.execute("drop table stock");
+ } catch (BadQuery er) {}
+
+ query << "create table stock (item char(20) not null, num smallint,"
+ << "weight double, price double, sdate date)";
+ query.execute(RESET_QUERY);
+ // send the query to create the table and execute it. The
+ // RESET_QUERY tells the query object to reset it self after
+ // execution
+
+ query << "insert into %5:table values (%0q, %1q, %2, %3, %4q)";
+ query.parse();
+ // set up the template query I will use to insert the data. The
+ // parse method call is important as it is what lets the query
+ // know that this is a template and not a literal string
+
+ query.def["table"] = "stock";
+ // This is setting the parameter named table to stock.
+
+ query.execute ("Hamburger Buns", 56, 1.25, 1.1, "1998-04-26");
+ query.execute ("Hotdogs' Buns" ,65, 1.1 , 1.1, "1998-04-23");
+ query.execute ("Dinner Roles" , 75, .95, .97, "1998-05-25");
+ query.execute ("White Bread" , 87, 1.5, 1.75, "1998-09-04");
+ // The last parameter "table" is not specified here. Thus
+ // the default value for "table" is used which is "stock".
+
+ } catch (BadQuery er) { // handle any errors that may come up
+ cerr << "Error: " << er.error << endl;
+ return -1;
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DELETED examples/resetdb.cpp
Index: examples/resetdb.cpp
==================================================================
--- examples/resetdb.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/***********************************************************************
- resetdb.cpp - (Re)initializes the example database, mysql_cpp_data.
- You must run this at least once before running most of the other
- examples, and it is helpful sometimes to run it again, as some of
- the examples modify the table in this database.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004, 2005 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-
-using namespace std;
-
-// Convert a packed version number in the format used within MySQL++
-// to a printable string.
-static string
-version_str(int packed)
-{
- char buf[9];
- snprintf(buf, sizeof(buf), "%d.%d.%d",
- (packed & 0xFF0000) >> 16,
- (packed & 0x00FF00) >> 8,
- (packed & 0x0000FF));
- return buf;
-}
-
-
-int
-main(int argc, char *argv[])
-{
- // Ensure that we're not mixing library and header file versions.
- // This is really easy to do if you have MySQL++ on your system and
- // are trying to build a new version, and run the examples directly
- // instead of through exrun.
- if (mysqlpp::get_library_version() != MYSQLPP_HEADER_VERSION) {
- cerr << "Version mismatch: library is v" <<
- version_str(mysqlpp::get_library_version()) <<
- ", headers are v" <<
- version_str(MYSQLPP_HEADER_VERSION) <<
- ". Are you running this" << endl <<
- "with exrun? See README.examples." << endl;
- return 1;
- }
-
- // Connect to database server
- mysqlpp::Connection con;
- try {
- cout << "Connecting to database server..." << endl;
- if (!connect_to_db(argc, argv, con, "")) {
- return 1;
- }
- }
- catch (exception& er) {
- cerr << "Connection failed: " << er.what() << endl;
- return 1;
- }
-
- // Create new sample database, or re-create it. We suppress
- // exceptions, because it's not an error if DB doesn't yet exist.
- bool new_db = false;
- {
- mysqlpp::NoExceptions ne(con);
- mysqlpp::Query query = con.query();
- if (con.select_db(kpcSampleDatabase)) {
- // Toss old table, if it exists. If it doesn't, we don't
- // really care, as it'll get created next.
- cout << "Dropping existing sample data tables..." << endl;
- query.execute("drop table stock");
- query.execute("drop table images");
- }
- else {
- // Database doesn't exist yet, so create and select it.
- if (con.create_db(kpcSampleDatabase) &&
- con.select_db(kpcSampleDatabase)) {
- new_db = true;
- }
- else {
- cerr << "Error creating DB: " << con.error() << endl;
- return 1;
- }
- }
- }
-
- // Create sample data table within sample database.
- try {
- // Send the query to create the stock table and execute it.
- cout << "Creating stock table..." << endl;
- mysqlpp::Query query = con.query();
- query <<
- "CREATE TABLE stock (" <<
- " item CHAR(20) NOT NULL, " <<
- " num BIGINT, " <<
- " weight DOUBLE, " <<
- " price DOUBLE, " <<
- " sdate DATE) " <<
- "ENGINE = InnoDB " <<
- "CHARACTER SET utf8 COLLATE utf8_general_ci";
- query.execute();
-
- // Set up the template query to insert the data. The parse()
- // call tells the query object that this is a template and
- // not a literal query string.
- query << "insert into %5:table values (%0q, %1q, %2, %3, %4q)";
- query.parse();
-
- // Set the template query parameter "table" to "stock".
- query.def["table"] = "stock";
-
- // Notice that we don't give a sixth parameter in these calls,
- // so the default value of "stock" is used. Also notice that
- // the first row is a UTF-8 encoded Unicode string! All you
- // have to do to store Unicode data in recent versions of MySQL
- // is use UTF-8 encoding.
- cout << "Populating stock table..." << endl;
- query.execute("Nürnberger Brats", 97, 1.5, 8.79, "2005-03-10");
- query.execute("Pickle Relish", 87, 1.5, 1.75, "1998-09-04");
- query.execute("Hot Mustard", 73, .95, .97, "1998-05-25");
- query.execute("Hotdog Buns", 65, 1.1, 1.1, "1998-04-23");
-
- // Now create empty images table, for testing BLOB and auto-
- // increment column features.
- cout << "Creating empty images table..." << endl;
- query.reset();
- query <<
- "CREATE TABLE images (" <<
- " id INT UNSIGNED NOT NULL AUTO_INCREMENT, " <<
- " data BLOB, " <<
- " PRIMARY KEY (id)" <<
- ")";
- query.execute();
-
- // Report success
- cout << (new_db ? "Created" : "Reinitialized") <<
- " sample database successfully." << endl;
- }
- catch (const mysqlpp::BadQuery& er) {
- // Handle any query errors
- cerr << "Query error: " << er.what() << endl;
- return 1;
- }
- catch (const mysqlpp::BadConversion& er) {
- // Handle bad conversions
- cerr << "Conversion error: " << er.what() << endl <<
- "\tretrieved data size: " << er.retrieved <<
- ", actual size: " << er.actual_size << endl;
- return 1;
- }
- catch (const mysqlpp::Exception& er) {
- // Catch-all for any other MySQL++ exceptions
- cerr << "Error: " << er.what() << endl;
- return 1;
- }
-
- return 0;
-}
ADDED examples/simple1.cc
Index: examples/simple1.cc
==================================================================
--- /dev/null
+++ examples/simple1.cc
@@ -0,0 +1,51 @@
+#include
+#include
+#include
+
+int main() {
+ Connection con("mysql_cpp_data");
+ // The full format for the Connection constructor is
+ // Connection(cchar *db, cchar *host="",
+ // cchar *user="", cchar *passwd="")
+ // You may need to specify some of them if the database is not on
+ // the local machine or you database username is not the same as your
+ // login name, etc..
+
+ Query query = con.query();
+ // This creates a query object that is bound to con.
+
+ query << "select * from stock";
+ // You can write to the query object like you would any other ostrem
+
+ Result res = query.store();
+ // Query::store() executes the query and returns the results
+
+ cout << "Query: " << query.preview() << endl;
+ // Query::preview() simply returns a string with the current query
+ // string in it.
+
+ cout << "Records Found: " << res.size() << endl << endl;
+
+ Row row;
+ cout.setf(ios::left);
+ cout << setw(17) << "Item"
+ << setw(4) << "Num"
+ << setw(7) << "Weight"
+ << setw(7) << "Price"
+ << "Date" << endl
+ << endl;
+
+ Result::iterator i;
+ // The Result class has a read-only Random Access Iterator
+ for (i = res.begin(); i != res.end(); i++) {
+ row = *i;
+ cout << setw(17) << row[0]
+ << setw(4) << row[1]
+ << setw(7) << row["weight"]
+ // you can use either the index number or column name when
+ // retrieving the colume data as demonstrated above.
+ << setw(7) << row[3]
+ << row[4] << endl;
+ }
+ return 0;
+}
DELETED examples/simple1.cpp
Index: examples/simple1.cpp
==================================================================
--- examples/simple1.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/***********************************************************************
- simple1.cpp - Example showing the simplest way to get data from a MySQL
- table with MySQL++.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004-2007 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include
-#include
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- // Connect to the sample database.
- mysqlpp::Connection con(false);
- if (!connect_to_db(argc, argv, con)) {
- return 1;
- }
-
- // Retrieve a subset of the sample stock table set up by resetdb
- mysqlpp::Query query = con.query();
- query << "select item from stock";
- mysqlpp::Result res = query.store();
-
- // Display the result set
- cout << "We have:" << endl;
- if (res) {
- mysqlpp::Row row;
- mysqlpp::Row::size_type i;
- for (i = 0; row = res.at(i); ++i) {
- cout << '\t' << row.at(0) << endl;
- }
- }
- else {
- cerr << "Failed to get item list: " << query.error() << endl;
- return 1;
- }
-
- return 0;
-}
DELETED examples/simple2.cpp
Index: examples/simple2.cpp
==================================================================
--- examples/simple2.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/***********************************************************************
- simple2.cpp - Retrieves the entire contents of the sample stock table
- using a "store" query, and prints it out.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
- MySQL AB, and (c) 2004-2007 by Educational Technology Resources, Inc.
- Others may also hold copyrights on code in this file. See the CREDITS
- file in the top directory of the distribution for details.
-
- This file is part of MySQL++.
-
- MySQL++ is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- MySQL++ is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- License for more details.
-
- 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
-***********************************************************************/
-
-#include "util.h"
-
-#include
-
-#include