Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the stat3 analysis loader to be compatible with sqlite3_db_status(). Also fix some OOM issues with the stat3 analysis loader. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | stat3-enhancement |
Files: | files | file ages | folders |
SHA1: |
eaf447ea87b0ff29ae06283204f522fc |
User & Date: | drh 2011-08-18 13:45:23.575 |
Original Comment: | Fix the stat3 analysis loader to be compatible with sqlite3_db_status(). Also fix some OOM issues with the stat3 analysis loader. |
Context
2011-08-26
| ||
13:52 | Merge branches branch-3.7.2 and stat3-enhancement into a new branch for testing purposes. (check-in: 0df04f920b user: drh tags: stat3-3.7.2) | |
13:16 | Merge the stat3-enhancement branch with trunk, but keep the resulting merge in a separate branch for now. (check-in: 63f2c7859f user: drh tags: stat3-trunk) | |
2011-08-18
| ||
13:45 | Fix the stat3 analysis loader to be compatible with sqlite3_db_status(). Also fix some OOM issues with the stat3 analysis loader. (Closed-Leaf check-in: eaf447ea87 user: drh tags: stat3-enhancement) | |
02:51 | Fix a bug in the cleanup of stat tables on a DROP TABLE in autovacuum mode. (check-in: 3fe5d54f63 user: drh tags: stat3-enhancement) | |
Changes
Changes to src/analyze.c.
︙ | ︙ | |||
901 902 903 904 905 906 907 | void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){ #ifdef SQLITE_ENABLE_STAT3 if( pIdx->aSample ){ int j; for(j=0; j<pIdx->nSample; j++){ IndexSample *p = &pIdx->aSample[j]; if( p->eType==SQLITE_TEXT || p->eType==SQLITE_BLOB ){ | | | | | | > | 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){ #ifdef SQLITE_ENABLE_STAT3 if( pIdx->aSample ){ int j; for(j=0; j<pIdx->nSample; j++){ IndexSample *p = &pIdx->aSample[j]; if( p->eType==SQLITE_TEXT || p->eType==SQLITE_BLOB ){ sqlite3DbFree(db, p->u.z); } } sqlite3DbFree(db, pIdx->aSample); } if( db && db->pnBytesFreed==0 ){ pIdx->nSample = 0; pIdx->aSample = 0; } #else UNUSED_PARAMETER(db); UNUSED_PARAMETER(pIdx); #endif } #ifdef SQLITE_ENABLE_STAT3 |
︙ | ︙ | |||
964 965 966 967 968 969 970 | pIdx->avgEq = pIdx->aiRowEst[1]; if( pIdx->aSample==0 ){ db->mallocFailed = 1; sqlite3_finalize(pStmt); return SQLITE_NOMEM; } } | | > | 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 | pIdx->avgEq = pIdx->aiRowEst[1]; if( pIdx->aSample==0 ){ db->mallocFailed = 1; sqlite3_finalize(pStmt); return SQLITE_NOMEM; } } rc = sqlite3_finalize(pStmt); if( rc ) return rc; zSql = sqlite3MPrintf(db, "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat3", zDb); if( !zSql ){ return SQLITE_NOMEM; } rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); |
︙ | ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | } default: assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); { const char *z = (const char *)( (eType==SQLITE_BLOB) ? sqlite3_column_blob(pStmt, 4): sqlite3_column_text(pStmt, 4) ); | | | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | } default: assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); { const char *z = (const char *)( (eType==SQLITE_BLOB) ? sqlite3_column_blob(pStmt, 4): sqlite3_column_text(pStmt, 4) ); int n = z ? sqlite3_column_bytes(pStmt, 4) : 0; if( n>0xffff ) n = 0xffff; pSample->nByte = (u16)n; if( n < 1){ pSample->u.z = 0; }else{ pSample->u.z = sqlite3Malloc(n); if( pSample->u.z==0 ){ |
︙ | ︙ |