mirror of https://github.com/BOINC/boinc.git
- backend: make "print queries" a runtime instead of compile-time
decision (bool g_print_queries) svn path=/trunk/boinc/; revision=21065
This commit is contained in:
parent
54dce55e98
commit
a5c2f98481
|
@ -2436,3 +2436,10 @@ David 2 Apr 2010
|
|||
|
||||
sched/
|
||||
credit.cpp
|
||||
|
||||
David 2 Apr 2010
|
||||
- backend: make "print queries" a runtime instead of compile-time
|
||||
decision (bool g_print_queries)
|
||||
|
||||
db/
|
||||
db_base.cpp,h
|
||||
|
|
|
@ -30,10 +30,7 @@
|
|||
#include "fcgi_stdio.h"
|
||||
#endif
|
||||
|
||||
// uncomment the following to print all queries.
|
||||
// Useful for low-level debugging
|
||||
|
||||
//#define SHOW_QUERIES
|
||||
bool g_print_queries = false;
|
||||
|
||||
DB_CONN::DB_CONN() {
|
||||
mysql = 0;
|
||||
|
@ -115,9 +112,9 @@ int DB_CONN::set_isolation_level(ISOLATION_LEVEL level) {
|
|||
|
||||
int DB_CONN::do_query(const char* p) {
|
||||
int retval;
|
||||
#ifdef SHOW_QUERIES
|
||||
fprintf(stderr, "query: %s\n", p);
|
||||
#endif
|
||||
if (g_print_queries) {
|
||||
fprintf(stderr, "query: %s\n", p);
|
||||
}
|
||||
retval = mysql_query(mysql, p);
|
||||
if (retval) {
|
||||
fprintf(stderr, "Database error: %s\nquery=%s\n", error_string(), p);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <string>
|
||||
#include <mysql.h>
|
||||
|
||||
extern bool g_print_queries;
|
||||
|
||||
// if SQL columns are not 'not null', you must use these safe_atoi, safe_atof
|
||||
// instead of atoi, atof, since the strings returned by MySQL may be NULL.
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue