Author: wyoung
Date: Tue Jul 17 20:45:20 2007
New Revision: 1714
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1714&view=rev
Log:
- Added fieldinf example to dtest
- Suppressing C++ type info outputs in fieldinf in dtest mode
Modified:
trunk/bmark.txt
trunk/dtest
trunk/examples/fieldinf.cpp
Modified: trunk/bmark.txt
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/bmark.txt?rev=1714&r1=1713&r2=1714&view=diff
==============================================================================
--- trunk/bmark.txt (original)
+++ trunk/bmark.txt Tue Jul 17 20:45:20 2007
@@ -197,3 +197,16 @@
sdate date YES NULL
================ END dbinfo OUTPUT ================
+---------------- BEGIN fieldinf OUTPUT ----------------
+Field SQL Type Equivalent C++ Type
+======= ==============
========================================================
+item CHAR NOT NULL n/a
+num BIGINT NULL n/a
+weight DOUBLE NULL n/a
+price DOUBLE NULL n/a
+sdate DATE NULL n/a
+
+SQL type of 'item' field most closely resembles the C++ string type.
+SQL type of 'num' field most closely resembles MySQL++'s longlong type.
+================ END fieldinf OUTPUT ================
+
Modified: trunk/dtest
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/dtest?rev=1714&r1=1713&r2=1714&view=diff
==============================================================================
--- trunk/dtest (original)
+++ trunk/dtest Tue Jul 17 20:45:20 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 dbinfo
+ custom1 custom2 custom3 custom4 custom5 custom6 dbinfo fieldinf
do
if [ -x $t ]
then
Modified: trunk/examples/fieldinf.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/fieldinf.cpp?rev=1714&r1=1713&r2=1714&view=diff
==============================================================================
--- trunk/examples/fieldinf.cpp (original)
+++ trunk/examples/fieldinf.cpp Tue Jul 17 20:45:20 2007
@@ -45,11 +45,11 @@
mysqlpp::Query query = con.query("select * from stock");
mysqlpp::Result res = query.store();
- char widths[] = { 8, 15, 20 };
+ char widths[] = { 8, 15, 57 };
cout.setf(ios::left);
cout << setw(widths[0]) << "Field" <<
setw(widths[1]) << "SQL Type" <<
- setw(widths[2]) << "Mangled C++ Type" <<
+ setw(widths[2]) << "Equivalent C++ Type" <<
endl;
for (int i = 0; i < sizeof(widths) / sizeof(widths[0]); ++i) {
cout << string(widths[i] - 1, '=') << ' ';
@@ -57,9 +57,12 @@
cout << endl;
for (size_t i = 0; i < res.names().size(); i++) {
+ // Suppress C++ type name outputs when run under dtest,
+ // as they're system-specific.
+ const char* cname = dtest_mode ? "n/a" :
res.types(i).name();
cout << setw(widths[0]) << res.names(i).c_str() <<
setw(widths[1]) <<
res.types(i).sql_name() <<
- setw(widths[2]) << res.types(i).name()
<<
+ setw(widths[2]) << cname <<
endl;
}
cout << endl;
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits