00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdio.h>
00033 #ifdef _WIN32
00034 #pragma warning(disable:4786)
00035 #endif
00036
00037 #include <string>
00038 #include <map>
00039 #include <time.h>
00040 #include <sqlite3.h>
00041
00042 #include "Database.h"
00043 #include "Query.h"
00044 #include "IError.h"
00045 #include "StderrLog.h"
00046
00047
00048 #ifdef SQLITEW_NAMESPACE
00049 namespace SQLITEW_NAMESPACE {
00050 #endif
00051
00052
00053 void StderrLog::error(Database& db,const std::string& str)
00054 {
00055 time_t t = time(NULL);
00056 struct tm *tp = localtime(&t);
00057 fprintf(stderr,"%d-%02d-%02d %02d:%02d:%02d :: Database: %s\n",
00058 tp -> tm_year + 1900,tp -> tm_mon + 1,tp -> tm_mday,
00059 tp -> tm_hour,tp -> tm_min, tp -> tm_sec,
00060 str.c_str());
00061 }
00062
00063
00064 void StderrLog::error(Database& db,Query& q,const std::string& str)
00065 {
00066 time_t t = time(NULL);
00067 struct tm *tp = localtime(&t);
00068 fprintf(stderr,"%d-%02d-%02d %02d:%02d:%02d :: Query: %s: %s(%d)\n",
00069 tp -> tm_year + 1900,tp -> tm_mon + 1,tp -> tm_mday,
00070 tp -> tm_hour,tp -> tm_min, tp -> tm_sec,
00071 str.c_str(),q.GetError().c_str(),q.GetErrno());
00072 fprintf(stderr," (QUERY: \"%s\")\n",q.GetLastQuery().c_str());
00073 }
00074
00075
00076 #ifdef SQLITEW_NAMESPACE
00077 }
00078 #endif
00079