Index: mptest/mptest.c ================================================================== --- mptest/mptest.c +++ mptest/mptest.c @@ -36,12 +36,15 @@ #include "sqlite3.h" #include #if defined(_WIN32) # define WIN32_LEAN_AND_MEAN # include +# include +# define GETPID _getpid #else # include +# define GETPID getpid #endif #include #include #include #include @@ -65,11 +68,11 @@ sqlite3 *db; /* Open connection to database */ char *zErrLog; /* Filename for error log */ FILE *pErrLog; /* Where to write errors */ char *zLog; /* Name of output log file */ FILE *pLog; /* Where to write log messages */ - char zName[12]; /* Symbolic name of this process */ + char zName[32]; /* Symbolic name of this process */ int taskId; /* Task ID. 0 means supervisor. */ int iTrace; /* Tracing level */ int bSqlTrace; /* True to trace SQL commands */ int nError; /* Number of errors */ int nTest; /* Number of --match operators */ @@ -329,11 +332,11 @@ */ static void sqlErrorCallback(void *pArg, int iErrCode, const char *zMsg){ UNUSED_PARAMETER(pArg); if( (iErrCode&0xff)==SQLITE_SCHEMA && g.iTrace<3 ) return; if( g.iTimeout==0 && (iErrCode&0xff)==SQLITE_BUSY && g.iTrace<3 ) return; - if( iErrCode==SQLITE_OK ){ + if( (iErrCode&0xff)==SQLITE_NOTICE ){ logMessage("(info) %s", zMsg); }else{ errorMessage("(errcode=%d) %s", iErrCode, zMsg); } } @@ -1187,11 +1190,11 @@ "Header: %s\n", sqlite3_sourceid(), SQLITE_SOURCE_ID); exit(1); } n = argc-2; - sqlite3_snprintf(sizeof(g.zName), g.zName, "mptest"); + sqlite3_snprintf(sizeof(g.zName), g.zName, "%05d.mptest", GETPID()); g.zVfs = findOption(argv+2, &n, "vfs", 1); zClient = findOption(argv+2, &n, "client", 1); g.zErrLog = findOption(argv+2, &n, "errlog", 1); g.zLog = findOption(argv+2, &n, "log", 1); zTrace = findOption(argv+2, &n, "trace", 1); @@ -1207,15 +1210,17 @@ if( g.zLog ){ g.pLog = fopen(g.zLog, "a"); }else{ g.pLog = stdout; } + sqlite3_config(SQLITE_CONFIG_LOG, sqlErrorCallback, 0); if( zClient ){ iClient = atoi(zClient); if( iClient<1 ) fatalError("illegal client number: %d\n", iClient); - sqlite3_snprintf(sizeof(g.zName), g.zName, "client%02d", iClient); + sqlite3_snprintf(sizeof(g.zName), g.zName, "%05d.client%02d", + GETPID(), iClient); }else{ if( g.iTrace>0 ){ printf("With SQLite " SQLITE_VERSION " " SQLITE_SOURCE_ID "\n" ); for(i=0; (zCOption = sqlite3_compileoption_get(i))!=0; i++){ printf("-DSQLITE_%s\n", zCOption);