mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
76
third_party/sqlite3/vtab.c
vendored
76
third_party/sqlite3/vtab.c
vendored
|
@ -18,7 +18,7 @@
|
|||
/*
|
||||
** Before a virtual table xCreate() or xConnect() method is invoked, the
|
||||
** sqlite3.pVtabCtx member variable is set to point to an instance of
|
||||
** this struct allocated on the stack. It is used by the implementation of
|
||||
** this struct allocated on the stack. It is used by the implementation of
|
||||
** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which
|
||||
** are invoked only from within xCreate and xConnect methods.
|
||||
*/
|
||||
|
@ -175,7 +175,7 @@ void sqlite3VtabModuleUnref(sqlite3 *db, Module *pMod){
|
|||
/*
|
||||
** Lock the virtual table so that it cannot be disconnected.
|
||||
** Locks nest. Every lock should have a corresponding unlock.
|
||||
** If an unlock is omitted, resources leaks will occur.
|
||||
** If an unlock is omitted, resources leaks will occur.
|
||||
**
|
||||
** If a disconnect is attempted while a virtual table is locked,
|
||||
** the disconnect is deferred until all locks have been removed.
|
||||
|
@ -187,7 +187,7 @@ void sqlite3VtabLock(VTable *pVTab){
|
|||
|
||||
/*
|
||||
** pTab is a pointer to a Table structure representing a virtual-table.
|
||||
** Return a pointer to the VTable object used by connection db to access
|
||||
** Return a pointer to the VTable object used by connection db to access
|
||||
** this virtual-table, if one has been created, or NULL otherwise.
|
||||
*/
|
||||
VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){
|
||||
|
@ -222,7 +222,7 @@ void sqlite3VtabUnlock(VTable *pVTab){
|
|||
/*
|
||||
** Table p is a virtual table. This function moves all elements in the
|
||||
** p->pVTable list to the sqlite3.pDisconnect lists of their associated
|
||||
** database connections to be disconnected at the next opportunity.
|
||||
** database connections to be disconnected at the next opportunity.
|
||||
** Except, if argument db is not NULL, then the entry associated with
|
||||
** connection db is left in the p->pVTable list.
|
||||
*/
|
||||
|
@ -231,8 +231,8 @@ static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){
|
|||
VTable *pVTable = p->pVTable;
|
||||
p->pVTable = 0;
|
||||
|
||||
/* Assert that the mutex (if any) associated with the BtShared database
|
||||
** that contains table p is held by the caller. See header comments
|
||||
/* Assert that the mutex (if any) associated with the BtShared database
|
||||
** that contains table p is held by the caller. See header comments
|
||||
** above function sqlite3VtabUnlockList() for an explanation of why
|
||||
** this makes it safe to access the sqlite3.pDisconnect list of any
|
||||
** database connection that may have an entry in the p->pVTable list.
|
||||
|
@ -288,7 +288,7 @@ void sqlite3VtabDisconnect(sqlite3 *db, Table *p){
|
|||
** Disconnect all the virtual table objects in the sqlite3.pDisconnect list.
|
||||
**
|
||||
** This function may only be called when the mutexes associated with all
|
||||
** shared b-tree databases opened using connection db are held by the
|
||||
** shared b-tree databases opened using connection db are held by the
|
||||
** caller. This is done to protect the sqlite3.pDisconnect list. The
|
||||
** sqlite3.pDisconnect list is accessed only as follows:
|
||||
**
|
||||
|
@ -301,7 +301,7 @@ void sqlite3VtabDisconnect(sqlite3 *db, Table *p){
|
|||
** or, if the virtual table is stored in a non-sharable database, then
|
||||
** the database handle mutex is held.
|
||||
**
|
||||
** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously
|
||||
** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously
|
||||
** by multiple threads. It is thread-safe.
|
||||
*/
|
||||
void sqlite3VtabUnlockList(sqlite3 *db){
|
||||
|
@ -327,12 +327,12 @@ void sqlite3VtabUnlockList(sqlite3 *db){
|
|||
** record.
|
||||
**
|
||||
** Since it is a virtual-table, the Table structure contains a pointer
|
||||
** to the head of a linked list of VTable structures. Each VTable
|
||||
** to the head of a linked list of VTable structures. Each VTable
|
||||
** structure is associated with a single sqlite3* user of the schema.
|
||||
** The reference count of the VTable structure associated with database
|
||||
** connection db is decremented immediately (which may lead to the
|
||||
** The reference count of the VTable structure associated with database
|
||||
** connection db is decremented immediately (which may lead to the
|
||||
** structure being xDisconnected and free). Any other VTable structures
|
||||
** in the list are moved to the sqlite3.pDisconnect list of the associated
|
||||
** in the list are moved to the sqlite3.pDisconnect list of the associated
|
||||
** database connection.
|
||||
*/
|
||||
void sqlite3VtabClear(sqlite3 *db, Table *p){
|
||||
|
@ -412,7 +412,7 @@ void sqlite3VtabBeginParse(
|
|||
if( pTable->azModuleArg ){
|
||||
int iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
|
||||
assert( iDb>=0 ); /* The database the table is being created in */
|
||||
sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName,
|
||||
sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName,
|
||||
pTable->azModuleArg[0], pParse->db->aDb[iDb].zDbSName);
|
||||
}
|
||||
#endif
|
||||
|
@ -444,7 +444,7 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
|
|||
addArgumentToVtab(pParse);
|
||||
pParse->sArg.z = 0;
|
||||
if( pTab->nModuleArg<1 ) return;
|
||||
|
||||
|
||||
/* If the CREATE VIRTUAL TABLE statement is being entered for the
|
||||
** first time (in other words if the virtual table is actually being
|
||||
** created now instead of just being read out of sqlite_schema) then
|
||||
|
@ -466,9 +466,9 @@ void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
|
|||
}
|
||||
zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken);
|
||||
|
||||
/* A slot for the record has already been allocated in the
|
||||
/* A slot for the record has already been allocated in the
|
||||
** schema table. We just need to update that slot with all
|
||||
** the information we've collected.
|
||||
** the information we've collected.
|
||||
**
|
||||
** The VM register number pParse->regRowid holds the rowid of an
|
||||
** entry in the sqlite_schema table tht was created for this vtab
|
||||
|
@ -549,7 +549,7 @@ void sqlite3VtabArgExtend(Parse *pParse, Token *p){
|
|||
** to this procedure.
|
||||
*/
|
||||
static int vtabCallConstructor(
|
||||
sqlite3 *db,
|
||||
sqlite3 *db,
|
||||
Table *pTab,
|
||||
Module *pMod,
|
||||
int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),
|
||||
|
@ -568,7 +568,7 @@ static int vtabCallConstructor(
|
|||
/* Check that the virtual-table is not already being initialized */
|
||||
for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){
|
||||
if( pCtx->pTab==pTab ){
|
||||
*pzErr = sqlite3MPrintf(db,
|
||||
*pzErr = sqlite3MPrintf(db,
|
||||
"vtable constructor called recursively: %s", pTab->zName
|
||||
);
|
||||
return SQLITE_LOCKED;
|
||||
|
@ -630,7 +630,7 @@ static int vtabCallConstructor(
|
|||
int iCol;
|
||||
u16 oooHidden = 0;
|
||||
/* If everything went according to plan, link the new VTable structure
|
||||
** into the linked list headed by pTab->pVTable. Then loop through the
|
||||
** into the linked list headed by pTab->pVTable. Then loop through the
|
||||
** columns of the table to see if any of them contain the token "hidden".
|
||||
** If so, set the Column COLFLAG_HIDDEN flag and remove the token from
|
||||
** the type string. */
|
||||
|
@ -676,7 +676,7 @@ static int vtabCallConstructor(
|
|||
|
||||
/*
|
||||
** This function is invoked by the parser to call the xConnect() method
|
||||
** of the virtual table pTab. If an error occurs, an error code is returned
|
||||
** of the virtual table pTab. If an error occurs, an error code is returned
|
||||
** and an error left in pParse.
|
||||
**
|
||||
** This call is a no-op if table pTab is not a virtual table.
|
||||
|
@ -747,7 +747,7 @@ static void addToVTrans(sqlite3 *db, VTable *pVTab){
|
|||
|
||||
/*
|
||||
** This function is invoked by the vdbe to call the xCreate method
|
||||
** of the virtual table named zTab in database iDb.
|
||||
** of the virtual table named zTab in database iDb.
|
||||
**
|
||||
** If an error occurs, *pzErr is set to point to an English language
|
||||
** description of the error and an SQLITE_XXX error code is returned.
|
||||
|
@ -766,8 +766,8 @@ int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){
|
|||
zMod = pTab->azModuleArg[0];
|
||||
pMod = (Module*)sqlite3HashFind(&db->aModule, zMod);
|
||||
|
||||
/* If the module has been registered and includes a Create method,
|
||||
** invoke it now. If the module has not been registered, return an
|
||||
/* If the module has been registered and includes a Create method,
|
||||
** invoke it now. If the module has not been registered, return an
|
||||
** error. Otherwise, do nothing.
|
||||
*/
|
||||
if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){
|
||||
|
@ -820,7 +820,7 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
|
|||
sParse.eParseMode = PARSE_MODE_DECLARE_VTAB;
|
||||
sParse.db = db;
|
||||
sParse.nQueryLoop = 1;
|
||||
if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
|
||||
if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
|
||||
&& sParse.pNewTable
|
||||
&& !db->mallocFailed
|
||||
&& !sParse.pNewTable->pSelect
|
||||
|
@ -918,7 +918,7 @@ int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){
|
|||
** called is identified by the second argument, "offset", which is
|
||||
** the offset of the method to call in the sqlite3_module structure.
|
||||
**
|
||||
** The array is cleared after invoking the callbacks.
|
||||
** The array is cleared after invoking the callbacks.
|
||||
*/
|
||||
static void callFinaliser(sqlite3 *db, int offset){
|
||||
int i;
|
||||
|
@ -967,7 +967,7 @@ int sqlite3VtabSync(sqlite3 *db, Vdbe *p){
|
|||
}
|
||||
|
||||
/*
|
||||
** Invoke the xRollback method of all virtual tables in the
|
||||
** Invoke the xRollback method of all virtual tables in the
|
||||
** sqlite3.aVTrans array. Then clear the array itself.
|
||||
*/
|
||||
int sqlite3VtabRollback(sqlite3 *db){
|
||||
|
@ -976,7 +976,7 @@ int sqlite3VtabRollback(sqlite3 *db){
|
|||
}
|
||||
|
||||
/*
|
||||
** Invoke the xCommit method of all virtual tables in the
|
||||
** Invoke the xCommit method of all virtual tables in the
|
||||
** sqlite3.aVTrans array. Then clear the array itself.
|
||||
*/
|
||||
int sqlite3VtabCommit(sqlite3 *db){
|
||||
|
@ -998,7 +998,7 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
|
|||
|
||||
/* Special case: If db->aVTrans is NULL and db->nVTrans is greater
|
||||
** than zero, then this function is being called from within a
|
||||
** virtual module xSync() callback. It is illegal to write to
|
||||
** virtual module xSync() callback. It is illegal to write to
|
||||
** virtual module tables in this case, so return SQLITE_LOCKED.
|
||||
*/
|
||||
if( sqlite3VtabInSync(db) ){
|
||||
|
@ -1006,7 +1006,7 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
|
|||
}
|
||||
if( !pVTab ){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
}
|
||||
pModule = pVTab->pVtab->pModule;
|
||||
|
||||
if( pModule->xBegin ){
|
||||
|
@ -1019,7 +1019,7 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
|
|||
}
|
||||
}
|
||||
|
||||
/* Invoke the xBegin method. If successful, add the vtab to the
|
||||
/* Invoke the xBegin method. If successful, add the vtab to the
|
||||
** sqlite3.aVTrans[] array. */
|
||||
rc = growVTrans(db);
|
||||
if( rc==SQLITE_OK ){
|
||||
|
@ -1043,11 +1043,11 @@ int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){
|
|||
** as the second argument to the virtual table method invoked.
|
||||
**
|
||||
** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is
|
||||
** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is
|
||||
** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is
|
||||
** SAVEPOINT_RELEASE, then the xRelease method of each virtual table with
|
||||
** an open transaction is invoked.
|
||||
**
|
||||
** If any virtual table method returns an error code other than SQLITE_OK,
|
||||
** If any virtual table method returns an error code other than SQLITE_OK,
|
||||
** processing is abandoned and the error returned to the caller of this
|
||||
** function immediately. If all calls to virtual table methods are successful,
|
||||
** SQLITE_OK is returned.
|
||||
|
@ -1096,7 +1096,7 @@ int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){
|
|||
** This routine is used to allow virtual table implementations to
|
||||
** overload MATCH, LIKE, GLOB, and REGEXP operators.
|
||||
**
|
||||
** Return either the pDef argument (indicating no change) or a
|
||||
** Return either the pDef argument (indicating no change) or a
|
||||
** new FuncDef structure that is marked as ephemeral using the
|
||||
** SQLITE_FUNC_EPHEM flag.
|
||||
*/
|
||||
|
@ -1125,7 +1125,7 @@ FuncDef *sqlite3VtabOverloadFunction(
|
|||
assert( pVtab->pModule!=0 );
|
||||
pMod = (sqlite3_module *)pVtab->pModule;
|
||||
if( pMod->xFindFunction==0 ) return pDef;
|
||||
|
||||
|
||||
/* Call the xFindFunction method on the virtual table implementation
|
||||
** to see if the implementation wants to overload this function.
|
||||
**
|
||||
|
@ -1243,7 +1243,7 @@ void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){
|
|||
Table *pTab = pMod->pEpoTab;
|
||||
if( pTab!=0 ){
|
||||
/* Mark the table as Ephemeral prior to deleting it, so that the
|
||||
** sqlite3DeleteTable() routine will know that it is not stored in
|
||||
** sqlite3DeleteTable() routine will know that it is not stored in
|
||||
** the schema. */
|
||||
pTab->tabFlags |= TF_Ephemeral;
|
||||
sqlite3DeleteTable(db, pTab);
|
||||
|
@ -1259,8 +1259,8 @@ void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){
|
|||
** within an xUpdate method.
|
||||
*/
|
||||
int sqlite3_vtab_on_conflict(sqlite3 *db){
|
||||
static const unsigned char aMap[] = {
|
||||
SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
|
||||
static const unsigned char aMap[] = {
|
||||
SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE
|
||||
};
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
|
||||
|
@ -1272,7 +1272,7 @@ int sqlite3_vtab_on_conflict(sqlite3 *db){
|
|||
}
|
||||
|
||||
/*
|
||||
** Call from within the xCreate() or xConnect() methods to provide
|
||||
** Call from within the xCreate() or xConnect() methods to provide
|
||||
** the SQLite core with additional information about the behavior
|
||||
** of the virtual table being implemented.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue