Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | [ead1432af9 | An earlier refactoring on this branch] broke the new array-based setting method: got a little too clever with my use of DB handles. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | fossil-spawn |
| Files: | files | file ages | folders |
| SHA3-256: |
3bcf3abd56df7e0ddd00aee06fe5d229 |
| User & Date: | wyoung 2021-06-22 08:46:03.583 |
| Original Comment: | Earlier refactoring broke the new array-based setting method: got a little too clever with my use of DB handles. |
Context
|
2021-06-22
| ||
| 16:29 | Removed a few bits of src/carray.c that are only needed to allow building the module as a loadable extension. This goes beyond code minimalism, because one of the lines referenced a header we don't provide within Fossil, sqlite3ext.h, which means the only reason this branch compiled before is that it was picking up thje system version, risking a version mismatch when building against the internal SQLite. Build bug caught by initial work on the MinGW port, which doesn't provide that header. check-in: 202ea753e4 user: wyoung tags: fossil-spawn | |
| 08:46 | [ead1432af9 | An earlier refactoring on this branch] broke the new array-based setting method: got a little too clever with my use of DB handles. check-in: 3bcf3abd56 user: wyoung tags: fossil-spawn | |
| 08:45 | Comment clarification check-in: c625c259a1 user: wyoung tags: fossil-spawn | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
4516 4517 4518 4519 4520 4521 4522 |
}
/*
** Serializes the passed array as a JSON array of strings.
*/
const char* json_serialize_array(char* const azValues[], size_t nValues){
Stmt q;
| | | | | | > | 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 |
}
/*
** Serializes the passed array as a JSON array of strings.
*/
const char* json_serialize_array(char* const azValues[], size_t nValues){
Stmt q;
sqlite3 *old_g_db = g.db;
sqlite3_open(":memory:", &g.db);
sqlite3_carray_init(g.db, 0, 0);
db_prepare(&q, "SELECT json_group_array(value) FROM carray(?1)");
if( sqlite3_carray_bind(q.pStmt, 1, (void*)azValues, nValues, CARRAY_TEXT,
SQLITE_STATIC)!= SQLITE_OK){
fossil_fatal("Could not bind argv array for JSON: %s\n",
sqlite3_errmsg(g.db));
}
if( db_step(&q)==SQLITE_ROW ){
const char* ret = fossil_strdup(db_column_text(&q, 0));
db_finalize(&q);
sqlite3_close(g.db);
g.db = old_g_db;
return ret;
}else{
fossil_fatal("SQLite error: %s", sqlite3_errmsg(g.db));
}
}
/*
|
| ︙ | ︙ |