Lines Matching refs:pDb

109   SqliteDb *pDb;        /* Database connection that owns this function */  member
192 SqliteDb *pDb; /* Associated database connection */ member
215 static void closeIncrblobChannels(SqliteDb *pDb){ in closeIncrblobChannels() argument
219 for(p=pDb->pIncrblob; p; p=pNext){ in closeIncrblobChannels()
226 Tcl_UnregisterChannel(pDb->interp, p->channel); in closeIncrblobChannels()
239 sqlite3 *db = p->pDb->db; in incrblobClose()
248 if( p->pDb->pIncrblob==p ){ in incrblobClose()
249 p->pDb->pIncrblob = p->pNext; in incrblobClose()
393 SqliteDb *pDb, in createIncrblobChannel() argument
401 sqlite3 *db = pDb->db; in createIncrblobChannel()
412 Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE); in createIncrblobChannel()
425 p->pNext = pDb->pIncrblob; in createIncrblobChannel()
430 pDb->pIncrblob = p; in createIncrblobChannel()
431 p->pDb = pDb; in createIncrblobChannel()
437 #define closeIncrblobChannels(pDb) argument
472 static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){ in findSqlFunc() argument
478 for(p=pDb->pFunc; p; p=p->pNext){ in findSqlFunc()
484 pNew->interp = pDb->interp; in findSqlFunc()
485 pNew->pDb = pDb; in findSqlFunc()
487 pNew->pNext = pDb->pFunc; in findSqlFunc()
488 pDb->pFunc = pNew; in findSqlFunc()
508 static void flushStmtCache(SqliteDb *pDb){ in flushStmtCache() argument
512 for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pNext){ in flushStmtCache()
516 pDb->nStmt = 0; in flushStmtCache()
517 pDb->stmtLast = 0; in flushStmtCache()
518 pDb->stmtList = 0; in flushStmtCache()
525 static void addDatabaseRef(SqliteDb *pDb){ in addDatabaseRef() argument
526 pDb->nRef++; in addDatabaseRef()
533 static void delDatabaseRef(SqliteDb *pDb){ in delDatabaseRef() argument
534 assert( pDb->nRef>0 ); in delDatabaseRef()
535 pDb->nRef--; in delDatabaseRef()
536 if( pDb->nRef==0 ){ in delDatabaseRef()
537 flushStmtCache(pDb); in delDatabaseRef()
538 closeIncrblobChannels(pDb); in delDatabaseRef()
539 sqlite3_close(pDb->db); in delDatabaseRef()
540 while( pDb->pFunc ){ in delDatabaseRef()
541 SqlFunc *pFunc = pDb->pFunc; in delDatabaseRef()
542 pDb->pFunc = pFunc->pNext; in delDatabaseRef()
543 assert( pFunc->pDb==pDb ); in delDatabaseRef()
547 while( pDb->pCollate ){ in delDatabaseRef()
548 SqlCollate *pCollate = pDb->pCollate; in delDatabaseRef()
549 pDb->pCollate = pCollate->pNext; in delDatabaseRef()
552 if( pDb->zBusy ){ in delDatabaseRef()
553 Tcl_Free(pDb->zBusy); in delDatabaseRef()
555 if( pDb->zTrace ){ in delDatabaseRef()
556 Tcl_Free(pDb->zTrace); in delDatabaseRef()
558 if( pDb->zTraceV2 ){ in delDatabaseRef()
559 Tcl_Free(pDb->zTraceV2); in delDatabaseRef()
561 if( pDb->zProfile ){ in delDatabaseRef()
562 Tcl_Free(pDb->zProfile); in delDatabaseRef()
564 if( pDb->zBindFallback ){ in delDatabaseRef()
565 Tcl_Free(pDb->zBindFallback); in delDatabaseRef()
567 if( pDb->zAuth ){ in delDatabaseRef()
568 Tcl_Free(pDb->zAuth); in delDatabaseRef()
570 if( pDb->zNull ){ in delDatabaseRef()
571 Tcl_Free(pDb->zNull); in delDatabaseRef()
573 if( pDb->pUpdateHook ){ in delDatabaseRef()
574 Tcl_DecrRefCount(pDb->pUpdateHook); in delDatabaseRef()
576 if( pDb->pPreUpdateHook ){ in delDatabaseRef()
577 Tcl_DecrRefCount(pDb->pPreUpdateHook); in delDatabaseRef()
579 if( pDb->pRollbackHook ){ in delDatabaseRef()
580 Tcl_DecrRefCount(pDb->pRollbackHook); in delDatabaseRef()
582 if( pDb->pWalHook ){ in delDatabaseRef()
583 Tcl_DecrRefCount(pDb->pWalHook); in delDatabaseRef()
585 if( pDb->pCollateNeeded ){ in delDatabaseRef()
586 Tcl_DecrRefCount(pDb->pCollateNeeded); in delDatabaseRef()
588 Tcl_Free((char*)pDb); in delDatabaseRef()
597 SqliteDb *pDb = (SqliteDb*)db; in DbDeleteCmd() local
598 delDatabaseRef(pDb); in DbDeleteCmd()
606 SqliteDb *pDb = (SqliteDb*)cd; in DbBusyHandler() local
611 rc = Tcl_VarEval(pDb->interp, pDb->zBusy, " ", zVal, (char*)0); in DbBusyHandler()
612 if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ in DbBusyHandler()
623 SqliteDb *pDb = (SqliteDb*)cd; in DbProgressHandler() local
626 assert( pDb->zProgress ); in DbProgressHandler()
627 rc = Tcl_Eval(pDb->interp, pDb->zProgress); in DbProgressHandler()
628 if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ in DbProgressHandler()
642 SqliteDb *pDb = (SqliteDb*)cd; in DbTraceHandler() local
646 Tcl_DStringAppend(&str, pDb->zTrace, -1); in DbTraceHandler()
648 Tcl_Eval(pDb->interp, Tcl_DStringValue(&str)); in DbTraceHandler()
650 Tcl_ResetResult(pDb->interp); in DbTraceHandler()
667 SqliteDb *pDb = (SqliteDb*)cd; in DbTraceV2Handler() local
675 pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1); in DbTraceV2Handler()
677 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
679 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
681 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbTraceV2Handler()
683 Tcl_ResetResult(pDb->interp); in DbTraceV2Handler()
690 pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1); in DbTraceV2Handler()
692 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
694 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
696 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbTraceV2Handler()
698 Tcl_ResetResult(pDb->interp); in DbTraceV2Handler()
704 pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1); in DbTraceV2Handler()
706 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
708 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbTraceV2Handler()
710 Tcl_ResetResult(pDb->interp); in DbTraceV2Handler()
716 pCmd = Tcl_NewStringObj(pDb->zTraceV2, -1); in DbTraceV2Handler()
718 Tcl_ListObjAppendElement(pDb->interp, pCmd, in DbTraceV2Handler()
720 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbTraceV2Handler()
722 Tcl_ResetResult(pDb->interp); in DbTraceV2Handler()
737 SqliteDb *pDb = (SqliteDb*)cd; in DbProfileHandler() local
743 Tcl_DStringAppend(&str, pDb->zProfile, -1); in DbProfileHandler()
746 Tcl_Eval(pDb->interp, Tcl_DStringValue(&str)); in DbProfileHandler()
748 Tcl_ResetResult(pDb->interp); in DbProfileHandler()
759 SqliteDb *pDb = (SqliteDb*)cd; in DbCommitHandler() local
762 rc = Tcl_Eval(pDb->interp, pDb->zCommit); in DbCommitHandler()
763 if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ in DbCommitHandler()
770 SqliteDb *pDb = (SqliteDb*)clientData; in DbRollbackHandler() local
771 assert(pDb->pRollbackHook); in DbRollbackHandler()
772 if( TCL_OK!=Tcl_EvalObjEx(pDb->interp, pDb->pRollbackHook, 0) ){ in DbRollbackHandler()
773 Tcl_BackgroundError(pDb->interp); in DbRollbackHandler()
788 SqliteDb *pDb = (SqliteDb*)clientData; in DbWalHandler() local
789 Tcl_Interp *interp = pDb->interp; in DbWalHandler()
790 assert(pDb->pWalHook); in DbWalHandler()
792 assert( db==pDb->db ); in DbWalHandler()
793 p = Tcl_DuplicateObj(pDb->pWalHook); in DbWalHandler()
824 SqliteDb *pDb = (SqliteDb *)apArg[i]; in DbUnlockNotify() local
825 setTestUnlockNotifyVars(pDb->interp, i, nArg); in DbUnlockNotify()
826 assert( pDb->pUnlockNotify); in DbUnlockNotify()
827 Tcl_EvalObjEx(pDb->interp, pDb->pUnlockNotify, flags); in DbUnlockNotify()
828 Tcl_DecrRefCount(pDb->pUnlockNotify); in DbUnlockNotify()
829 pDb->pUnlockNotify = 0; in DbUnlockNotify()
847 SqliteDb *pDb = (SqliteDb *)p; in DbPreUpdateHandler() local
854 assert( pDb->pPreUpdateHook ); in DbPreUpdateHandler()
855 assert( db==pDb->db ); in DbPreUpdateHandler()
858 pCmd = Tcl_DuplicateObj(pDb->pPreUpdateHook); in DbPreUpdateHandler()
865 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbPreUpdateHandler()
877 SqliteDb *pDb = (SqliteDb *)p; in DbUpdateHandler() local
885 assert( pDb->pUpdateHook ); in DbUpdateHandler()
888 pCmd = Tcl_DuplicateObj(pDb->pUpdateHook); in DbUpdateHandler()
894 Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT); in DbUpdateHandler()
904 SqliteDb *pDb = (SqliteDb *)pCtx; in tclCollateNeeded() local
905 Tcl_Obj *pScript = Tcl_DuplicateObj(pDb->pCollateNeeded); in tclCollateNeeded()
908 Tcl_EvalObjEx(pDb->interp, pScript, 0); in tclCollateNeeded()
998 pVal = Tcl_NewStringObj(p->pDb->zNull, -1); in tclSqlFunc()
1109 SqliteDb *pDb = (SqliteDb*)pArg; in auth_callback() local
1110 if( pDb->disableAuth ) return SQLITE_OK; in auth_callback()
1153 Tcl_DStringAppend(&str, pDb->zAuth, -1); in auth_callback()
1162 rc = Tcl_GlobalEval(pDb->interp, Tcl_DStringValue(&str)); in auth_callback()
1164 zReply = rc==TCL_OK ? Tcl_GetStringResult(pDb->interp) : "SQLITE_DENY"; in auth_callback()
1243 SqliteDb *pDb = (SqliteDb*)data[0]; in DbTransPostCmd() local
1247 pDb->nTransaction--; in DbTransPostCmd()
1248 zEnd = azEnd[(rc==TCL_ERROR)*2 + (pDb->nTransaction==0)]; in DbTransPostCmd()
1250 pDb->disableAuth++; in DbTransPostCmd()
1251 if( sqlite3_exec(pDb->db, zEnd, 0, 0, 0) ){ in DbTransPostCmd()
1263 Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), (char*)0); in DbTransPostCmd()
1266 sqlite3_exec(pDb->db, "ROLLBACK", 0, 0, 0); in DbTransPostCmd()
1268 pDb->disableAuth--; in DbTransPostCmd()
1270 delDatabaseRef(pDb); in DbTransPostCmd()
1282 SqliteDb *pDb, /* Database object */ in dbPrepare() argument
1289 if( pDb->bLegacyPrepare ){ in dbPrepare()
1290 return sqlite3_prepare(pDb->db, zSql, -1, ppStmt, pzOut); in dbPrepare()
1296 if( pDb->maxStmt>5 ) prepFlags = SQLITE_PREPARE_PERSISTENT; in dbPrepare()
1298 return sqlite3_prepare_v3(pDb->db, zSql, -1, prepFlags, ppStmt, pzOut); in dbPrepare()
1317 SqliteDb *pDb, /* Database object */ in dbPrepareAndBind() argument
1332 Tcl_Interp *interp = pDb->interp; in dbPrepareAndBind()
1340 for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){ in dbPrepareAndBind()
1356 pDb->stmtList = pPreStmt->pNext; in dbPrepareAndBind()
1361 pDb->stmtLast = pPreStmt->pPrev; in dbPrepareAndBind()
1363 pDb->nStmt--; in dbPrepareAndBind()
1374 if( SQLITE_OK!=dbPrepare(pDb, zSql, &pStmt, pzOut) ){ in dbPrepareAndBind()
1375 Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1)); in dbPrepareAndBind()
1379 if( SQLITE_OK!=sqlite3_errcode(pDb->db) ){ in dbPrepareAndBind()
1381 Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1)); in dbPrepareAndBind()
1419 if( pVar==0 && pDb->zBindFallback!=0 ){ in dbPrepareAndBind()
1422 pCmd = Tcl_NewStringObj(pDb->zBindFallback, -1); in dbPrepareAndBind()
1473 if( needResultReset ) Tcl_ResetResult(pDb->interp); in dbPrepareAndBind()
1478 if( needResultReset && rc==TCL_OK ) Tcl_ResetResult(pDb->interp); in dbPrepareAndBind()
1493 SqliteDb *pDb, /* Database handle */ in dbReleaseStmt() argument
1505 if( pDb->maxStmt<=0 || discard ){ in dbReleaseStmt()
1510 pPreStmt->pNext = pDb->stmtList; in dbReleaseStmt()
1512 if( pDb->stmtList ){ in dbReleaseStmt()
1513 pDb->stmtList->pPrev = pPreStmt; in dbReleaseStmt()
1515 pDb->stmtList = pPreStmt; in dbReleaseStmt()
1516 if( pDb->stmtLast==0 ){ in dbReleaseStmt()
1517 assert( pDb->nStmt==0 ); in dbReleaseStmt()
1518 pDb->stmtLast = pPreStmt; in dbReleaseStmt()
1520 assert( pDb->nStmt>0 ); in dbReleaseStmt()
1522 pDb->nStmt++; in dbReleaseStmt()
1526 while( pDb->nStmt>pDb->maxStmt ){ in dbReleaseStmt()
1527 SqlPreparedStmt *pLast = pDb->stmtLast; in dbReleaseStmt()
1528 pDb->stmtLast = pLast->pPrev; in dbReleaseStmt()
1529 pDb->stmtLast->pNext = 0; in dbReleaseStmt()
1530 pDb->nStmt--; in dbReleaseStmt()
1547 SqliteDb *pDb; /* Database handle */ member
1589 SqliteDb *pDb, /* Database handle */ in dbEvalInit() argument
1595 p->pDb = pDb; in dbEvalInit()
1604 addDatabaseRef(p->pDb); in dbEvalInit()
1637 Tcl_Interp *interp = p->pDb->interp; in dbEvalRowInfo()
1676 rc = dbPrepareAndBind(p->pDb, p->zSql, &p->zSql, &p->pPreStmt); in dbEvalStep()
1680 SqliteDb *pDb = p->pDb; in dbEvalStep() local
1693 pDb->nStep = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_FULLSCAN_STEP,1); in dbEvalStep()
1694 pDb->nSort = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_SORT,1); in dbEvalStep()
1695 pDb->nIndex = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_AUTOINDEX,1); in dbEvalStep()
1696 pDb->nVMStep = sqlite3_stmt_status(pStmt,SQLITE_STMTSTATUS_VM_STEP,1); in dbEvalStep()
1703 dbReleaseStmt(pDb, pPreStmt, 1); in dbEvalStep()
1705 if( p->pDb->bLegacyPrepare && rcs==SQLITE_SCHEMA && zPrevSql ){ in dbEvalStep()
1715 Tcl_SetObjResult(pDb->interp, in dbEvalStep()
1716 Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1)); in dbEvalStep()
1719 dbReleaseStmt(pDb, pPreStmt, 0); in dbEvalStep()
1736 dbReleaseStmt(p->pDb, p->pPreStmt, 0); in dbEvalFinalize()
1745 delDatabaseRef(p->pDb); in dbEvalFinalize()
1774 return Tcl_NewStringObj(p->pDb->zNull, -1); in dbEvalColumnValue()
1889 SqliteDb *pDb, /* Database handle */ in DbHookCmd() argument
1893 sqlite3 *db = pDb->db; in DbHookCmd()
1911 sqlite3_preupdate_hook(db, (pDb->pPreUpdateHook?DbPreUpdateHandler:0), pDb); in DbHookCmd()
1913 sqlite3_update_hook(db, (pDb->pUpdateHook?DbUpdateHandler:0), pDb); in DbHookCmd()
1914 sqlite3_rollback_hook(db, (pDb->pRollbackHook?DbRollbackHandler:0), pDb); in DbHookCmd()
1915 sqlite3_wal_hook(db, (pDb->pWalHook?DbWalHandler:0), pDb); in DbHookCmd()
1937 SqliteDb *pDb = (SqliteDb*)cd; in DbObjCmd() local
2013 if( pDb->zAuth ){ in DbObjCmd()
2014 Tcl_AppendResult(interp, pDb->zAuth, (char*)0); in DbObjCmd()
2019 if( pDb->zAuth ){ in DbObjCmd()
2020 Tcl_Free(pDb->zAuth); in DbObjCmd()
2024 pDb->zAuth = Tcl_Alloc( len + 1 ); in DbObjCmd()
2025 memcpy(pDb->zAuth, zAuth, len+1); in DbObjCmd()
2027 pDb->zAuth = 0; in DbObjCmd()
2029 if( pDb->zAuth ){ in DbObjCmd()
2033 pDb->interp = interp; in DbObjCmd()
2034 sqlite3_set_authorizer(pDb->db,(sqlite3_auth_cb)auth_callback,pDb); in DbObjCmd()
2036 sqlite3_set_authorizer(pDb->db, 0, 0); in DbObjCmd()
2066 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE| pDb->openFlags, 0); in DbObjCmd()
2073 pBackup = sqlite3_backup_init(pDest, "main", pDb->db, zSrcDb); in DbObjCmd()
2116 if( pDb->zBindFallback ){ in DbObjCmd()
2117 Tcl_AppendResult(interp, pDb->zBindFallback, (char*)0); in DbObjCmd()
2122 if( pDb->zBindFallback ){ in DbObjCmd()
2123 Tcl_Free(pDb->zBindFallback); in DbObjCmd()
2127 pDb->zBindFallback = Tcl_Alloc( len + 1 ); in DbObjCmd()
2128 memcpy(pDb->zBindFallback, zCallback, len+1); in DbObjCmd()
2130 pDb->zBindFallback = 0; in DbObjCmd()
2146 if( pDb->zBusy ){ in DbObjCmd()
2147 Tcl_AppendResult(interp, pDb->zBusy, (char*)0); in DbObjCmd()
2152 if( pDb->zBusy ){ in DbObjCmd()
2153 Tcl_Free(pDb->zBusy); in DbObjCmd()
2157 pDb->zBusy = Tcl_Alloc( len + 1 ); in DbObjCmd()
2158 memcpy(pDb->zBusy, zBusy, len+1); in DbObjCmd()
2160 pDb->zBusy = 0; in DbObjCmd()
2162 if( pDb->zBusy ){ in DbObjCmd()
2163 pDb->interp = interp; in DbObjCmd()
2164 sqlite3_busy_handler(pDb->db, DbBusyHandler, pDb); in DbObjCmd()
2166 sqlite3_busy_handler(pDb->db, 0, 0); in DbObjCmd()
2192 flushStmtCache( pDb ); in DbObjCmd()
2205 flushStmtCache( pDb ); in DbObjCmd()
2210 pDb->maxStmt = n; in DbObjCmd()
2235 Tcl_SetWideIntObj(pResult, sqlite3_changes64(pDb->db)); in DbObjCmd()
2268 pCollate->pNext = pDb->pCollate; in DbObjCmd()
2270 pDb->pCollate = pCollate; in DbObjCmd()
2272 if( sqlite3_create_collation(pDb->db, zName, SQLITE_UTF8, in DbObjCmd()
2274 Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE); in DbObjCmd()
2291 if( pDb->pCollateNeeded ){ in DbObjCmd()
2292 Tcl_DecrRefCount(pDb->pCollateNeeded); in DbObjCmd()
2294 pDb->pCollateNeeded = Tcl_DuplicateObj(objv[2]); in DbObjCmd()
2295 Tcl_IncrRefCount(pDb->pCollateNeeded); in DbObjCmd()
2296 sqlite3_collation_needed(pDb->db, pDb, tclCollateNeeded); in DbObjCmd()
2312 if( pDb->zCommit ){ in DbObjCmd()
2313 Tcl_AppendResult(interp, pDb->zCommit, (char*)0); in DbObjCmd()
2318 if( pDb->zCommit ){ in DbObjCmd()
2319 Tcl_Free(pDb->zCommit); in DbObjCmd()
2323 pDb->zCommit = Tcl_Alloc( len + 1 ); in DbObjCmd()
2324 memcpy(pDb->zCommit, zCommit, len+1); in DbObjCmd()
2326 pDb->zCommit = 0; in DbObjCmd()
2328 if( pDb->zCommit ){ in DbObjCmd()
2329 pDb->interp = interp; in DbObjCmd()
2330 sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb); in DbObjCmd()
2332 sqlite3_commit_hook(pDb->db, 0, 0); in DbObjCmd()
2398 sqlite3_db_config(pDb->db, aDbConfig[ii].op, -1, &v); in DbObjCmd()
2422 sqlite3_db_config(pDb->db, aDbConfig[ii].op, onoff, &v); in DbObjCmd()
2508 rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0); in DbObjCmd()
2511 Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
2534 rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0); in DbObjCmd()
2537 Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
2553 (void)sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0); in DbObjCmd()
2597 Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
2605 (void)sqlite3_exec(pDb->db, zCommit, 0, 0, 0); in DbObjCmd()
2684 xrc = sqlite3_deserialize(pDb->db, zSchema, pData, len, len, flags); in DbObjCmd()
2690 sqlite3_file_control(pDb->db, zSchema,SQLITE_FCNTL_SIZE_LIMIT,&mxSize); in DbObjCmd()
2714 sqlite3_enable_load_extension(pDb->db, onoff); in DbObjCmd()
2730 Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_errcode(pDb->db))); in DbObjCmd()
2741 Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_error_offset(pDb->db))); in DbObjCmd()
2761 dbEvalInit(&sEval, pDb, objv[2], 0, 0); in DbObjCmd()
2814 dbEvalInit(&sEval, pDb, objv[2], 0, 0); in DbObjCmd()
2842 dbEvalInit(p, pDb, objv[2], pArray, evalFlags); in DbObjCmd()
2925 pFunc = findSqlFunc(pDb, zName); in DbObjCmd()
2934 rc = sqlite3_create_function(pDb->db, zName, nArg, flags, in DbObjCmd()
2938 Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE); in DbObjCmd()
2976 interp, pDb, zDb, zTable, zColumn, (sqlite3_int64)iRow, isReadonly in DbObjCmd()
2990 sqlite3_interrupt(pDb->db); in DbObjCmd()
3010 if( pDb->zNull ){ in DbObjCmd()
3011 Tcl_Free(pDb->zNull); in DbObjCmd()
3014 pDb->zNull = Tcl_Alloc( len + 1 ); in DbObjCmd()
3015 memcpy(pDb->zNull, zNull, len); in DbObjCmd()
3016 pDb->zNull[len] = '\0'; in DbObjCmd()
3018 pDb->zNull = 0; in DbObjCmd()
3021 Tcl_SetObjResult(interp, Tcl_NewStringObj(pDb->zNull, -1)); in DbObjCmd()
3037 rowid = sqlite3_last_insert_rowid(pDb->db); in DbObjCmd()
3054 if( pDb->zProgress ){ in DbObjCmd()
3055 Tcl_AppendResult(interp, pDb->zProgress, (char*)0); in DbObjCmd()
3064 if( pDb->zProgress ){ in DbObjCmd()
3065 Tcl_Free(pDb->zProgress); in DbObjCmd()
3069 pDb->zProgress = Tcl_Alloc( len + 1 ); in DbObjCmd()
3070 memcpy(pDb->zProgress, zProgress, len+1); in DbObjCmd()
3072 pDb->zProgress = 0; in DbObjCmd()
3075 if( pDb->zProgress ){ in DbObjCmd()
3076 pDb->interp = interp; in DbObjCmd()
3077 sqlite3_progress_handler(pDb->db, N, DbProgressHandler, pDb); in DbObjCmd()
3079 sqlite3_progress_handler(pDb->db, 0, 0, 0); in DbObjCmd()
3100 if( pDb->zProfile ){ in DbObjCmd()
3101 Tcl_AppendResult(interp, pDb->zProfile, (char*)0); in DbObjCmd()
3106 if( pDb->zProfile ){ in DbObjCmd()
3107 Tcl_Free(pDb->zProfile); in DbObjCmd()
3111 pDb->zProfile = Tcl_Alloc( len + 1 ); in DbObjCmd()
3112 memcpy(pDb->zProfile, zProfile, len+1); in DbObjCmd()
3114 pDb->zProfile = 0; in DbObjCmd()
3118 if( pDb->zProfile ){ in DbObjCmd()
3119 pDb->interp = interp; in DbObjCmd()
3120 sqlite3_profile(pDb->db, DbProfileHandler, pDb); in DbObjCmd()
3122 sqlite3_profile(pDb->db, 0, 0); in DbObjCmd()
3165 SQLITE_OPEN_READONLY | pDb->openFlags, 0); in DbObjCmd()
3172 pBackup = sqlite3_backup_init(pDb->db, zDestDb, pSrc, "main"); in DbObjCmd()
3175 sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
3195 sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
3221 pData = sqlite3_serialize(pDb->db, zSchema, &sz, SQLITE_SERIALIZE_NOCOPY); in DbObjCmd()
3225 pData = sqlite3_serialize(pDb->db, zSchema, &sz, 0); in DbObjCmd()
3250 v = pDb->nStep; in DbObjCmd()
3252 v = pDb->nSort; in DbObjCmd()
3254 v = pDb->nIndex; in DbObjCmd()
3256 v = pDb->nVMStep; in DbObjCmd()
3279 sqlite3_busy_timeout(pDb->db, ms); in DbObjCmd()
3296 Tcl_SetWideIntObj(pResult, sqlite3_total_changes64(pDb->db)); in DbObjCmd()
3311 if( pDb->zTrace ){ in DbObjCmd()
3312 Tcl_AppendResult(interp, pDb->zTrace, (char*)0); in DbObjCmd()
3317 if( pDb->zTrace ){ in DbObjCmd()
3318 Tcl_Free(pDb->zTrace); in DbObjCmd()
3322 pDb->zTrace = Tcl_Alloc( len + 1 ); in DbObjCmd()
3323 memcpy(pDb->zTrace, zTrace, len+1); in DbObjCmd()
3325 pDb->zTrace = 0; in DbObjCmd()
3329 if( pDb->zTrace ){ in DbObjCmd()
3330 pDb->interp = interp; in DbObjCmd()
3331 sqlite3_trace(pDb->db, DbTraceHandler, pDb); in DbObjCmd()
3333 sqlite3_trace(pDb->db, 0, 0); in DbObjCmd()
3351 if( pDb->zTraceV2 ){ in DbObjCmd()
3352 Tcl_AppendResult(interp, pDb->zTraceV2, (char*)0); in DbObjCmd()
3400 if( pDb->zTraceV2 ){ in DbObjCmd()
3401 Tcl_Free(pDb->zTraceV2); in DbObjCmd()
3405 pDb->zTraceV2 = Tcl_Alloc( len + 1 ); in DbObjCmd()
3406 memcpy(pDb->zTraceV2, zTraceV2, len+1); in DbObjCmd()
3408 pDb->zTraceV2 = 0; in DbObjCmd()
3411 if( pDb->zTraceV2 ){ in DbObjCmd()
3412 pDb->interp = interp; in DbObjCmd()
3413 sqlite3_trace_v2(pDb->db, (unsigned)wMask, DbTraceV2Handler, pDb); in DbObjCmd()
3415 sqlite3_trace_v2(pDb->db, 0, 0, 0); in DbObjCmd()
3441 if( pDb->nTransaction==0 && objc==4 ){ in DbObjCmd()
3462 pDb->disableAuth++; in DbObjCmd()
3463 rc = sqlite3_exec(pDb->db, zBegin, 0, 0, 0); in DbObjCmd()
3464 pDb->disableAuth--; in DbObjCmd()
3466 Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
3469 pDb->nTransaction++; in DbObjCmd()
3476 addDatabaseRef(pDb); /* DbTransPostCmd() calls delDatabaseRef() */ in DbObjCmd()
3502 if( pDb->pUnlockNotify ){ in DbObjCmd()
3503 Tcl_DecrRefCount(pDb->pUnlockNotify); in DbObjCmd()
3504 pDb->pUnlockNotify = 0; in DbObjCmd()
3509 pNotifyArg = (void *)pDb; in DbObjCmd()
3510 pDb->pUnlockNotify = objv[2]; in DbObjCmd()
3511 Tcl_IncrRefCount(pDb->pUnlockNotify); in DbObjCmd()
3514 if( sqlite3_unlock_notify(pDb->db, xNotify, pNotifyArg) ){ in DbObjCmd()
3515 Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
3550 int nCol = sqlite3_preupdate_count(pDb->db); in DbObjCmd()
3560 DbHookCmd(interp, pDb, (objc==4 ? objv[3] : 0), &pDb->pPreUpdateHook); in DbObjCmd()
3570 pRet = Tcl_NewIntObj(sqlite3_preupdate_depth(pDb->db)); in DbObjCmd()
3588 rc = sqlite3_preupdate_old(pDb->db, iIdx, &pValue); in DbObjCmd()
3591 rc = sqlite3_preupdate_new(pDb->db, iIdx, &pValue); in DbObjCmd()
3599 Tcl_AppendResult(interp, sqlite3_errmsg(pDb->db), (char*)0); in DbObjCmd()
3620 if( choice==DB_WAL_HOOK ) ppHook = &pDb->pWalHook; in DbObjCmd()
3621 if( choice==DB_UPDATE_HOOK ) ppHook = &pDb->pUpdateHook; in DbObjCmd()
3622 if( choice==DB_ROLLBACK_HOOK ) ppHook = &pDb->pRollbackHook; in DbObjCmd()
3628 DbHookCmd(interp, pDb, (objc==3 ? objv[2] : 0), ppHook); in DbObjCmd()
3648 if( Tcl_GetBooleanFromObj(interp, objv[i], &pDb->bLegacyPrepare) ){ in DbObjCmd()
3661 pDb->stmtList ? pDb->stmtList->pStmt: 0); in DbObjCmd()