Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix memory leaks in the code on this branch. Make use of the sqlite3_index_constraint.usage field. Do not try to handle ORDER BY terms with explicit COLLATE clauses - they don't get passed to the vtab layer anyway. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | schemalint |
Files: | files | file ages | folders |
SHA3-256: |
0cd75a872c89958a7f418720a0e8c6f6 |
User & Date: | dan 2017-04-15 14:16:04.093 |
Context
2017-04-15
| ||
14:30 | Add header comment for sqlite3_vtab_collation(). (check-in: d238694ca4 user: dan tags: schemalint) | |
14:16 | Fix memory leaks in the code on this branch. Make use of the sqlite3_index_constraint.usage field. Do not try to handle ORDER BY terms with explicit COLLATE clauses - they don't get passed to the vtab layer anyway. (check-in: 0cd75a872c user: dan tags: schemalint) | |
2017-04-14
| ||
19:41 | Modify the code in ext/expert/ to use the vtab interface instead of sqlite3_whereinfo_hook(). Remove sqlite3_whereinfo_hook(). (check-in: 3bb6585004 user: dan tags: schemalint) | |
Changes
Changes to ext/expert/sqlite3expert.c.
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - | ** Used to temporarily link IdxConstraint objects into lists while ** creating candidate indexes. */ struct IdxConstraint { char *zColl; /* Collation sequence */ int bRange; /* True for range, false for eq */ int iCol; /* Constrained table column */ |
︙ | |||
107 108 109 110 111 112 113 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | - - - - - - - - - - - - - - - - - - - | IdxHashEntry *pNext; /* Next entry in hash */ }; struct IdxHash { IdxHashEntry *pFirst; IdxHashEntry *aHash[IDX_HASH_SIZE]; }; |
︙ | |||
162 163 164 165 166 167 168 | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | memset(pRet, 0, nByte); }else{ *pRc = SQLITE_NOMEM; } return pRet; } |
︙ | |||
422 423 424 425 426 427 428 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | - - + + - - + + - - - + + - - - - + + - + | /* Link the new scan object into the list */ pScan->pTab = p->pTab; pScan->pNextScan = p->pExpert->pScan; p->pExpert->pScan = pScan; /* Add the constraints to the IdxScan object */ for(i=0; i<pIdxInfo->nConstraint; i++){ |
︙ | |||
809 810 811 812 813 814 815 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | - + | *pRc = rc; return 0; } static int idxCreateFromCons( sqlite3expert *p, |
︙ | |||
878 879 880 881 882 883 884 | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | - - - - + - + - - + - - - + - + - - + - - - + - - - - - - - - - - - - - - - - - - - + + + + - - - | if( p->iCol==pCmp->iCol ) return 1; } return 0; } static int idxCreateFromWhere( sqlite3expert *p, |
︙ | |||
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | + + + + + + + + + + + + | for(p=pStatement; p!=pLast; p=pNext){ pNext = p->pNext; sqlite3_free(p->zEQP); sqlite3_free(p->zIdx); sqlite3_free(p); } } /* ** Free the linked list of IdxTable objects starting at pTab. */ static void idxTableFree(IdxTable *pTab){ IdxTable *pIter; IdxTable *pNext; for(pIter=pTab; pIter; pIter=pNext){ pNext = pIter->pNext; sqlite3_free(pIter); } } /* ** This function is called after candidate indexes have been created. It ** runs all the queries to see which indexes they prefer, and populates ** IdxStatement.zIdx and IdxStatement.zEQP with the results. */ |
︙ | |||
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | + | rc = sqlite3_exec(p->dbv, zOuter, 0, 0, pzErrmsg); } sqlite3_free(zInner); sqlite3_free(zOuter); } } } idxFinalize(&rc, pSchema); return rc; } /* ** Allocate a new sqlite3expert object. */ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ |
︙ | |||
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 | 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | + + | */ void sqlite3_expert_destroy(sqlite3expert *p){ if( p ){ sqlite3_close(p->dbm); sqlite3_close(p->dbv); idxScanFree(p->pScan, 0); idxStatementFree(p->pStatement, 0); idxTableFree(p->pTable); idxHashClear(&p->hIdx); sqlite3_free(p->zCandidates); sqlite3_free(p); } } #endif /* !defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHEREINFO_HOOK) */ |
Changes to src/where.c.
︙ | |||
3116 3117 3118 3119 3120 3121 3122 | 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 | - - + - - - - - + + + + - - - - - - - - | return rc; } struct BestIndexCtx { WhereClause *pWC; sqlite3_index_info *pIdxInfo; |
︙ | |||
3208 3209 3210 3211 3212 3213 3214 | 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | - | sqlite3DbFree(pParse->db, p); return SQLITE_NOMEM_BKPT; } bic.pWC = pWC; bic.pIdxInfo = p; bic.pParse = pParse; |
︙ |