Author: wyoung
Date: Tue Mar 18 06:51:02 2008
New Revision: 2247

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2247&view=rev
Log:
Modified one of the examples to show testing a nullable SSQLS column for
a null value.  Changed dtest output cosmetically.

Modified:
    trunk/bmark.txt
    trunk/examples/ssqls1.cpp

Modified: trunk/bmark.txt
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/bmark.txt?rev=2247&r1=2246&r2=2247&view=diff
==============================================================================
--- trunk/bmark.txt (original)
+++ trunk/bmark.txt Tue Mar 18 06:51:02 2008
@@ -180,7 +180,7 @@
 We have:
        Nürnberger Brats
        Pickle Relish
-       Hot Mustard
+       Hot Mustard (good American yellow mustard, not that European stuff)
        Hotdog Buns
 ================ END ssqls1 OUTPUT ================
 

Modified: trunk/examples/ssqls1.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/ssqls1.cpp?rev=2247&r1=2246&r2=2247&view=diff
==============================================================================
--- trunk/examples/ssqls1.cpp (original)
+++ trunk/examples/ssqls1.cpp Tue Mar 18 06:51:02 2008
@@ -48,11 +48,11 @@
                // Establish the connection to the database server.
                mysqlpp::Connection con(db, server, user, pass);
 
-               // Retrieve just the item column from the stock table, and store
+               // Retrieve a subset of the stock table's columns, and store
                // the data in a vector of 'stock' SSQLS structures.  See the
                // user manual for the consequences arising from this quiet
                // ability to store a subset of the table in the stock SSQLS.
-               mysqlpp::Query query = con.query("select item from stock");
+               mysqlpp::Query query = con.query("select item,description from 
stock");
                vector<stock> res;
                query.storein(res);
 
@@ -60,7 +60,11 @@
                cout << "We have:" << endl;
                vector<stock>::iterator it;
                for (it = res.begin(); it != res.end(); ++it) {
-                       cout << '\t' << it->item << endl;
+                       cout << '\t' << it->item;
+                       if (it->description != mysqlpp::null) {
+                               cout << " (" << it->description << ")";
+                       }
+                       cout << endl;
                }
        }
        catch (const mysqlpp::BadQuery& er) {


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to