Author: wyoung
Date: Tue Jul 17 19:47:43 2007
New Revision: 1711

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1711&view=rev
Log:
- Examples now recognize -D flag, passed only by dtest, for disabling any
  outputs that aren't repeatable across systmes.  
- Added dbinfo example to dtest run, now that it can suppress system-
  specific outputs.

Modified:
    trunk/bmark.txt
    trunk/dtest
    trunk/examples/dbinfo.cpp
    trunk/examples/util.cpp
    trunk/examples/util.h

Modified: trunk/bmark.txt
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/bmark.txt?rev=1711&r1=1710&r2=1711&view=diff
==============================================================================
--- trunk/bmark.txt (original)
+++ trunk/bmark.txt Tue Jul 17 19:47:43 2007
@@ -174,3 +174,26 @@
        Hot Dogs
 ================ END custom6 OUTPUT ================
 
+---------------- BEGIN dbinfo OUTPUT ----------------
+
+
+================================= show tables 
==================================
+Tables found: 2
+       images
+       stock
+
+=============================== describe images 
================================
+|field                 ||type                ||null||key||default        |
+ id                      int(10) unsigned            PRI  NULL            
+ data                    blob                  YES        NULL            
+
+
+================================ describe stock 
================================
+|field                 ||type                ||null||key||default        |
+ item                    char(20)                                         
+ num                     bigint(20)            YES        NULL            
+ weight                  double                YES        NULL            
+ price                   double                YES        NULL            
+ sdate                   date                  YES        NULL            
+================ END dbinfo OUTPUT ================
+

Modified: trunk/dtest
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/dtest?rev=1711&r1=1710&r2=1711&view=diff
==============================================================================
--- trunk/dtest (original)
+++ trunk/dtest Tue Jul 17 19:47:43 2007
@@ -7,7 +7,7 @@
 # subsequent examples to fail because data they need isn't present.
 for t in resetdb simple1 simple2 simple3 store_if for_each \
        multiquery tquery1 resetdb tquery2 resetdb usequery \
-       custom1 custom2 custom3 custom4 custom5 custom6
+       custom1 custom2 custom3 custom4 custom5 custom6 dbinfo
 do
        if [ -x $t ]
        then
@@ -19,7 +19,7 @@
        
                echo -n "$t "
                echo "---------------- BEGIN $t OUTPUT ----------------" >> $TMP
-               if ! ./exrun $t $* >> $TMP
+               if ! ./exrun $t -D $* >> $TMP
                then
                        echo
                        echo 'TESTING ABORTED.'

Modified: trunk/examples/dbinfo.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/dbinfo.cpp?rev=1711&r1=1710&r2=1711&view=diff
==============================================================================
--- trunk/examples/dbinfo.cpp (original)
+++ trunk/examples/dbinfo.cpp Tue Jul 17 19:47:43 2007
@@ -164,8 +164,12 @@
        try {
                mysqlpp::Connection con;
                if (connect_to_db(argc, argv, con)) {
-            show_mysql_version(con);
-            show_databases(con);
+                       if (!dtest_mode) {
+                               // Only run system-specific tests when run by 
hand.
+                               // dtest only wants repeatable output.
+                   show_mysql_version(con);
+               show_databases(con);
+                       }
                        show_tables(con);
                }
        }

Modified: trunk/examples/util.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/util.cpp?rev=1711&r1=1710&r2=1711&view=diff
==============================================================================
--- trunk/examples/util.cpp (original)
+++ trunk/examples/util.cpp Tue Jul 17 19:47:43 2007
@@ -43,7 +43,11 @@
 
 using namespace std;
 
+
+//// global variables //////////////////////////////////////////////////
+
 const char* kpcSampleDatabase = "mysql_cpp_data";
+bool dtest_mode = false;               // true when running under dtest
 
 
 //// print_stock_header ////////////////////////////////////////////////
@@ -189,11 +193,12 @@
        const char* pass = "";     // 0 means something different!
        const char* server = 0;
        const char* user = 0;
-       while ((ch = att_getopt(argc, argv, "p:s:u:")) != EOF) {
+       while ((ch = att_getopt(argc, argv, "p:s:u:D")) != EOF) {
                switch (ch) {
                        case 'p': pass = ag_optarg;   break;
                        case 's': server = ag_optarg; break;
                        case 'u': user = ag_optarg;   break;
+                       case 'D': dtest_mode = true;  break;
                        default:
                                print_usage(argv[0], extra_parms);
                                return false;

Modified: trunk/examples/util.h
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/util.h?rev=1711&r1=1710&r2=1711&view=diff
==============================================================================
--- trunk/examples/util.h (original)
+++ trunk/examples/util.h Tue Jul 17 19:47:43 2007
@@ -31,6 +31,7 @@
 #include <mysql++.h>
 
 extern const char* kpcSampleDatabase;
+extern bool dtest_mode;
 
 void print_stock_header(int rows);
 void print_stock_row(const mysqlpp::Row& r);


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

Reply via email to