Fossil SCM
Improve comment
Commit
c1afe56ffa50bf118c06284413f5a3e680180224
Parent
be58684514f8c7d…
1 file changed
+12
-5
+12
-5
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -1229,11 +1229,22 @@ | ||
| 1229 | 1229 | MS_GLOB, /* Matches tags against a list of GLOB patterns. */ |
| 1230 | 1230 | MS_REGEXP /* Matches tags against a list of regular expressions. */ |
| 1231 | 1231 | } MatchStyle; |
| 1232 | 1232 | |
| 1233 | 1233 | /* |
| 1234 | -** Construct the tag match expression. | |
| 1234 | +** Construct the tag match SQL expression. | |
| 1235 | +** | |
| 1236 | +** This function is adapted from glob_expr() to support the MS_EXACT, MS_LIKE, | |
| 1237 | +** MS_GLOB, and MS_REGEXP match styles. For MS_EXACT, the returned expression | |
| 1238 | +** checks for integer match against the tag ID which is looked up directly by | |
| 1239 | +** this function. For the other modes, the returned SQL expression performs | |
| 1240 | +** string comparisons against the tag names, so it is necessary to join against | |
| 1241 | +** the tag table to access the "tagname" column. | |
| 1242 | +** | |
| 1243 | +** Each pattern is adjusted to to start with "sym-" and be anchored at end. | |
| 1244 | +** | |
| 1245 | +** In MS_REGEXP mode, backslash can be used to protect delimiter characters. | |
| 1235 | 1246 | */ |
| 1236 | 1247 | static const char *tagMatchExpression( |
| 1237 | 1248 | MatchStyle matchStyle, /* Match style code */ |
| 1238 | 1249 | const char *zTag, /* Tag name, match pattern, or list of patterns */ |
| 1239 | 1250 | int *pCount /* Pointer to match pattern count variable */ |
| @@ -1264,14 +1275,10 @@ | ||
| 1264 | 1275 | }else/* if( matchStyle==MS_REGEXP )*/{ |
| 1265 | 1276 | zPre = "REGEXP '^sym-"; |
| 1266 | 1277 | zSuf = "$'"; |
| 1267 | 1278 | } |
| 1268 | 1279 | |
| 1269 | - /* The following code is glob_expr() modified to support LIKE and REGEXP, plus | |
| 1270 | - * adjust each pattern to start with "sym-" and be anchored at end. In REGEXP | |
| 1271 | - * mode, it allows backslash to protect delimiter characters. */ | |
| 1272 | - | |
| 1273 | 1280 | /* Convert the list of matches into an SQL expression. */ |
| 1274 | 1281 | *pCount = 0; |
| 1275 | 1282 | blob_zero(&blob); |
| 1276 | 1283 | while( 1 ){ |
| 1277 | 1284 | /* Skip leading delimiters. */ |
| 1278 | 1285 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1229,11 +1229,22 @@ | |
| 1229 | MS_GLOB, /* Matches tags against a list of GLOB patterns. */ |
| 1230 | MS_REGEXP /* Matches tags against a list of regular expressions. */ |
| 1231 | } MatchStyle; |
| 1232 | |
| 1233 | /* |
| 1234 | ** Construct the tag match expression. |
| 1235 | */ |
| 1236 | static const char *tagMatchExpression( |
| 1237 | MatchStyle matchStyle, /* Match style code */ |
| 1238 | const char *zTag, /* Tag name, match pattern, or list of patterns */ |
| 1239 | int *pCount /* Pointer to match pattern count variable */ |
| @@ -1264,14 +1275,10 @@ | |
| 1264 | }else/* if( matchStyle==MS_REGEXP )*/{ |
| 1265 | zPre = "REGEXP '^sym-"; |
| 1266 | zSuf = "$'"; |
| 1267 | } |
| 1268 | |
| 1269 | /* The following code is glob_expr() modified to support LIKE and REGEXP, plus |
| 1270 | * adjust each pattern to start with "sym-" and be anchored at end. In REGEXP |
| 1271 | * mode, it allows backslash to protect delimiter characters. */ |
| 1272 | |
| 1273 | /* Convert the list of matches into an SQL expression. */ |
| 1274 | *pCount = 0; |
| 1275 | blob_zero(&blob); |
| 1276 | while( 1 ){ |
| 1277 | /* Skip leading delimiters. */ |
| 1278 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -1229,11 +1229,22 @@ | |
| 1229 | MS_GLOB, /* Matches tags against a list of GLOB patterns. */ |
| 1230 | MS_REGEXP /* Matches tags against a list of regular expressions. */ |
| 1231 | } MatchStyle; |
| 1232 | |
| 1233 | /* |
| 1234 | ** Construct the tag match SQL expression. |
| 1235 | ** |
| 1236 | ** This function is adapted from glob_expr() to support the MS_EXACT, MS_LIKE, |
| 1237 | ** MS_GLOB, and MS_REGEXP match styles. For MS_EXACT, the returned expression |
| 1238 | ** checks for integer match against the tag ID which is looked up directly by |
| 1239 | ** this function. For the other modes, the returned SQL expression performs |
| 1240 | ** string comparisons against the tag names, so it is necessary to join against |
| 1241 | ** the tag table to access the "tagname" column. |
| 1242 | ** |
| 1243 | ** Each pattern is adjusted to to start with "sym-" and be anchored at end. |
| 1244 | ** |
| 1245 | ** In MS_REGEXP mode, backslash can be used to protect delimiter characters. |
| 1246 | */ |
| 1247 | static const char *tagMatchExpression( |
| 1248 | MatchStyle matchStyle, /* Match style code */ |
| 1249 | const char *zTag, /* Tag name, match pattern, or list of patterns */ |
| 1250 | int *pCount /* Pointer to match pattern count variable */ |
| @@ -1264,14 +1275,10 @@ | |
| 1275 | }else/* if( matchStyle==MS_REGEXP )*/{ |
| 1276 | zPre = "REGEXP '^sym-"; |
| 1277 | zSuf = "$'"; |
| 1278 | } |
| 1279 | |
| 1280 | /* Convert the list of matches into an SQL expression. */ |
| 1281 | *pCount = 0; |
| 1282 | blob_zero(&blob); |
| 1283 | while( 1 ){ |
| 1284 | /* Skip leading delimiters. */ |
| 1285 |