Author: wyoung
Date: Mon Apr 23 15:48:06 2007
New Revision: 1545

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1545&view=rev
Log:
More explicit message from resetdb when you accidentally mix library and
version numbers.

Modified:
    trunk/examples/resetdb.cpp

Modified: trunk/examples/resetdb.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/resetdb.cpp?rev=1545&r1=1544&r2=1545&view=diff
==============================================================================
--- trunk/examples/resetdb.cpp (original)
+++ trunk/examples/resetdb.cpp Mon Apr 23 15:48:06 2007
@@ -35,6 +35,20 @@
 
 using namespace std;
 
+// Convert a packed version number in the format used within MySQL++
+// to a printable string.
+static string
+version_str(int packed)
+{
+       char buf[9];
+       snprintf(buf, sizeof(buf), "%d.%d.%d",
+                       (packed & 0xFF0000) >> 16,
+                       (packed & 0x00FF00) >> 8,
+                       (packed & 0x0000FF));
+       return buf;
+}
+
+
 int
 main(int argc, char *argv[])
 {
@@ -43,8 +57,12 @@
        // are trying to build a new version, and run the examples directly
        // instead of through exrun.
        if (mysqlpp::get_library_version() != MYSQLPP_HEADER_VERSION) {
-               cerr << "Library/header version number mismatch.  Are you" << 
endl;
-               cerr << "using exrun to run this?  See README.examples." << 
endl;
+               cerr << "Version mismatch: library is v" <<
+                               version_str(mysqlpp::get_library_version()) <<
+                               ", headers are v" <<
+                               version_str(MYSQLPP_HEADER_VERSION) <<
+                               ".  Are you running this" << endl <<
+                               "with exrun?  See README.examples." << endl;
                return 1;
        }
        


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

Reply via email to