OLD | NEW |
1 /* | 1 /* |
2 ** 2013-04-16 | 2 ** 2013-04-16 |
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 ** | 479 ** |
480 ** If it is, return a pointer to the first character of VALUE. | 480 ** If it is, return a pointer to the first character of VALUE. |
481 ** If not, return NULL. Spaces around the = are ignored. | 481 ** If not, return NULL. Spaces around the = are ignored. |
482 */ | 482 */ |
483 static const char *closureValueOfKey(const char *zKey, const char *zStr){ | 483 static const char *closureValueOfKey(const char *zKey, const char *zStr){ |
484 int nKey = (int)strlen(zKey); | 484 int nKey = (int)strlen(zKey); |
485 int nStr = (int)strlen(zStr); | 485 int nStr = (int)strlen(zStr); |
486 int i; | 486 int i; |
487 if( nStr<nKey+1 ) return 0; | 487 if( nStr<nKey+1 ) return 0; |
488 if( memcmp(zStr, zKey, nKey)!=0 ) return 0; | 488 if( memcmp(zStr, zKey, nKey)!=0 ) return 0; |
489 for(i=nKey; isspace(zStr[i]); i++){} | 489 for(i=nKey; isspace((unsigned char)zStr[i]); i++){} |
490 if( zStr[i]!='=' ) return 0; | 490 if( zStr[i]!='=' ) return 0; |
491 i++; | 491 i++; |
492 while( isspace(zStr[i]) ){ i++; } | 492 while( isspace((unsigned char)zStr[i]) ){ i++; } |
493 return zStr+i; | 493 return zStr+i; |
494 } | 494 } |
495 | 495 |
496 /* | 496 /* |
497 ** xConnect/xCreate method for the closure module. Arguments are: | 497 ** xConnect/xCreate method for the closure module. Arguments are: |
498 ** | 498 ** |
499 ** argv[0] -> module name ("transitive_closure") | 499 ** argv[0] -> module name ("transitive_closure") |
500 ** argv[1] -> database name | 500 ** argv[1] -> database name |
501 ** argv[2] -> table name | 501 ** argv[2] -> table name |
502 ** argv[3...] -> arguments | 502 ** argv[3...] -> arguments |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 const sqlite3_api_routines *pApi | 949 const sqlite3_api_routines *pApi |
950 ){ | 950 ){ |
951 int rc = SQLITE_OK; | 951 int rc = SQLITE_OK; |
952 SQLITE_EXTENSION_INIT2(pApi); | 952 SQLITE_EXTENSION_INIT2(pApi); |
953 (void)pzErrMsg; | 953 (void)pzErrMsg; |
954 #ifndef SQLITE_OMIT_VIRTUALTABLE | 954 #ifndef SQLITE_OMIT_VIRTUALTABLE |
955 rc = sqlite3_create_module(db, "transitive_closure", &closureModule, 0); | 955 rc = sqlite3_create_module(db, "transitive_closure", &closureModule, 0); |
956 #endif /* SQLITE_OMIT_VIRTUALTABLE */ | 956 #endif /* SQLITE_OMIT_VIRTUALTABLE */ |
957 return rc; | 957 return rc; |
958 } | 958 } |
OLD | NEW |