MCPcopy Create free account
hub / github.com/2shady4u/godot-sqlite / shellModuleSchema

Function shellModuleSchema

src/sqlite/shell.c:25627–25652  ·  view source on GitHub ↗

** SQL function: shell_module_schema(X) ** ** Return a fake schema for the table-valued function or eponymous virtual ** table X. */

Source from the content-addressed store, hash-verified

25625** table X.
25626*/
25627static void shellModuleSchema(
25628 sqlite3_context *pCtx,
25629 int nVal,
25630 sqlite3_value **apVal
25631){
25632 const char *zName;
25633 char *zFake;
25634 ShellState *p = (ShellState*)sqlite3_user_data(pCtx);
25635 FILE *pSavedLog = p->pLog;
25636 UNUSED_PARAMETER(nVal);
25637 zName = (const char*)sqlite3_value_text(apVal[0]);
25638
25639 /* Temporarily disable the ".log" when calling shellFakeSchema() because
25640 ** shellFakeSchema() might generate failures for some ephemeral virtual
25641 ** tables due to missing arguments. Example: fts4aux.
25642 ** https://sqlite.org/forum/forumpost/42fe6520b803be51 */
25643 p->pLog = 0;
25644 zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
25645 p->pLog = pSavedLog;
25646
25647 if( zFake ){
25648 sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
25649 -1, sqlite3_free);
25650 sqlite3_free(zFake);
25651 }
25652}
25653
25654/* Flags for open_db().
25655**

Callers

nothing calls this directly

Calls 1

shellFakeSchemaFunction · 0.85

Tested by

no test coverage detected