Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Have sqlite3ota.c use grave accents instead of double-quotes to enclose identifiers in generated SQL. To avoid having the SQL engine substitute a literal string if a column reference cannot be resolved. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | ota-update |
Files: | files | file ages | folders |
SHA1: |
79f2418429aa05c56069c56d51b4d72f |
User & Date: | dan 2014-09-15 15:22:32.496 |
Context
2014-09-15
| ||
15:34 | Merge latest trunk changes with this branch. (check-in: 55b8011d5b user: dan tags: ota-update) | |
15:22 | Have sqlite3ota.c use grave accents instead of double-quotes to enclose identifiers in generated SQL. To avoid having the SQL engine substitute a literal string if a column reference cannot be resolved. (check-in: 79f2418429 user: dan tags: ota-update) | |
14:54 | Ensure the correct collation sequences are used when sorting data in sqlite3ota.c. (check-in: 473a72d700 user: dan tags: ota-update) | |
Changes
Changes to ext/ota/ota3.test.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 | list [catch { run_ota test.db ota.db } msg] $msg } {1 {SQLITE_MISMATCH - datatype mismatch}} do_execsql_test 2.2 { PRAGMA integrity_check; } {ok} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | list [catch { run_ota test.db ota.db } msg] $msg } {1 {SQLITE_MISMATCH - datatype mismatch}} do_execsql_test 2.2 { PRAGMA integrity_check; } {ok} #-------------------------------------------------------------------- # Test that missing columns are detected. # forcedelete ota.db reset_db do_execsql_test 2.0 { CREATE TABLE x1(a INTEGER PRIMARY KEY, b, c); CREATE INDEX i1 ON x1(b, c); } {} do_test 2.1 { sqlite3 db2 ota.db db2 eval { CREATE TABLE data_x1(a, b, ota_control); INSERT INTO data_x1 VALUES(1, 'a', 0); } db2 close list [catch { run_ota test.db ota.db } msg] $msg } {1 {SQLITE_ERROR - no such column: c}} do_execsql_test 2.2 { PRAGMA integrity_check; } {ok} finish_test |
Changes to ext/ota/sqlite3ota.c.
︙ | ︙ | |||
295 296 297 298 299 300 301 | } /* ** Allocate a buffer and populate it with the double-quoted version of the ** string in the argument buffer, suitable for use as an SQL identifier. ** For example: ** | | | | | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | } /* ** Allocate a buffer and populate it with the double-quoted version of the ** string in the argument buffer, suitable for use as an SQL identifier. ** For example: ** ** [quick `brown` fox] -> [`quick ``brown`` fox`] ** ** Assuming the allocation is successful, a pointer to the new buffer is ** returned. It is the responsibility of the caller to free it using ** sqlite3_free() at some point in the future. Or, if the allocation fails, ** a NULL pointer is returned. */ static char *otaQuoteName(const char *zName){ int nName = strlen(zName); char *zRet = sqlite3_malloc(nName * 2 + 2 + 1); if( zRet ){ int i; char *p = zRet; *p++ = '`'; for(i=0; i<nName; i++){ if( zName[i]=='`' ) *p++ = '`'; *p++ = zName[i]; } *p++ = '`'; *p++ = '\0'; } return zRet; } /* ** Argument zFmt is a sqlite3_mprintf() style format string. The trailing |
︙ | ︙ |