Fossil SCM
Fix the "files_of_checkin" virtual table so that it works correctly with delta manifests.
Commit
0fba2272faaba6c69938351d2eaaa59a4ad22870
Parent
cc1e96550423b2b…
1 file changed
+10
-6
+10
-6
| --- src/foci.c | ||
| +++ src/foci.c | ||
| @@ -46,11 +46,12 @@ | ||
| 46 | 46 | sqlite3_vtab base; /* Base class - must be first */ |
| 47 | 47 | }; |
| 48 | 48 | struct FociCursor { |
| 49 | 49 | sqlite3_vtab_cursor base; /* Base class - must be first */ |
| 50 | 50 | Manifest *pMan; /* Current manifest */ |
| 51 | - int iFile; /* Index of current file */ | |
| 51 | + ManifestFile *pFile; /* Current file */ | |
| 52 | + int iFile; /* File index */ | |
| 52 | 53 | }; |
| 53 | 54 | #endif /* INTERFACE */ |
| 54 | 55 | |
| 55 | 56 | |
| 56 | 57 | /* |
| @@ -127,17 +128,18 @@ | ||
| 127 | 128 | /* |
| 128 | 129 | ** Move a focivfs cursor to the next entry in the file. |
| 129 | 130 | */ |
| 130 | 131 | static int fociNext(sqlite3_vtab_cursor *pCursor){ |
| 131 | 132 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 133 | + pCsr->pFile = manifest_file_next(pCsr->pMan, 0); | |
| 132 | 134 | pCsr->iFile++; |
| 133 | 135 | return SQLITE_OK; |
| 134 | 136 | } |
| 135 | 137 | |
| 136 | 138 | static int fociEof(sqlite3_vtab_cursor *pCursor){ |
| 137 | 139 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 138 | - return pCsr->pMan==0 || pCsr->iFile>=pCsr->pMan->nFile; | |
| 140 | + return pCsr->pFile==0; | |
| 139 | 141 | } |
| 140 | 142 | |
| 141 | 143 | static int fociFilter( |
| 142 | 144 | sqlite3_vtab_cursor *pCursor, |
| 143 | 145 | int idxNum, const char *idxStr, |
| @@ -146,10 +148,12 @@ | ||
| 146 | 148 | FociCursor *pCur = (FociCursor *)pCursor; |
| 147 | 149 | manifest_destroy(pCur->pMan); |
| 148 | 150 | if( idxNum ){ |
| 149 | 151 | pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0); |
| 150 | 152 | pCur->iFile = 0; |
| 153 | + manifest_file_rewind(pCur->pMan); | |
| 154 | + pCur->pFile = manifest_file_next(pCur->pMan, 0); | |
| 151 | 155 | }else{ |
| 152 | 156 | pCur->pMan = 0; |
| 153 | 157 | pCur->iFile = 0; |
| 154 | 158 | } |
| 155 | 159 | return SQLITE_OK; |
| @@ -164,23 +168,23 @@ | ||
| 164 | 168 | switch( i ){ |
| 165 | 169 | case 0: /* checkinID */ |
| 166 | 170 | sqlite3_result_int(ctx, pCsr->pMan->rid); |
| 167 | 171 | break; |
| 168 | 172 | case 1: /* filename */ |
| 169 | - sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zName, -1, | |
| 173 | + sqlite3_result_text(ctx, pCsr->pFile->zName, -1, | |
| 170 | 174 | SQLITE_TRANSIENT); |
| 171 | 175 | break; |
| 172 | 176 | case 2: /* uuid */ |
| 173 | - sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zUuid, -1, | |
| 177 | + sqlite3_result_text(ctx, pCsr->pFile->zUuid, -1, | |
| 174 | 178 | SQLITE_TRANSIENT); |
| 175 | 179 | break; |
| 176 | 180 | case 3: /* previousName */ |
| 177 | - sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zPrior, -1, | |
| 181 | + sqlite3_result_text(ctx, pCsr->pFile->zPrior, -1, | |
| 178 | 182 | SQLITE_TRANSIENT); |
| 179 | 183 | break; |
| 180 | 184 | case 4: /* perm */ |
| 181 | - sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zPerm, -1, | |
| 185 | + sqlite3_result_text(ctx, pCsr->pFile->zPerm, -1, | |
| 182 | 186 | SQLITE_TRANSIENT); |
| 183 | 187 | break; |
| 184 | 188 | } |
| 185 | 189 | return SQLITE_OK; |
| 186 | 190 | } |
| 187 | 191 |
| --- src/foci.c | |
| +++ src/foci.c | |
| @@ -46,11 +46,12 @@ | |
| 46 | sqlite3_vtab base; /* Base class - must be first */ |
| 47 | }; |
| 48 | struct FociCursor { |
| 49 | sqlite3_vtab_cursor base; /* Base class - must be first */ |
| 50 | Manifest *pMan; /* Current manifest */ |
| 51 | int iFile; /* Index of current file */ |
| 52 | }; |
| 53 | #endif /* INTERFACE */ |
| 54 | |
| 55 | |
| 56 | /* |
| @@ -127,17 +128,18 @@ | |
| 127 | /* |
| 128 | ** Move a focivfs cursor to the next entry in the file. |
| 129 | */ |
| 130 | static int fociNext(sqlite3_vtab_cursor *pCursor){ |
| 131 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 132 | pCsr->iFile++; |
| 133 | return SQLITE_OK; |
| 134 | } |
| 135 | |
| 136 | static int fociEof(sqlite3_vtab_cursor *pCursor){ |
| 137 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 138 | return pCsr->pMan==0 || pCsr->iFile>=pCsr->pMan->nFile; |
| 139 | } |
| 140 | |
| 141 | static int fociFilter( |
| 142 | sqlite3_vtab_cursor *pCursor, |
| 143 | int idxNum, const char *idxStr, |
| @@ -146,10 +148,12 @@ | |
| 146 | FociCursor *pCur = (FociCursor *)pCursor; |
| 147 | manifest_destroy(pCur->pMan); |
| 148 | if( idxNum ){ |
| 149 | pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0); |
| 150 | pCur->iFile = 0; |
| 151 | }else{ |
| 152 | pCur->pMan = 0; |
| 153 | pCur->iFile = 0; |
| 154 | } |
| 155 | return SQLITE_OK; |
| @@ -164,23 +168,23 @@ | |
| 164 | switch( i ){ |
| 165 | case 0: /* checkinID */ |
| 166 | sqlite3_result_int(ctx, pCsr->pMan->rid); |
| 167 | break; |
| 168 | case 1: /* filename */ |
| 169 | sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zName, -1, |
| 170 | SQLITE_TRANSIENT); |
| 171 | break; |
| 172 | case 2: /* uuid */ |
| 173 | sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zUuid, -1, |
| 174 | SQLITE_TRANSIENT); |
| 175 | break; |
| 176 | case 3: /* previousName */ |
| 177 | sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zPrior, -1, |
| 178 | SQLITE_TRANSIENT); |
| 179 | break; |
| 180 | case 4: /* perm */ |
| 181 | sqlite3_result_text(ctx, pCsr->pMan->aFile[pCsr->iFile].zPerm, -1, |
| 182 | SQLITE_TRANSIENT); |
| 183 | break; |
| 184 | } |
| 185 | return SQLITE_OK; |
| 186 | } |
| 187 |
| --- src/foci.c | |
| +++ src/foci.c | |
| @@ -46,11 +46,12 @@ | |
| 46 | sqlite3_vtab base; /* Base class - must be first */ |
| 47 | }; |
| 48 | struct FociCursor { |
| 49 | sqlite3_vtab_cursor base; /* Base class - must be first */ |
| 50 | Manifest *pMan; /* Current manifest */ |
| 51 | ManifestFile *pFile; /* Current file */ |
| 52 | int iFile; /* File index */ |
| 53 | }; |
| 54 | #endif /* INTERFACE */ |
| 55 | |
| 56 | |
| 57 | /* |
| @@ -127,17 +128,18 @@ | |
| 128 | /* |
| 129 | ** Move a focivfs cursor to the next entry in the file. |
| 130 | */ |
| 131 | static int fociNext(sqlite3_vtab_cursor *pCursor){ |
| 132 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 133 | pCsr->pFile = manifest_file_next(pCsr->pMan, 0); |
| 134 | pCsr->iFile++; |
| 135 | return SQLITE_OK; |
| 136 | } |
| 137 | |
| 138 | static int fociEof(sqlite3_vtab_cursor *pCursor){ |
| 139 | FociCursor *pCsr = (FociCursor *)pCursor; |
| 140 | return pCsr->pFile==0; |
| 141 | } |
| 142 | |
| 143 | static int fociFilter( |
| 144 | sqlite3_vtab_cursor *pCursor, |
| 145 | int idxNum, const char *idxStr, |
| @@ -146,10 +148,12 @@ | |
| 148 | FociCursor *pCur = (FociCursor *)pCursor; |
| 149 | manifest_destroy(pCur->pMan); |
| 150 | if( idxNum ){ |
| 151 | pCur->pMan = manifest_get(sqlite3_value_int(argv[0]), CFTYPE_MANIFEST, 0); |
| 152 | pCur->iFile = 0; |
| 153 | manifest_file_rewind(pCur->pMan); |
| 154 | pCur->pFile = manifest_file_next(pCur->pMan, 0); |
| 155 | }else{ |
| 156 | pCur->pMan = 0; |
| 157 | pCur->iFile = 0; |
| 158 | } |
| 159 | return SQLITE_OK; |
| @@ -164,23 +168,23 @@ | |
| 168 | switch( i ){ |
| 169 | case 0: /* checkinID */ |
| 170 | sqlite3_result_int(ctx, pCsr->pMan->rid); |
| 171 | break; |
| 172 | case 1: /* filename */ |
| 173 | sqlite3_result_text(ctx, pCsr->pFile->zName, -1, |
| 174 | SQLITE_TRANSIENT); |
| 175 | break; |
| 176 | case 2: /* uuid */ |
| 177 | sqlite3_result_text(ctx, pCsr->pFile->zUuid, -1, |
| 178 | SQLITE_TRANSIENT); |
| 179 | break; |
| 180 | case 3: /* previousName */ |
| 181 | sqlite3_result_text(ctx, pCsr->pFile->zPrior, -1, |
| 182 | SQLITE_TRANSIENT); |
| 183 | break; |
| 184 | case 4: /* perm */ |
| 185 | sqlite3_result_text(ctx, pCsr->pFile->zPerm, -1, |
| 186 | SQLITE_TRANSIENT); |
| 187 | break; |
| 188 | } |
| 189 | return SQLITE_OK; |
| 190 | } |
| 191 |