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/
|
sched/
|
||||||
credit.cpp
|
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"
|
#include "fcgi_stdio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// uncomment the following to print all queries.
|
bool g_print_queries = false;
|
||||||
// Useful for low-level debugging
|
|
||||||
|
|
||||||
//#define SHOW_QUERIES
|
|
||||||
|
|
||||||
DB_CONN::DB_CONN() {
|
DB_CONN::DB_CONN() {
|
||||||
mysql = 0;
|
mysql = 0;
|
||||||
|
@ -115,9 +112,9 @@ int DB_CONN::set_isolation_level(ISOLATION_LEVEL level) {
|
||||||
|
|
||||||
int DB_CONN::do_query(const char* p) {
|
int DB_CONN::do_query(const char* p) {
|
||||||
int retval;
|
int retval;
|
||||||
#ifdef SHOW_QUERIES
|
if (g_print_queries) {
|
||||||
fprintf(stderr, "query: %s\n", p);
|
fprintf(stderr, "query: %s\n", p);
|
||||||
#endif
|
}
|
||||||
retval = mysql_query(mysql, p);
|
retval = mysql_query(mysql, p);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
fprintf(stderr, "Database error: %s\nquery=%s\n", error_string(), p);
|
fprintf(stderr, "Database error: %s\nquery=%s\n", error_string(), p);
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
|
|
||||||
|
extern bool g_print_queries;
|
||||||
|
|
||||||
// if SQL columns are not 'not null', you must use these safe_atoi, safe_atof
|
// 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.
|
// instead of atoi, atof, since the strings returned by MySQL may be NULL.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue