Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the sqlite_dbpage virtual table so that it starts a write transaction on all attached schemas. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
642a0b4752743216271e4f855a465515 |
User & Date: | drh 2022-03-09 14:22:28 |
References
2022-04-08
| ||
17:01 | Enhance the sqlite_dbpage fix at check-in 642a0b4752743 from about a month ago such that it still takes a transaction on all attached databases, but it only starts a read transaction for read-only operations, rather than starting a write transaction for everything. (check-in: 8efd61e8 user: drh tags: trunk) | |
2022-03-10
| ||
01:15 | Check-in [642a0b4752743216] fixing sqlite_dbpage is not exactly correct. This patch should fix it. (check-in: b6c4c8a0 user: drh tags: branch-3.38) | |
01:10 | Check-in [642a0b4752743216] fixing sqlite_dbpage is not exactly correct. This patch should fix it. (check-in: 6ba36714 user: drh tags: trunk) | |
Context
2022-03-09
| ||
18:29 | Further refinements to the sqlite_offset() fix from [6029514b08b88e3f]. (check-in: 6f838305 user: drh tags: trunk) | |
14:29 | Fix the sqlite_dbpage virtual table so that it starts a write transaction on all attached schemas. (check-in: e92c4fdb user: drh tags: branch-3.38) | |
14:22 | Fix the sqlite_dbpage virtual table so that it starts a write transaction on all attached schemas. (check-in: 642a0b47 user: drh tags: trunk) | |
13:22 | Do not use va_arg() as an l-value, because AIX does not allow that, from what we are told. (check-in: 46d1a6de user: drh tags: trunk) | |
Changes
Changes to src/dbpage.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn<=0 && pIdxInfo->aOrderBy[0].desc==0 ){ pIdxInfo->orderByConsumed = 1; } return SQLITE_OK; } /* ** Open a new dbpagevfs cursor. */ static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ | > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn<=0 && pIdxInfo->aOrderBy[0].desc==0 ){ pIdxInfo->orderByConsumed = 1; } sqlite3VtabWriteAll(pIdxInfo); return SQLITE_OK; } /* ** Open a new dbpagevfs cursor. */ static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 | void sqlite3VtabFinishParse(Parse*, Token*); void sqlite3VtabArgInit(Parse*); void sqlite3VtabArgExtend(Parse*, Token*); int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); int sqlite3VtabCallConnect(Parse*, Table*); int sqlite3VtabCallDestroy(sqlite3*, int, const char *); int sqlite3VtabBegin(sqlite3 *, VTable *); FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); void sqlite3ParseObjectInit(Parse*,sqlite3*); void sqlite3ParseObjectReset(Parse*); void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*); #ifdef SQLITE_ENABLE_NORMALIZE | > > > > > | 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 | void sqlite3VtabFinishParse(Parse*, Token*); void sqlite3VtabArgInit(Parse*); void sqlite3VtabArgExtend(Parse*, Token*); int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); int sqlite3VtabCallConnect(Parse*, Table*); int sqlite3VtabCallDestroy(sqlite3*, int, const char *); int sqlite3VtabBegin(sqlite3 *, VTable *); FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ && !defined(SQLITE_OMIT_VIRTUALTABLE) void sqlite3VtabWriteAll(sqlite3_index_info*); #endif sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); void sqlite3ParseObjectInit(Parse*,sqlite3*); void sqlite3ParseObjectReset(Parse*); void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*); #ifdef SQLITE_ENABLE_NORMALIZE |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
3760 3761 3762 3763 3764 3765 3766 | if( rc==SQLITE_OK && pVal==0 ){ /* IMP: R-19933-32160 */ rc = SQLITE_NOTFOUND; /* IMP: R-36424-56542 */ } return rc; } | < > > > > > > > > > > > > > > > > | 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 | if( rc==SQLITE_OK && pVal==0 ){ /* IMP: R-19933-32160 */ rc = SQLITE_NOTFOUND; /* IMP: R-36424-56542 */ } return rc; } /* ** Return true if ORDER BY clause may be handled as DISTINCT. */ int sqlite3_vtab_distinct(sqlite3_index_info *pIdxInfo){ HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; assert( pHidden->eDistinct==0 || pHidden->eDistinct==1 || pHidden->eDistinct==2 ); return pHidden->eDistinct; } #if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ && !defined(SQLITE_OMIT_VIRTUALTABLE) /* ** Cause the prepared statement that is associated with a call to ** xBestIndex to open write transactions on all attached schemas. ** This is used by the (built-in) sqlite_dbpage virtual table. */ void sqlite3VtabWriteAll(sqlite3_index_info *pIdxInfo){ HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; Parse *pParse = pHidden->pParse; Parse *pTopLevel = sqlite3ParseToplevel(pParse); pTopLevel->cookieMask = pTopLevel->writeMask = (((u64)1) << pParse->db->nDb) - 1; } #endif /* ** Add all WhereLoop objects for a table of the join identified by ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. ** ** If there are no LEFT or CROSS JOIN joins in the query, both mPrereq and ** mUnusable are set to 0. Otherwise, mPrereq is a mask of all FROM clause |
︙ | ︙ |