Author: wyoung
Date: Wed Apr 11 20:50:15 2007
New Revision: 1493
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1493&view=rev
Log:
Updated README.examples to cover the changes to the changes made to the
examples that existed through v2.2.1.
Modified:
trunk/README.examples
Modified: trunk/README.examples
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/README.examples?rev=1493&r1=1492&r2=1493&view=diff
==============================================================================
--- trunk/README.examples (original)
+++ trunk/README.examples Wed Apr 11 20:50:15 2007
@@ -1,77 +1,94 @@
Building the Examples
~~~~~~~~~~~~~~~~~~~~~
- If you're installing MySQL++ from the source tarball, the
- example programs should have been built when you built the
- library. If you change any example code, just say 'make'
- at the top level MySQL++ directory to rebuild the examples.
- The examples are built against the headers and library in
- the lib subdirectory.
+ If you're installing MySQL++ from the source tarball, the
+ example programs should have been built when you built the
+ library. If you change any example code, just say 'make'
+ at the top level MySQL++ directory to rebuild the examples.
+ The examples are built against the headers and library in
+ the lib subdirectory.
- 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.
+ 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.
-General Instructions
-~~~~~~~~~~~~~~~~~~~~
+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.
- Start with resetdb:
+ 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. For the purposes of this section, they
+ behave the same way. Wherever you see "$ ./exrun..." below,
+ just think "c:\path\to\mysql++> exrun.bat..." instead.
- $ ./exrun resetdb [host] [user] [password] [port]
+ Start with resetdb:
- This sets up the mysql_cpp_data database used by most of the
- other examples.
+ $ ./exrun resetdb [host] [user] [password] [port]
- 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).
+ This sets up the mysql_cpp_data database used by most of the
+ other examples.
- The exrun wrapper script ensures that your system's dynamic
- linker doesn't mistakenly use the installed MySQL++ library
- with programs linked against a different version of the
- MySQL++ header files. This is easy to do if you have one
- version of MySQL++ already installed, and are trying to build
- a new version. resetdb double-checks this, and reports an
- error if it detects a mismatch.
+ 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 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).
- The following examples use the database set up by resetdb,
- and have the same command line format as resetdb:
+Running the Other Examples
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+ The following examples use the database set up by resetdb,
+ and have the same command line format as resetdb:
- simple1: Gets all records in the table resetdb set up and
- displays them. Try this one if you do nothing else.
+ simple1: Shows the item names for all records in the sample
+ stock table. Try this one if you do nothing else.
- simple2: Same as simple1, except that it retrieves
- the data with a "use" query instead of a
- "store" query. See the user manual for the
- difference between these.
+ simple2: Similar to simple1, but it displays all columns
+ from the sample stock table, not just the item name.
- simple3: Similar to simple2, but uses a different
- querying method, the "use" query, which is
- more memory efficient but requires that you
- process all results in order.
+ 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.
- fieldinf1: Shows how to get information about the fields in
- a result set. (Types, etc.)
+ custom1-6: Demonstrates the SQLSS features. (See the user
+ manual.)
- custom1-6: Demonstrates the SQLSS features. (See the user
- manual.)
+ 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.
- dbinfo: Dumps a bunch of information about the database
- server and the tables in its 'mysql' database.
+ 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.
- The following are kind of oddballs. You will have to change
- the source code to get them to run, since they use hard-coded
- table and database names which aren't the same as those set up
- by resetdb.
-
- load_file, cgi_image: Shows how to use a BLOB field to store
- a file, and how to retrieve the file from the DB.
-
- updel: Shows how to use the power of the matching syntax
- available in MySQL's SELECT statement to do fine-grained
- UPDATE or DELETE queries.
+ There is one other oddball, the updel example. It shows how to
+ use the power of the matching syntax available in MySQL's SELECT
+ statement to do fine-grained UPDATE or DELETE queries.
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits