Overview
| SHA1 Hash: | b3809c937b230b34e5bc6ce4909c04ceef72fb85 |
|---|---|
| Date: | 2012-11-27 16:39:31 |
| User: | drh |
| Comment: | Get SQLLOG working on windows. Fix a couple of compiler warnings. |
Tags And Properties
- branch=sqllog inherited from [cd501bbccf]
- closed added by [92ed450547] on 2012-12-06 02:56:46
- sym-sqllog inherited from [cd501bbccf]
Changes
Changes to src/test_sqllog.c
62 #include "stdlib.h" 62 #include "stdlib.h" 63 #include "string.h" 63 #include "string.h" 64 #include "assert.h" 64 #include "assert.h" 65 65 66 #include "sys/types.h" 66 #include "sys/types.h" 67 #include "unistd.h" 67 #include "unistd.h" 68 static int getProcessId(void){ 68 static int getProcessId(void){ > 69 #if SQLITE_OS_WIN > 70 return (int)_getpid(); > 71 #else 69 return (int)getpid(); 72 return (int)getpid(); > 73 #endif 70 } 74 } 71 75 72 76 73 #define ENVIRONMENT_VARIABLE1_NAME "SQLITE_SQLLOG_DIR" 77 #define ENVIRONMENT_VARIABLE1_NAME "SQLITE_SQLLOG_DIR" 74 #define ENVIRONMENT_VARIABLE2_NAME "SQLITE_SQLLOG_REUSE_FILES" 78 #define ENVIRONMENT_VARIABLE2_NAME "SQLITE_SQLLOG_REUSE_FILES" 75 79 76 /* Assume that all database and database file names are shorted than this. */ 80 /* Assume that all database and database file names are shorted than this. */ ................................................................................................................................................................................ 206 ** order that they were attached. So a newly attached database is 210 ** order that they were attached. So a newly attached database is 207 ** described by the last row returned. */ 211 ** described by the last row returned. */ 208 assert( sqllogglobal.bRec==0 ); 212 assert( sqllogglobal.bRec==0 ); 209 sqllogglobal.bRec = 1; 213 sqllogglobal.bRec = 1; 210 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0); 214 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0); 211 if( rc==SQLITE_OK ){ 215 if( rc==SQLITE_OK ){ 212 while( SQLITE_ROW==sqlite3_step(pStmt) ){ 216 while( SQLITE_ROW==sqlite3_step(pStmt) ){ 213 char *zVal1; int nVal1; | 217 const char *zVal1; int nVal1; 214 char *zVal2; int nVal2; | 218 const char *zVal2; int nVal2; 215 219 216 zVal1 = sqlite3_column_text(pStmt, 1); | 220 zVal1 = (const char*)sqlite3_column_text(pStmt, 1); 217 nVal1 = sqlite3_column_bytes(pStmt, 1); 221 nVal1 = sqlite3_column_bytes(pStmt, 1); 218 memcpy(zName, zVal1, nVal1+1); 222 memcpy(zName, zVal1, nVal1+1); 219 223 220 zVal2 = sqlite3_column_text(pStmt, 2); | 224 zVal2 = (const char*)sqlite3_column_text(pStmt, 2); 221 nVal2 = sqlite3_column_bytes(pStmt, 2); 225 nVal2 = sqlite3_column_bytes(pStmt, 2); 222 memcpy(zFile, zVal2, nVal2+1); 226 memcpy(zFile, zVal2, nVal2+1); 223 227 224 if( zSearch && strlen(zSearch)==nVal1 228 if( zSearch && strlen(zSearch)==nVal1 225 && 0==sqlite3_strnicmp(zSearch, zVal1, nVal1) 229 && 0==sqlite3_strnicmp(zSearch, zVal1, nVal1) 226 ){ 230 ){ 227 break; 231 break; ................................................................................................................................................................................ 462 if( getenv(ENVIRONMENT_VARIABLE1_NAME) ){ 466 if( getenv(ENVIRONMENT_VARIABLE1_NAME) ){ 463 if( SQLITE_OK==sqlite3_config(SQLITE_CONFIG_SQLLOG, testSqllog, 0) ){ 467 if( SQLITE_OK==sqlite3_config(SQLITE_CONFIG_SQLLOG, testSqllog, 0) ){ 464 memset(&sqllogglobal, 0, sizeof(sqllogglobal)); 468 memset(&sqllogglobal, 0, sizeof(sqllogglobal)); 465 sqllogglobal.bReuse = 1; 469 sqllogglobal.bReuse = 1; 466 } 470 } 467 } 471 } 468 } 472 } 469 <