Author: wyoung
Date: Sat Oct 27 06:56:40 2007
New Revision: 1796
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1796&view=rev
Log:
Renamed 'xaction' example to 'transaction'. Too much cognotive
dissonance whenever thinking about both it and lib/transaction.cpp.
Added:
trunk/examples/transaction.cpp
- copied, changed from r1795, trunk/examples/xaction.cpp
Removed:
trunk/examples/xaction.cpp
Modified:
trunk/README.examples
trunk/mysql++.bkl
Modified: trunk/README.examples
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/README.examples?rev=1796&r1=1795&r2=1796&view=diff
==============================================================================
--- trunk/README.examples (original)
+++ trunk/README.examples Sat Oct 27 06:56:40 2007
@@ -92,7 +92,7 @@
tquery: A simple example showing how to use the template query
facility.
- xaction: Shows how to use the Transaction class to create
+ transaction: Shows how to use the Transaction class to create
transaction sets which automatically roll back if not
explicitly committed.
@@ -102,8 +102,9 @@
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.
+ container conditionally. Think of it as a way to express
+ rules for selecting records in C++, to be used when SQL's
+ WHERE clause isn't powerful enough.
for_each: Demonstrates the Query::for_each() method, which
allows you to execute a query and call a functor on each
@@ -111,16 +112,17 @@
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.
+ for use by the cgi_jpeg example. (See below.) Unlike the
+ other examples, this one takes anything given on the
+ command line that isn't a switch to be a JPEG file name.
+ We've included examples/logo.jpg as a sample, if you want
+ to use that.
fieldinf: 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.
+ server and some of the data it's managing.
If you run the load_jpeg example, you should consider also
playing with the other half of the demonstration, cgi_jpeg.
Copied: trunk/examples/transaction.cpp (from r1795, trunk/examples/xaction.cpp)
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/transaction.cpp?p2=trunk/examples/transaction.cpp&p1=trunk/examples/xaction.cpp&r1=1795&r2=1796&rev=1796&view=diff
==============================================================================
--- trunk/examples/xaction.cpp (original)
+++ trunk/examples/transaction.cpp Sat Oct 27 06:56:40 2007
@@ -1,5 +1,5 @@
/***********************************************************************
- xaction.cpp - Example showing how to use the transaction support in
+ transaction.cpp - Example showing how to use the transaction support in
MySQL++ v2.1 and up.
Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
Removed: trunk/examples/xaction.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/xaction.cpp?rev=1795&view=auto
==============================================================================
--- trunk/examples/xaction.cpp (original)
+++ trunk/examples/xaction.cpp (removed)
@@ -1,109 +1,0 @@
-/***********************************************************************
- xaction.cpp - Example showing how to use the transaction support in
- MySQL++ v2.1 and up.
-
- Copyright (c) 1998 by Kevin Atkinson, (c) 1999-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 "cmdline.h"
-#include "printdata.h"
-#include "stock.h"
-
-#include <iostream>
-
-using namespace std;
-
-int
-main(int argc, char *argv[])
-{
- // Get database access parameters from command line
- const char* db = 0, *server = 0, *user = 0, *pass = "";
- if (!parse_command_line(argc, argv, &db, &server, &user, &pass)) {
- return 1;
- }
-
- try {
- // Establish the connection to the database server.
- mysqlpp::Connection con(db, server, user, pass);
-
- // Show initial state
- mysqlpp::Query query = con.query();
- cout << "Initial state of stock table:" << endl;
- print_stock_table(query);
-
- // Insert a few rows in a single transaction set
- {
- mysqlpp::Transaction trans(con);
-
- stock row1("Sauerkraut", 42, 1.2, 0.75, "2006-03-06");
- query.insert(row1);
- query.execute();
-
- stock row2("Bratwurst", 24, 3.0, 4.99, "2006-03-06");
- query.insert(row2);
- query.execute();
-
- cout << "\nRows are inserted, but not committed." <<
endl;
- cout << "Verify this with another program (e.g.
simple1), "
- "then hit Enter." << endl;
- getchar();
-
- cout << "\nCommitting transaction gives us:" << endl;
- trans.commit();
- print_stock_table(query);
- }
-
- // Now let's test auto-rollback
- {
- mysqlpp::Transaction trans(con);
- cout << "\nNow adding catsup to the database..." <<
endl;
-
- stock row("Catsup", 3, 3.9, 2.99, "2006-03-06");
- query.insert(row);
- query.execute();
- }
- cout << "\nNo, yuck! We don't like catsup. Rolling it back:" <<
- endl;
- print_stock_table(query);
-
- }
- 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;
-}
Modified: trunk/mysql++.bkl
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/mysql%2B%2B.bkl?rev=1796&r1=1795&r2=1796&view=diff
==============================================================================
--- trunk/mysql++.bkl (original)
+++ trunk/mysql++.bkl Sat Oct 27 06:56:40 2007
@@ -214,6 +214,45 @@
</lib>
<!-- The examples themselves -->
+ <exe id="cgi_jpeg" template="libexcommon-user,programs">
+ <sources>examples/cgi_jpeg.cpp</sources>
+ </exe>
+ <exe id="custom1" template="libexcommon-user,programs">
+ <sources>examples/custom1.cpp</sources>
+ </exe>
+ <exe id="custom2" template="libexcommon-user,programs">
+ <sources>examples/custom2.cpp</sources>
+ </exe>
+ <exe id="custom3" template="libexcommon-user,programs">
+ <sources>examples/custom3.cpp</sources>
+ </exe>
+ <exe id="custom4" template="libexcommon-user,programs">
+ <sources>examples/custom4.cpp</sources>
+ </exe>
+ <exe id="custom5" template="libexcommon-user,programs">
+ <sources>examples/custom5.cpp</sources>
+ </exe>
+ <exe id="custom6" template="libexcommon-user,programs">
+ <sources>examples/custom6.cpp</sources>
+ </exe>
+ <exe id="dbinfo" template="libexcommon-user,programs">
+ <sources>examples/dbinfo.cpp</sources>
+ </exe>
+ <exe id="deadlock" template="libexcommon-user,programs">
+ <sources>examples/deadlock.cpp</sources>
+ </exe>
+ <exe id="fieldinf" template="libexcommon-user,programs">
+ <sources>examples/fieldinf.cpp</sources>
+ </exe>
+ <exe id="for_each" template="libexcommon-user,programs">
+ <sources>examples/for_each.cpp</sources>
+ </exe>
+ <exe id="load_jpeg" template="libexcommon-user,programs">
+ <sources>examples/load_jpeg.cpp</sources>
+ </exe>
+ <exe id="multiquery" template="libexcommon-user,programs">
+ <sources>examples/multiquery.cpp</sources>
+ </exe>
<exe id="resetdb" template="libexcommon-user,programs">
<sources>examples/resetdb.cpp</sources>
</exe>
@@ -226,11 +265,8 @@
<exe id="simple3" template="libexcommon-user,programs">
<sources>examples/simple3.cpp</sources>
</exe>
- <exe id="deadlock" template="libexcommon-user,programs">
- <sources>examples/deadlock.cpp</sources>
- </exe>
- <exe id="multiquery" template="libexcommon-user,programs">
- <sources>examples/multiquery.cpp</sources>
+ <exe id="store_if" template="libexcommon-user,programs">
+ <sources>examples/store_if.cpp</sources>
</exe>
<exe id="tquery1" template="libexcommon-user,programs">
<sources>examples/tquery1.cpp</sources>
@@ -238,47 +274,11 @@
<exe id="tquery2" template="libexcommon-user,programs">
<sources>examples/tquery2.cpp</sources>
</exe>
+ <exe id="transaction" template="libexcommon-user,programs">
+ <sources>examples/transaction.cpp</sources>
+ </exe>
<exe id="usequery" template="libexcommon-user,programs">
<sources>examples/usequery.cpp</sources>
- </exe>
- <exe id="custom1" template="libexcommon-user,programs">
- <sources>examples/custom1.cpp</sources>
- </exe>
- <exe id="custom2" template="libexcommon-user,programs">
- <sources>examples/custom2.cpp</sources>
- </exe>
- <exe id="custom3" template="libexcommon-user,programs">
- <sources>examples/custom3.cpp</sources>
- </exe>
- <exe id="custom4" template="libexcommon-user,programs">
- <sources>examples/custom4.cpp</sources>
- </exe>
- <exe id="custom5" template="libexcommon-user,programs">
- <sources>examples/custom5.cpp</sources>
- </exe>
- <exe id="custom6" template="libexcommon-user,programs">
- <sources>examples/custom6.cpp</sources>
- </exe>
- <exe id="dbinfo" template="libexcommon-user,programs">
- <sources>examples/dbinfo.cpp</sources>
- </exe>
- <exe id="fieldinf" template="libexcommon-user,programs">
- <sources>examples/fieldinf.cpp</sources>
- </exe>
- <exe id="load_jpeg" template="libexcommon-user,programs">
- <sources>examples/load_jpeg.cpp</sources>
- </exe>
- <exe id="xaction" template="libexcommon-user,programs">
- <sources>examples/xaction.cpp</sources>
- </exe>
- <exe id="store_if" template="libexcommon-user,programs">
- <sources>examples/store_if.cpp</sources>
- </exe>
- <exe id="for_each" template="libexcommon-user,programs">
- <sources>examples/for_each.cpp</sources>
- </exe>
- <exe id="cgi_jpeg" template="libexcommon-user,programs">
- <sources>examples/cgi_jpeg.cpp</sources>
</exe>
</if> <!-- build examples -->
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits