Author: wyoung
Date: Thu Feb 7 04:12:54 2008
New Revision: 2164
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2164&view=rev
Log:
Small fix to new count_rows() to make it not crash if exceptions are
disabled and the query fails.
Modified:
trunk/lib/connection.cpp
Modified: trunk/lib/connection.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.cpp?rev=2164&r1=2163&r2=2164&view=diff
==============================================================================
--- trunk/lib/connection.cpp (original)
+++ trunk/lib/connection.cpp Thu Feb 7 04:12:54 2008
@@ -2,7 +2,7 @@
connection.cpp - Implements the Connection class.
Copyright (c) 1998 by Kevin Atkinson, (c) 1999-2001 by MySQL AB, and
- (c) 2004-2007 by Educational Technology Resources, Inc. Others may
+ (c) 2004-2008 by Educational Technology Resources, Inc. Others may
also hold copyrights on code in this file. See the CREDITS file in
the top directory of the distribution for details.
@@ -129,8 +129,12 @@
error_message_.clear();
Query q(this, throw_exceptions());
q << "SELECT COUNT(*) FROM " << table;
- StoreQueryResult res = q.store();
- return res[0][0];
+ if (StoreQueryResult res = q.store()) {
+ return res[0][0];
+ }
+ else {
+ return 0;
+ }
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits