Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Changes to allow the code in sqlite3expert.c to be tested directly (via the API in sqlite3expert.h) instead of by invoking the sqlite3_expert application. Fix memory leaks and other problems. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | schemalint |
Files: | files | file ages | folders |
SHA3-256: |
5dd9831721b70a89a26728adcd49c7f6 |
User & Date: | dan 2017-04-10 16:13:20.707 |
Context
2017-04-10
| ||
20:00 | Add ext/expert/README.md. (check-in: 9318f1b9ed user: dan tags: schemalint) | |
16:13 | Changes to allow the code in sqlite3expert.c to be tested directly (via the API in sqlite3expert.h) instead of by invoking the sqlite3_expert application. Fix memory leaks and other problems. (check-in: 5dd9831721 user: dan tags: schemalint) | |
2017-04-09
| ||
08:38 | Fix the -file option on the sqlite3_expert program. (check-in: 0857c48e02 user: dan tags: schemalint) | |
Changes
Name change from test/expert1.test to ext/expert/expert1.test.
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + | set testprefix expert1 if {$tcl_platform(platform)=="windows"} { set CMD "sqlite3_expert.exe" } else { set CMD ".././sqlite3_expert" } |
Changes to ext/expert/sqlite3expert.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | + + - | /* ** 2016 February 10 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ #if !defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHEREINFO_HOOK) #include "sqlite3expert.h" #include <assert.h> #include <string.h> #include <stdio.h> typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef struct IdxConstraint IdxConstraint; |
︙ | |||
85 86 87 88 89 90 91 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - - - - - - - - - - - - - | int iPk; }; struct IdxTable { int nCol; IdxColumn *aCol; }; |
︙ | |||
297 298 299 300 301 302 303 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | - + | return pNew; } /* ** sqlite3_whereinfo_hook() callback. */ static void idxWhereInfo( |
︙ | |||
789 790 791 792 793 794 795 796 797 798 799 800 801 | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + | } idxHash64Clear(&hMask); } return rc; } static void idxConstraintFree(IdxConstraint *pConstraint){ IdxConstraint *pNext; IdxConstraint *p; for(p=pConstraint; p; p=pNext){ pNext = p->pNext; sqlite3_free(p); } } /* ** Free all elements of the linked list starting from pScan up until pLast ** (pLast is not freed). */ static void idxScanFree(IdxScan *pScan, IdxScan *pLast){ |
︙ | |||
871 872 873 874 875 876 877 878 879 880 881 882 883 884 | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | + | pStmt->zIdx = idxAppendText(&rc, 0, "(no new indexes)\n"); } idxFinalize(&rc, pExplain); } find_indexes_out: idxHashClear(&hIdx); return rc; } /* ** Allocate a new sqlite3expert object. */ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ |
︙ | |||
970 971 972 973 974 975 976 | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | - + + + + + + + | IdxScan *pIter; /* Load IdxTable objects */ for(pIter=p->pScan; pIter && rc==SQLITE_OK; pIter=pIter->pNextScan){ rc = idxGetTableInfo(p->dbm, pIter, pzErr); } |
︙ | |||
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | + + + | /* ** Free an sqlite3expert object. */ void sqlite3_expert_destroy(sqlite3expert *p){ sqlite3_close(p->dbm); idxScanFree(p->pScan, 0); idxStatementFree(p->pStatement, 0); idxHashClear(&p->hIdx); sqlite3_free(p); } #endif /* !defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHEREINFO_HOOK) */ |
Added ext/expert/test_expert.c.