mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-25 14:52:28 +00:00
Remove trailing whitespace from all files (#497)
This commit is contained in:
parent
d3f3cb7ab4
commit
7e2eae5c15
356 changed files with 41701 additions and 41680 deletions
190
third_party/sqlite3/main.c
vendored
190
third_party/sqlite3/main.c
vendored
|
@ -107,7 +107,7 @@ const char sqlite3_version[] = SQLITE_VERSION;
|
|||
#endif
|
||||
|
||||
/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns
|
||||
** a pointer to the to the sqlite3_version[] string constant.
|
||||
** a pointer to the to the sqlite3_version[] string constant.
|
||||
*/
|
||||
const char *sqlite3_libversion(void){ return sqlite3_version; }
|
||||
|
||||
|
@ -171,13 +171,13 @@ char *sqlite3_temp_directory = 0;
|
|||
char *sqlite3_data_directory = 0;
|
||||
|
||||
/*
|
||||
** Initialize SQLite.
|
||||
** Initialize SQLite.
|
||||
**
|
||||
** This routine must be called to initialize the memory allocation,
|
||||
** VFS, and mutex subsystems prior to doing any serious work with
|
||||
** SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT
|
||||
** this routine will be called automatically by key routines such as
|
||||
** sqlite3_open().
|
||||
** sqlite3_open().
|
||||
**
|
||||
** This routine is a no-op except on its very first call for the process,
|
||||
** or for the first call after a call to sqlite3_shutdown.
|
||||
|
@ -230,7 +230,7 @@ int sqlite3_initialize(void){
|
|||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/* Make sure the mutex subsystem is initialized. If unable to
|
||||
/* Make sure the mutex subsystem is initialized. If unable to
|
||||
** initialize the mutex subsystem, return early with the error.
|
||||
** If the system is so sick that we are unable to allocate a mutex,
|
||||
** there is not much SQLite is going to be able to do.
|
||||
|
@ -312,7 +312,7 @@ int sqlite3_initialize(void){
|
|||
}
|
||||
#endif
|
||||
if( rc==SQLITE_OK ){
|
||||
sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage,
|
||||
sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage,
|
||||
sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage);
|
||||
sqlite3MemoryBarrier();
|
||||
sqlite3GlobalConfig.isInit = 1;
|
||||
|
@ -530,7 +530,7 @@ int sqlite3_config(int op, ...){
|
|||
** a single parameter which is a pointer to an integer and writes into
|
||||
** that integer the number of extra bytes per page required for each page
|
||||
** in SQLITE_CONFIG_PAGECACHE. */
|
||||
*va_arg(ap, int*) =
|
||||
*va_arg(ap, int*) =
|
||||
sqlite3HeaderSizeBtree() +
|
||||
sqlite3HeaderSizePcache() +
|
||||
sqlite3HeaderSizePcache1();
|
||||
|
@ -617,7 +617,7 @@ int sqlite3_config(int op, ...){
|
|||
sqlite3GlobalConfig.nLookaside = va_arg(ap, int);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Record a pointer to the logger function and its first argument.
|
||||
** The default is NULL. Logging is disabled if the function pointer is
|
||||
** NULL.
|
||||
|
@ -739,7 +739,7 @@ int sqlite3_config(int op, ...){
|
|||
|
||||
/*
|
||||
** Set up the lookaside buffers for a database connection.
|
||||
** Return SQLITE_OK on success.
|
||||
** Return SQLITE_OK on success.
|
||||
** If lookaside is already active, return SQLITE_BUSY.
|
||||
**
|
||||
** The sz parameter is the number of bytes in each lookaside slot.
|
||||
|
@ -754,12 +754,12 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
|
|||
sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt;
|
||||
int nBig; /* Number of full-size slots */
|
||||
int nSm; /* Number smaller LOOKASIDE_SMALL-byte slots */
|
||||
|
||||
|
||||
if( sqlite3LookasideUsed(db,0)>0 ){
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
/* Free any existing lookaside buffer for this handle before
|
||||
** allocating a new one so we don't have to have space for
|
||||
** allocating a new one so we don't have to have space for
|
||||
** both at the same time.
|
||||
*/
|
||||
if( db->lookaside.bMalloced ){
|
||||
|
@ -1034,7 +1034,7 @@ int sqlite3IsBinary(const CollSeq *p){
|
|||
}
|
||||
|
||||
/*
|
||||
** Another built-in collating sequence: NOCASE.
|
||||
** Another built-in collating sequence: NOCASE.
|
||||
**
|
||||
** This collating sequence is intended to be used for "case independent
|
||||
** comparison". SQLite's knowledge of upper and lower case equivalents
|
||||
|
@ -1176,7 +1176,7 @@ static void disconnectAllVtab(sqlite3 *db){
|
|||
|
||||
/*
|
||||
** Return TRUE if database connection db has unfinalized prepared
|
||||
** statements or unfinished sqlite3_backup objects.
|
||||
** statements or unfinished sqlite3_backup objects.
|
||||
*/
|
||||
static int connectionIsBusy(sqlite3 *db){
|
||||
int j;
|
||||
|
@ -1392,7 +1392,7 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
|
|||
/* The temp-database schema is allocated differently from the other schema
|
||||
** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()).
|
||||
** So it needs to be freed here. Todo: Why not roll the temp schema into
|
||||
** the same sqliteMalloc() as the one that allocates the database
|
||||
** the same sqliteMalloc() as the one that allocates the database
|
||||
** structure?
|
||||
*/
|
||||
sqlite3DbFree(db, db->aDb[1].pSchema);
|
||||
|
@ -1420,7 +1420,7 @@ void sqlite3RollbackAll(sqlite3 *db, int tripCode){
|
|||
assert( sqlite3_mutex_held(db->mutex) );
|
||||
sqlite3BeginBenignMalloc();
|
||||
|
||||
/* Obtain all b-tree mutexes before making any calls to BtreeRollback().
|
||||
/* Obtain all b-tree mutexes before making any calls to BtreeRollback().
|
||||
** This is important in case the transaction being rolled back has
|
||||
** modified the database schema. If the b-tree mutexes are not taken
|
||||
** here, then another shared-cache connection might sneak in between
|
||||
|
@ -1705,7 +1705,7 @@ int sqlite3InvokeBusyHandler(BusyHandler *p){
|
|||
}else{
|
||||
p->nBusy++;
|
||||
}
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1736,9 +1736,9 @@ int sqlite3_busy_handler(
|
|||
** be invoked every nOps opcodes.
|
||||
*/
|
||||
void sqlite3_progress_handler(
|
||||
sqlite3 *db,
|
||||
sqlite3 *db,
|
||||
int nOps,
|
||||
int (*xProgress)(void*),
|
||||
int (*xProgress)(void*),
|
||||
void *pArg
|
||||
){
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
|
@ -1798,7 +1798,7 @@ void sqlite3_interrupt(sqlite3 *db){
|
|||
** This function is exactly the same as sqlite3_create_function(), except
|
||||
** that it is designed to be called by internal code. The difference is
|
||||
** that if a malloc() fails in sqlite3_create_function(), an error code
|
||||
** is returned and the mallocFailed flag cleared.
|
||||
** is returned and the mallocFailed flag cleared.
|
||||
*/
|
||||
int sqlite3CreateFunc(
|
||||
sqlite3 *db,
|
||||
|
@ -1840,7 +1840,7 @@ int sqlite3CreateFunc(
|
|||
assert( SQLITE_FUNC_UNSAFE==SQLITE_INNOCUOUS );
|
||||
extraFlags ^= SQLITE_FUNC_UNSAFE;
|
||||
|
||||
|
||||
|
||||
#ifndef SQLITE_OMIT_UTF16
|
||||
/* If SQLITE_UTF16 is specified as the encoding type, transform this
|
||||
** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
|
||||
|
@ -1869,7 +1869,7 @@ int sqlite3CreateFunc(
|
|||
#else
|
||||
enc = SQLITE_UTF8;
|
||||
#endif
|
||||
|
||||
|
||||
/* Check if an existing function is being overridden or deleted. If so,
|
||||
** and there are active VMs, then return SQLITE_BUSY. If a function
|
||||
** is being overridden/deleted but there are no active VMs, allow the
|
||||
|
@ -1878,7 +1878,7 @@ int sqlite3CreateFunc(
|
|||
p = sqlite3FindFunction(db, zFunctionName, nArg, (u8)enc, 0);
|
||||
if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==(u32)enc && p->nArg==nArg ){
|
||||
if( db->nVdbeActive ){
|
||||
sqlite3ErrorWithMsg(db, SQLITE_BUSY,
|
||||
sqlite3ErrorWithMsg(db, SQLITE_BUSY,
|
||||
"unable to delete/modify user-function due to active statements");
|
||||
assert( !db->mallocFailed );
|
||||
return SQLITE_BUSY;
|
||||
|
@ -1953,7 +1953,7 @@ static int createFunctionApi(
|
|||
pArg->xDestroy = xDestroy;
|
||||
pArg->pUserData = p;
|
||||
}
|
||||
rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p,
|
||||
rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p,
|
||||
xSFunc, xStep, xFinal, xValue, xInverse, pArg
|
||||
);
|
||||
if( pArg && pArg->nRef==0 ){
|
||||
|
@ -2070,7 +2070,7 @@ static void sqlite3InvalidFunction(
|
|||
**
|
||||
** If the function already exists as a regular global function, then
|
||||
** this routine is a no-op. If the function does not exist, then create
|
||||
** a new one that always throws a run-time error.
|
||||
** a new one that always throws a run-time error.
|
||||
**
|
||||
** When virtual tables intend to provide an overloaded function, they
|
||||
** should call this routine to make sure the global function exists.
|
||||
|
@ -2103,7 +2103,7 @@ int sqlite3_overload_function(
|
|||
#ifndef SQLITE_OMIT_TRACE
|
||||
/*
|
||||
** Register a trace function. The pArg from the previously registered trace
|
||||
** is returned.
|
||||
** is returned.
|
||||
**
|
||||
** A NULL trace function means that no tracing is executes. A non-NULL
|
||||
** trace is a pointer to a function that is invoked at the start of each
|
||||
|
@ -2154,8 +2154,8 @@ int sqlite3_trace_v2(
|
|||
|
||||
#ifndef SQLITE_OMIT_DEPRECATED
|
||||
/*
|
||||
** Register a profile function. The pArg from the previously registered
|
||||
** profile function is returned.
|
||||
** Register a profile function. The pArg from the previously registered
|
||||
** profile function is returned.
|
||||
**
|
||||
** A NULL profile function means that no profiling is executes. A non-NULL
|
||||
** profile is a pointer to a function that is invoked at the conclusion of
|
||||
|
@ -2289,7 +2289,7 @@ void *sqlite3_preupdate_hook(
|
|||
** Invoke sqlite3_wal_checkpoint if the number of frames in the log file
|
||||
** is greater than sqlite3.pWalArg cast to an integer (the value configured by
|
||||
** wal_autocheckpoint()).
|
||||
*/
|
||||
*/
|
||||
int sqlite3WalDefaultHook(
|
||||
void *pClientData, /* Argument */
|
||||
sqlite3 *db, /* Connection */
|
||||
|
@ -2425,7 +2425,7 @@ int sqlite3_wal_checkpoint_v2(
|
|||
|
||||
/*
|
||||
** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
|
||||
** to contains a zero-length string, all attached databases are
|
||||
** to contains a zero-length string, all attached databases are
|
||||
** checkpointed.
|
||||
*/
|
||||
int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
|
||||
|
@ -2439,9 +2439,9 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
|
|||
** Run a checkpoint on database iDb. This is a no-op if database iDb is
|
||||
** not currently open in WAL mode.
|
||||
**
|
||||
** If a transaction is open on the database being checkpointed, this
|
||||
** function returns SQLITE_LOCKED and a checkpoint is not attempted. If
|
||||
** an error occurs while running the checkpoint, an SQLite error code is
|
||||
** If a transaction is open on the database being checkpointed, this
|
||||
** function returns SQLITE_LOCKED and a checkpoint is not attempted. If
|
||||
** an error occurs while running the checkpoint, an SQLite error code is
|
||||
** returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK.
|
||||
**
|
||||
** The mutex on database handle db should be held by the caller. The mutex
|
||||
|
@ -2612,7 +2612,7 @@ int sqlite3_extended_errcode(sqlite3 *db){
|
|||
}
|
||||
int sqlite3_system_errno(sqlite3 *db){
|
||||
return db ? db->iSysErrno : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a string that describes the kind of error specified in the
|
||||
|
@ -2629,7 +2629,7 @@ const char *sqlite3_errstr(int rc){
|
|||
*/
|
||||
static int createCollation(
|
||||
sqlite3* db,
|
||||
const char *zName,
|
||||
const char *zName,
|
||||
u8 enc,
|
||||
void* pCtx,
|
||||
int(*xCompare)(void*,int,const void*,int,const void*),
|
||||
|
@ -2637,7 +2637,7 @@ static int createCollation(
|
|||
){
|
||||
CollSeq *pColl;
|
||||
int enc2;
|
||||
|
||||
|
||||
assert( sqlite3_mutex_held(db->mutex) );
|
||||
|
||||
/* If SQLITE_UTF16 is specified as the encoding type, transform this
|
||||
|
@ -2654,14 +2654,14 @@ static int createCollation(
|
|||
return SQLITE_MISUSE_BKPT;
|
||||
}
|
||||
|
||||
/* Check if this call is removing or replacing an existing collation
|
||||
/* Check if this call is removing or replacing an existing collation
|
||||
** sequence. If so, and there are active VMs, return busy. If there
|
||||
** are no active VMs, invalidate any pre-compiled statements.
|
||||
*/
|
||||
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0);
|
||||
if( pColl && pColl->xCmp ){
|
||||
if( db->nVdbeActive ){
|
||||
sqlite3ErrorWithMsg(db, SQLITE_BUSY,
|
||||
sqlite3ErrorWithMsg(db, SQLITE_BUSY,
|
||||
"unable to delete/modify collation sequence due to active statements");
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
|
@ -2672,7 +2672,7 @@ static int createCollation(
|
|||
** then any copies made by synthCollSeq() need to be invalidated.
|
||||
** Also, collation destructor - CollSeq.xDel() - function may need
|
||||
** to be called.
|
||||
*/
|
||||
*/
|
||||
if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){
|
||||
CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName);
|
||||
int j;
|
||||
|
@ -2821,7 +2821,7 @@ int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
|
|||
** query parameter. The second argument contains the URI (or non-URI filename)
|
||||
** itself. When this function is called the *pFlags variable should contain
|
||||
** the default flags to open the database handle with. The value stored in
|
||||
** *pFlags may be updated before returning if the URI filename contains
|
||||
** *pFlags may be updated before returning if the URI filename contains
|
||||
** "cache=xxx" or "mode=xxx" query parameters.
|
||||
**
|
||||
** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to
|
||||
|
@ -2833,7 +2833,7 @@ int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
|
|||
** the value returned in *pzFile to avoid a memory leak.
|
||||
**
|
||||
** If an error occurs, then an SQLite error code is returned and *pzErrMsg
|
||||
** may be set to point to a buffer containing an English language error
|
||||
** may be set to point to a buffer containing an English language error
|
||||
** message. It is the responsibility of the caller to eventually release
|
||||
** this buffer by calling sqlite3_free().
|
||||
*/
|
||||
|
@ -2841,7 +2841,7 @@ int sqlite3ParseUri(
|
|||
const char *zDefaultVfs, /* VFS to use if no "vfs=xxx" query option */
|
||||
const char *zUri, /* Nul-terminated URI to parse */
|
||||
unsigned int *pFlags, /* IN/OUT: SQLITE_OPEN_XXX flags */
|
||||
sqlite3_vfs **ppVfs, /* OUT: VFS to use */
|
||||
sqlite3_vfs **ppVfs, /* OUT: VFS to use */
|
||||
char **pzFile, /* OUT: Filename component of URI */
|
||||
char **pzErrMsg /* OUT: Error message (if rc!=SQLITE_OK) */
|
||||
){
|
||||
|
@ -2864,7 +2864,7 @@ int sqlite3ParseUri(
|
|||
int iOut = 0; /* Output character index */
|
||||
u64 nByte = nUri+8; /* Bytes of space to allocate */
|
||||
|
||||
/* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen
|
||||
/* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen
|
||||
** method that there may be extra parameters following the file-name. */
|
||||
flags |= SQLITE_OPEN_URI;
|
||||
|
||||
|
@ -2882,7 +2882,7 @@ int sqlite3ParseUri(
|
|||
/* The following condition causes URIs with five leading / characters
|
||||
** like file://///host/path to be converted into UNCs like //host/path.
|
||||
** The correct URI for that UNC has only two or four leading / characters
|
||||
** file://host/path or file:////host/path. But 5 leading slashes is a
|
||||
** file://host/path or file:////host/path. But 5 leading slashes is a
|
||||
** common error, we are told, so we handle it as a special case. */
|
||||
if( strncmp(zUri+7, "///", 3)==0 ){ iIn++; }
|
||||
}else if( strncmp(zUri+5, "//localhost/", 12)==0 ){
|
||||
|
@ -2894,7 +2894,7 @@ int sqlite3ParseUri(
|
|||
iIn = 7;
|
||||
while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
|
||||
if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
|
||||
*pzErrMsg = sqlite3_mprintf("invalid uri authority: %.*s",
|
||||
*pzErrMsg = sqlite3_mprintf("invalid uri authority: %.*s",
|
||||
iIn-7, &zUri[7]);
|
||||
rc = SQLITE_ERROR;
|
||||
goto parse_uri_out;
|
||||
|
@ -2902,8 +2902,8 @@ int sqlite3ParseUri(
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Copy the filename and any query parameters into the zFile buffer.
|
||||
** Decode %HH escape codes along the way.
|
||||
/* Copy the filename and any query parameters into the zFile buffer.
|
||||
** Decode %HH escape codes along the way.
|
||||
**
|
||||
** Within this loop, variable eState may be set to 0, 1 or 2, depending
|
||||
** on the parsing context. As follows:
|
||||
|
@ -2915,9 +2915,9 @@ int sqlite3ParseUri(
|
|||
eState = 0;
|
||||
while( (c = zUri[iIn])!=0 && c!='#' ){
|
||||
iIn++;
|
||||
if( c=='%'
|
||||
&& sqlite3Isxdigit(zUri[iIn])
|
||||
&& sqlite3Isxdigit(zUri[iIn+1])
|
||||
if( c=='%'
|
||||
&& sqlite3Isxdigit(zUri[iIn])
|
||||
&& sqlite3Isxdigit(zUri[iIn+1])
|
||||
){
|
||||
int octet = (sqlite3HexToInt(zUri[iIn++]) << 4);
|
||||
octet += sqlite3HexToInt(zUri[iIn++]);
|
||||
|
@ -2929,7 +2929,7 @@ int sqlite3ParseUri(
|
|||
** case we ignore all text in the remainder of the path, name or
|
||||
** value currently being parsed. So ignore the current character
|
||||
** and skip to the next "?", "=" or "&", as appropriate. */
|
||||
while( (c = zUri[iIn])!=0 && c!='#'
|
||||
while( (c = zUri[iIn])!=0 && c!='#'
|
||||
&& (eState!=0 || c!='?')
|
||||
&& (eState!=1 || (c!='=' && c!='&'))
|
||||
&& (eState!=2 || c!='&')
|
||||
|
@ -2966,7 +2966,7 @@ int sqlite3ParseUri(
|
|||
if( eState==1 ) zFile[iOut++] = '\0';
|
||||
memset(zFile+iOut, 0, 4); /* end-of-options + empty journal filenames */
|
||||
|
||||
/* Check if there were any options specified that should be interpreted
|
||||
/* Check if there were any options specified that should be interpreted
|
||||
** here. Options that are interpreted here include "vfs" and those that
|
||||
** correspond to flags that may be passed to the sqlite3_open_v2()
|
||||
** method. */
|
||||
|
@ -3002,7 +3002,7 @@ int sqlite3ParseUri(
|
|||
if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){
|
||||
static struct OpenMode aOpenMode[] = {
|
||||
{ "ro", SQLITE_OPEN_READONLY },
|
||||
{ "rw", SQLITE_OPEN_READWRITE },
|
||||
{ "rw", SQLITE_OPEN_READWRITE },
|
||||
{ "rwc", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },
|
||||
{ "memory", SQLITE_OPEN_MEMORY },
|
||||
{ 0, 0 }
|
||||
|
@ -3089,7 +3089,7 @@ static const char *uriParameter(const char *zFilename, const char *zParam){
|
|||
|
||||
/*
|
||||
** This routine does the work of opening a database on behalf of
|
||||
** sqlite3_open() and sqlite3_open16(). The database filename "zFilename"
|
||||
** sqlite3_open() and sqlite3_open16(). The database filename "zFilename"
|
||||
** is UTF-8 encoded.
|
||||
*/
|
||||
static int openDatabase(
|
||||
|
@ -3142,11 +3142,11 @@ static int openDatabase(
|
|||
flags &= ~( SQLITE_OPEN_DELETEONCLOSE |
|
||||
SQLITE_OPEN_EXCLUSIVE |
|
||||
SQLITE_OPEN_MAIN_DB |
|
||||
SQLITE_OPEN_TEMP_DB |
|
||||
SQLITE_OPEN_TRANSIENT_DB |
|
||||
SQLITE_OPEN_MAIN_JOURNAL |
|
||||
SQLITE_OPEN_TEMP_JOURNAL |
|
||||
SQLITE_OPEN_SUBJOURNAL |
|
||||
SQLITE_OPEN_TEMP_DB |
|
||||
SQLITE_OPEN_TRANSIENT_DB |
|
||||
SQLITE_OPEN_MAIN_JOURNAL |
|
||||
SQLITE_OPEN_TEMP_JOURNAL |
|
||||
SQLITE_OPEN_SUBJOURNAL |
|
||||
SQLITE_OPEN_SUPER_JOURNAL |
|
||||
SQLITE_OPEN_NOMUTEX |
|
||||
SQLITE_OPEN_FULLMUTEX |
|
||||
|
@ -3156,7 +3156,7 @@ static int openDatabase(
|
|||
/* Allocate the sqlite data structure */
|
||||
db = sqlite3MallocZero( sizeof(sqlite3) );
|
||||
if( db==0 ) goto opendb_out;
|
||||
if( isThreadsafe
|
||||
if( isThreadsafe
|
||||
#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS
|
||||
|| sqlite3GlobalConfig.bCoreMutex
|
||||
#endif
|
||||
|
@ -3199,7 +3199,7 @@ static int openDatabase(
|
|||
**
|
||||
** SQLITE_DQS SQLITE_DBCONFIG_DQS_DDL SQLITE_DBCONFIG_DQS_DML
|
||||
** ---------- ----------------------- -----------------------
|
||||
** undefined on on
|
||||
** undefined on on
|
||||
** 3 on on
|
||||
** 2 on off
|
||||
** 1 off on
|
||||
|
@ -3279,7 +3279,7 @@ static int openDatabase(
|
|||
|
||||
/* Parse the filename/URI argument
|
||||
**
|
||||
** Only allow sensible combinations of bits in the flags argument.
|
||||
** Only allow sensible combinations of bits in the flags argument.
|
||||
** Throw an error if any non-sense combination is used. If we
|
||||
** do not block illegal combinations here, it could trigger
|
||||
** assert() statements in deeper layers. Sensible combinations
|
||||
|
@ -3327,7 +3327,7 @@ static int openDatabase(
|
|||
db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);
|
||||
|
||||
/* The default safety_level for the main database is FULL; for the temp
|
||||
** database it is OFF. This matches the pager layer defaults.
|
||||
** database it is OFF. This matches the pager layer defaults.
|
||||
*/
|
||||
db->aDb[0].zDbSName = "main";
|
||||
db->aDb[0].safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
|
||||
|
@ -3366,7 +3366,7 @@ static int openDatabase(
|
|||
|
||||
#ifdef SQLITE_ENABLE_INTERNAL_FUNCTIONS
|
||||
/* Testing use only!!! The -DSQLITE_ENABLE_INTERNAL_FUNCTIONS=1 compile-time
|
||||
** option gives access to internal functions by default.
|
||||
** option gives access to internal functions by default.
|
||||
** Testing use only!!! */
|
||||
db->mDbFlags |= DBFLAG_InternalFunc;
|
||||
#endif
|
||||
|
@ -3420,8 +3420,8 @@ opendb_out:
|
|||
** Open a new database handle.
|
||||
*/
|
||||
int sqlite3_open(
|
||||
const char *zFilename,
|
||||
sqlite3 **ppDb
|
||||
const char *zFilename,
|
||||
sqlite3 **ppDb
|
||||
){
|
||||
return openDatabase(zFilename, ppDb,
|
||||
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
|
||||
|
@ -3440,7 +3440,7 @@ int sqlite3_open_v2(
|
|||
** Open a new database handle.
|
||||
*/
|
||||
int sqlite3_open16(
|
||||
const void *zFilename,
|
||||
const void *zFilename,
|
||||
sqlite3 **ppDb
|
||||
){
|
||||
char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */
|
||||
|
@ -3479,9 +3479,9 @@ int sqlite3_open16(
|
|||
** Register a new collation sequence with the database handle db.
|
||||
*/
|
||||
int sqlite3_create_collation(
|
||||
sqlite3* db,
|
||||
const char *zName,
|
||||
int enc,
|
||||
sqlite3* db,
|
||||
const char *zName,
|
||||
int enc,
|
||||
void* pCtx,
|
||||
int(*xCompare)(void*,int,const void*,int,const void*)
|
||||
){
|
||||
|
@ -3492,9 +3492,9 @@ int sqlite3_create_collation(
|
|||
** Register a new collation sequence with the database handle db.
|
||||
*/
|
||||
int sqlite3_create_collation_v2(
|
||||
sqlite3* db,
|
||||
const char *zName,
|
||||
int enc,
|
||||
sqlite3* db,
|
||||
const char *zName,
|
||||
int enc,
|
||||
void* pCtx,
|
||||
int(*xCompare)(void*,int,const void*,int,const void*),
|
||||
void(*xDel)(void*)
|
||||
|
@ -3517,9 +3517,9 @@ int sqlite3_create_collation_v2(
|
|||
** Register a new collation sequence with the database handle db.
|
||||
*/
|
||||
int sqlite3_create_collation16(
|
||||
sqlite3* db,
|
||||
sqlite3* db,
|
||||
const void *zName,
|
||||
int enc,
|
||||
int enc,
|
||||
void* pCtx,
|
||||
int(*xCompare)(void*,int,const void*,int,const void*)
|
||||
){
|
||||
|
@ -3547,8 +3547,8 @@ int sqlite3_create_collation16(
|
|||
** db. Replace any previously installed collation sequence factory.
|
||||
*/
|
||||
int sqlite3_collation_needed(
|
||||
sqlite3 *db,
|
||||
void *pCollNeededArg,
|
||||
sqlite3 *db,
|
||||
void *pCollNeededArg,
|
||||
void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
|
||||
){
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
|
@ -3568,8 +3568,8 @@ int sqlite3_collation_needed(
|
|||
** db. Replace any previously installed collation sequence factory.
|
||||
*/
|
||||
int sqlite3_collation_needed16(
|
||||
sqlite3 *db,
|
||||
void *pCollNeededArg,
|
||||
sqlite3 *db,
|
||||
void *pCollNeededArg,
|
||||
void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
|
||||
){
|
||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||
|
@ -3741,13 +3741,13 @@ int sqlite3_table_column_metadata(
|
|||
/* The following block stores the meta information that will be returned
|
||||
** to the caller in local variables zDataType, zCollSeq, notnull, primarykey
|
||||
** and autoinc. At this point there are two possibilities:
|
||||
**
|
||||
** 1. The specified column name was rowid", "oid" or "_rowid_"
|
||||
** and there is no explicitly declared IPK column.
|
||||
**
|
||||
** 2. The table is not a view and the column name identified an
|
||||
** 1. The specified column name was rowid", "oid" or "_rowid_"
|
||||
** and there is no explicitly declared IPK column.
|
||||
**
|
||||
** 2. The table is not a view and the column name identified an
|
||||
** explicitly declared column. Copy meta information from *pCol.
|
||||
*/
|
||||
*/
|
||||
if( pCol ){
|
||||
zDataType = sqlite3ColumnType(pCol,0);
|
||||
zCollSeq = pCol->zColl;
|
||||
|
@ -3797,7 +3797,7 @@ int sqlite3_sleep(int ms){
|
|||
pVfs = sqlite3_vfs_find(0);
|
||||
if( pVfs==0 ) return 0;
|
||||
|
||||
/* This function works in milliseconds, but the underlying OsSleep()
|
||||
/* This function works in milliseconds, but the underlying OsSleep()
|
||||
** API uses microseconds. Hence the 1000's.
|
||||
*/
|
||||
rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);
|
||||
|
@ -3970,7 +3970,7 @@ int sqlite3_test_control(int op, ...){
|
|||
/*
|
||||
** sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd)
|
||||
**
|
||||
** Register hooks to call to indicate which malloc() failures
|
||||
** Register hooks to call to indicate which malloc() failures
|
||||
** are benign.
|
||||
*/
|
||||
case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: {
|
||||
|
@ -4068,7 +4068,7 @@ int sqlite3_test_control(int op, ...){
|
|||
** 10 little-endian, determined at run-time
|
||||
** 432101 big-endian, determined at compile-time
|
||||
** 123410 little-endian, determined at compile-time
|
||||
*/
|
||||
*/
|
||||
case SQLITE_TESTCTRL_BYTEORDER: {
|
||||
rc = SQLITE_BYTEORDER*100 + SQLITE_LITTLEENDIAN*10 + SQLITE_BIGENDIAN;
|
||||
break;
|
||||
|
@ -4076,7 +4076,7 @@ int sqlite3_test_control(int op, ...){
|
|||
|
||||
/* sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N)
|
||||
**
|
||||
** Enable or disable various optimizations for testing purposes. The
|
||||
** Enable or disable various optimizations for testing purposes. The
|
||||
** argument N is a bitmask of optimizations to be disabled. For normal
|
||||
** operation N should be 0. The idea is that a test program (like the
|
||||
** SQL Logic Test or SLT test module) can run the same SQL multiple times
|
||||
|
@ -4152,7 +4152,7 @@ int sqlite3_test_control(int op, ...){
|
|||
|
||||
/* sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE, xCallback, ptr);
|
||||
**
|
||||
** Set the VDBE coverage callback function to xCallback with context
|
||||
** Set the VDBE coverage callback function to xCallback with context
|
||||
** pointer ptr.
|
||||
*/
|
||||
case SQLITE_TESTCTRL_VDBE_COVERAGE: {
|
||||
|
@ -4262,7 +4262,7 @@ int sqlite3_test_control(int op, ...){
|
|||
|
||||
/* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
|
||||
**
|
||||
** "ptr" is a pointer to a u32.
|
||||
** "ptr" is a pointer to a u32.
|
||||
**
|
||||
** op==0 Store the current sqlite3SelectTrace in *ptr
|
||||
** op==1 Set sqlite3SelectTrace to the value *ptr
|
||||
|
@ -4365,7 +4365,7 @@ void sqlite3_free_filename(char *p){
|
|||
|
||||
/*
|
||||
** This is a utility routine, useful to VFS implementations, that checks
|
||||
** to see if a database file was a URI that contained a specific query
|
||||
** to see if a database file was a URI that contained a specific query
|
||||
** parameter, and if so obtains the value of the query parameter.
|
||||
**
|
||||
** The zFilename argument is the filename pointer passed into the xOpen()
|
||||
|
@ -4493,11 +4493,11 @@ int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){
|
|||
|
||||
#ifdef SQLITE_ENABLE_SNAPSHOT
|
||||
/*
|
||||
** Obtain a snapshot handle for the snapshot of database zDb currently
|
||||
** Obtain a snapshot handle for the snapshot of database zDb currently
|
||||
** being read by handle db.
|
||||
*/
|
||||
int sqlite3_snapshot_get(
|
||||
sqlite3 *db,
|
||||
sqlite3 *db,
|
||||
const char *zDb,
|
||||
sqlite3_snapshot **ppSnapshot
|
||||
){
|
||||
|
@ -4533,8 +4533,8 @@ int sqlite3_snapshot_get(
|
|||
** Open a read-transaction on the snapshot idendified by pSnapshot.
|
||||
*/
|
||||
int sqlite3_snapshot_open(
|
||||
sqlite3 *db,
|
||||
const char *zDb,
|
||||
sqlite3 *db,
|
||||
const char *zDb,
|
||||
sqlite3_snapshot *pSnapshot
|
||||
){
|
||||
int rc = SQLITE_ERROR;
|
||||
|
@ -4636,7 +4636,7 @@ int sqlite3_compileoption_used(const char *zOptName){
|
|||
int i, n;
|
||||
int nOpt;
|
||||
const char **azCompileOpt;
|
||||
|
||||
|
||||
#if SQLITE_ENABLE_API_ARMOR
|
||||
if( zOptName==0 ){
|
||||
(void)SQLITE_MISUSE_BKPT;
|
||||
|
@ -4649,7 +4649,7 @@ int sqlite3_compileoption_used(const char *zOptName){
|
|||
if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
|
||||
n = sqlite3Strlen30(zOptName);
|
||||
|
||||
/* Since nOpt is normally in single digits, a linear search is
|
||||
/* Since nOpt is normally in single digits, a linear search is
|
||||
** adequate. No need for a binary search. */
|
||||
for(i=0; i<nOpt; i++){
|
||||
if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue