Author: wyoung
Date: Tue Feb 17 17:46:36 2009
New Revision: 2444

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2444&view=rev
Log:
Expanded test/qssqls.cpp, adding sql_char and sql_blob testing.  This
didn't work back when the test was created, because you couldn't call
Query::escape_string() without a valid Connection.  That's long been
fixed, so there's no excuse not to test stringish data types, too.
Noticed by Rick Gutleber, but test expanded by me.

Modified:
    trunk/test/qssqls.cpp

Modified: trunk/test/qssqls.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/test/qssqls.cpp?rev=2444&r1=2443&r2=2444&view=diff
==============================================================================
--- trunk/test/qssqls.cpp (original)
+++ trunk/test/qssqls.cpp Tue Feb 17 17:46:36 2009
@@ -1,7 +1,7 @@
 /***********************************************************************
  test/qssqls.cpp - Tests SQL query creation from SSQLS in Query.
 
- Copyright (c) 2008 by Educational Technology Resources, Inc.
+ Copyright (c) 2008-2009 by Educational Technology Resources, Inc.
  Others may also hold copyrights on code in this file.  See the
  CREDITS.txt file in the top directory of the distribution for details.
 
@@ -32,11 +32,8 @@
 using namespace std;
 
 
-// Don't use any stringish types here.  That will cause code below to
-// eventually try to call DBDriver::escape_string() through the
-// Connection object, which we don't really have, so it asplodes.
-sql_create_17(test,
-       17, 0,
+sql_create_19(test,
+       19, 0,
        sql_tinyint,                    tinyint_v,
        sql_tinyint_unsigned,   tinyint_unsigned_v,
        sql_smallint,                   smallint_v,
@@ -53,17 +50,20 @@
        sql_bool,                               bool_v,
        sql_date,                               date_v,
        sql_time,                               time_v,
-       sql_datetime,                   datetime_v)
+       sql_datetime,                   datetime_v,
+       sql_char,                               char_v, // only need one 
stringish type...
+       sql_blob,                               blob_v) // ...and one blob 
type; they're all
+                                                                       // the 
same under the hood in MySQL++
 
 int
 main()
 {
-       Query q = Connection().query();         // don't do this in real code
+       Query q(0);             // don't pass 0 for conn parameter in real code
        test empty(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false,
-                       Date(), Time(), DateTime());
+                       Date(), Time(), DateTime(), "", sql_blob());
        test filled(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.0, 12.0, 13.0,
                        bool(14), Date("1515-15-15"), Time("16:16:16"),
-                       DateTime("1717-17-17 17:17:17"));
+                       DateTime("1717-17-17 17:17:17"), "18", sql_blob("1\09", 
3));
 
        cout << q.insert(empty) << endl << endl;
        cout << q.insert(filled) << endl << endl;


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

Reply via email to