| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2005 July 8 | 2 ** 2005 July 8 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 #endif | 135 #endif |
| 136 | 136 |
| 137 v = sqlite3GetVdbe(pParse); | 137 v = sqlite3GetVdbe(pParse); |
| 138 if( v==0 || NEVER(pTab==0) ){ | 138 if( v==0 || NEVER(pTab==0) ){ |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 if( pTab->tnum==0 ){ | 141 if( pTab->tnum==0 ){ |
| 142 /* Do not gather statistics on views or virtual tables */ | 142 /* Do not gather statistics on views or virtual tables */ |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 if( memcmp(pTab->zName, "sqlite_", 7)==0 ){ | 145 if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){ |
| 146 /* Do not gather statistics on system tables */ | 146 /* Do not gather statistics on system tables */ |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 assert( sqlite3BtreeHoldsAllMutexes(db) ); | 149 assert( sqlite3BtreeHoldsAllMutexes(db) ); |
| 150 iDb = sqlite3SchemaToIndex(db, pTab->pSchema); | 150 iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 151 assert( iDb>=0 ); | 151 assert( iDb>=0 ); |
| 152 assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); | 152 assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); |
| 153 #ifndef SQLITE_OMIT_AUTHORIZATION | 153 #ifndef SQLITE_OMIT_AUTHORIZATION |
| 154 if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, | 154 if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, |
| 155 db->aDb[iDb].zName ) ){ | 155 db->aDb[iDb].zName ) ){ |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 for(i=0; *z && i<=n; i++){ | 541 for(i=0; *z && i<=n; i++){ |
| 542 v = 0; | 542 v = 0; |
| 543 while( (c=z[0])>='0' && c<='9' ){ | 543 while( (c=z[0])>='0' && c<='9' ){ |
| 544 v = v*10 + c - '0'; | 544 v = v*10 + c - '0'; |
| 545 z++; | 545 z++; |
| 546 } | 546 } |
| 547 if( i==0 ) pTable->nRowEst = v; | 547 if( i==0 ) pTable->nRowEst = v; |
| 548 if( pIndex==0 ) break; | 548 if( pIndex==0 ) break; |
| 549 pIndex->aiRowEst[i] = v; | 549 pIndex->aiRowEst[i] = v; |
| 550 if( *z==' ' ) z++; | 550 if( *z==' ' ) z++; |
| 551 if( memcmp(z, "unordered", 10)==0 ){ | 551 if( strcmp(z, "unordered")==0 ){ |
| 552 pIndex->bUnordered = 1; | 552 pIndex->bUnordered = 1; |
| 553 break; | 553 break; |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 return 0; | 556 return 0; |
| 557 } | 557 } |
| 558 | 558 |
| 559 /* | 559 /* |
| 560 ** If the Index.aSample variable is not NULL, delete the aSample[] array | 560 ** If the Index.aSample variable is not NULL, delete the aSample[] array |
| 561 ** and its contents. | 561 ** and its contents. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 #endif | 710 #endif |
| 711 | 711 |
| 712 if( rc==SQLITE_NOMEM ){ | 712 if( rc==SQLITE_NOMEM ){ |
| 713 db->mallocFailed = 1; | 713 db->mallocFailed = 1; |
| 714 } | 714 } |
| 715 return rc; | 715 return rc; |
| 716 } | 716 } |
| 717 | 717 |
| 718 | 718 |
| 719 #endif /* SQLITE_OMIT_ANALYZE */ | 719 #endif /* SQLITE_OMIT_ANALYZE */ |
| OLD | NEW |