您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sqlite3DbFree函数代码示例

51自学网 2021-06-03 08:13:39
  C++
这篇教程C++ sqlite3DbFree函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sqlite3DbFree函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite3DbFree函数的具体用法?C++ sqlite3DbFree怎么用?C++ sqlite3DbFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sqlite3DbFree函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: callFinaliser

/*** This function invokes either the xRollback or xCommit method** of each of the virtual tables in the sqlite3.aVTrans array. The method** 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. */static void callFinaliser(sqlite3 *db, int offset){  int i;  if( db->aVTrans ){    VTable **aVTrans = db->aVTrans;    db->aVTrans = 0;    for(i=0; i<db->nVTrans; i++){      VTable *pVTab = aVTrans[i];      sqlite3_vtab *p = pVTab->pVtab;      if( p ){        int (*x)(sqlite3_vtab *);        x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset);        if( x ) x(p);      }      pVTab->iSavepoint = 0;      sqlite3VtabUnlock(pVTab);    }    sqlite3DbFree(db, aVTrans);    db->nVTrans = 0;  }}
开发者ID:wangyiran126,项目名称:sqlite,代码行数:28,


示例2: sqlite3Prepare16

/*** Compile the UTF-16 encoded SQL statement zSql into a statement handle.*/static int sqlite3Prepare16(  sqlite3 *db,              /* Database handle. */   const void *zSql,         /* UTF-8 encoded SQL statement. */  int nBytes,               /* Length of zSql in bytes. */  int saveSqlFlag,          /* True to save SQL text into the sqlite3_stmt */  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */  const void **pzTail       /* OUT: End of parsed string */){  /* This function currently works by first transforming the UTF-16  ** encoded string to UTF-8, then invoking sqlite3_prepare(). The  ** tricky bit is figuring out the pointer to return in *pzTail.  */  char *zSql8;  const char *zTail8 = 0;  int rc = SQLITE_OK;  assert( ppStmt );  *ppStmt = 0;  if( !sqlite3SafetyCheckOk(db) ){    return SQLITE_MISUSE;  }  sqlite3_mutex_enter(db->mutex);  zSql8 = sqlite3Utf16to8(db, zSql, nBytes);  if( zSql8 ){    rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);  }  if( zTail8 && pzTail ){    /* If sqlite3_prepare returns a tail pointer, we calculate the    ** equivalent pointer into the UTF-16 string by counting the unicode    ** characters between zSql8 and zTail8, and then returning a pointer    ** the same number of characters into the UTF-16 string.    */    int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8));    *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);  }  sqlite3DbFree(db, zSql8);   rc = sqlite3ApiExit(db, rc);  sqlite3_mutex_leave(db->mutex);  return rc;}
开发者ID:biddyweb,项目名称:mediastream-plus,代码行数:44,


示例3: sqlite3_step

/*** This is the top-level implementation of sqlite3_step().  Call** sqlite3Step() to do most of the work.  If a schema error occurs,** call sqlite3Reprepare() and try again.*/int sqlite3_step(sqlite3_stmt *pStmt){  int rc = SQLITE_OK;      /* Result from sqlite3Step() */  int rc2 = SQLITE_OK;     /* Result from sqlite3Reprepare() */  Vdbe *v = (Vdbe*)pStmt;  /* the prepared statement */  int cnt = 0;             /* Counter to prevent infinite loop of reprepares */  sqlite3 *db;             /* The database connection */  if( vdbeSafetyNotNull(v) ){    return SQLITE_MISUSE_BKPT;  }  db = v->db;  sqlite3_mutex_enter(db->mutex);  while( (rc = sqlite3Step(v))==SQLITE_SCHEMA         && cnt++ < SQLITE_MAX_SCHEMA_RETRY         && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){    sqlite3_reset(pStmt);    assert( v->expired==0 );  }  if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){    /* This case occurs after failing to recompile an sql statement.     ** The error message from the SQL compiler has already been loaded     ** into the database handle. This block copies the error message     ** from the database handle into the statement and sets the statement    ** program counter to 0 to ensure that when the statement is     ** finalized or reset the parser error message is available via    ** sqlite3_errmsg() and sqlite3_errcode().    */    const char *zErr = (const char *)sqlite3_value_text(db->pErr);     sqlite3DbFree(db, v->zErrMsg);    if( !db->mallocFailed ){      v->zErrMsg = sqlite3DbStrDup(db, zErr);      v->rc = rc2;    } else {      v->zErrMsg = 0;      v->rc = rc = SQLITE_NOMEM;    }  }  rc = sqlite3ApiExit(db, rc);  sqlite3_mutex_leave(db->mutex);  return rc;}
开发者ID:77songsong,项目名称:sqlite3,代码行数:46,


示例4: vdbeSorterListToPMA

/*** Write the current contents of the in-memory linked-list to a PMA. Return** SQLITE_OK if successful, or an SQLite error code otherwise.**** The format of a PMA is:****     * A varint. This varint contains the total number of bytes of content**       in the PMA (not including the varint itself).****     * One or more records packed end-to-end in order of ascending keys. **       Each record consists of a varint followed by a blob of data (the **       key). The varint is the number of bytes in the blob of data.*/static int vdbeSorterListToPMA(sqlite3 *db, const VdbeCursor *pCsr){  int rc = SQLITE_OK;             /* Return code */  VdbeSorter *pSorter = pCsr->pSorter;  FileWriter writer;  memset(&writer, 0, sizeof(FileWriter));  if( pSorter->nInMemory==0 ){    assert( pSorter->pRecord==0 );    return rc;  }  rc = vdbeSorterSort(pCsr);  /* If the first temporary PMA file has not been opened, open it now. */  if( rc==SQLITE_OK && pSorter->pTemp1==0 ){    rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1);    assert( rc!=SQLITE_OK || pSorter->pTemp1 );    assert( pSorter->iWriteOff==0 );    assert( pSorter->nPMA==0 );  }  if( rc==SQLITE_OK ){    SorterRecord *p;    SorterRecord *pNext = 0;    fileWriterInit(db, pSorter->pTemp1, &writer, pSorter->iWriteOff);    pSorter->nPMA++;    fileWriterWriteVarint(&writer, pSorter->nInMemory);    for(p=pSorter->pRecord; p; p=pNext){      pNext = p->pNext;      fileWriterWriteVarint(&writer, p->nVal);      fileWriterWrite(&writer, p->pVal, p->nVal);      sqlite3DbFree(db, p);    }    pSorter->pRecord = p;    rc = fileWriterFinish(db, &writer, &pSorter->iWriteOff);  }  return rc;}
开发者ID:jiankangshiye,项目名称:mysqlite,代码行数:54,


示例5: sqlite3VdbeMemGrow

/*** Make sure pMem->z points to a writable allocation of at least ** n bytes.**** If the third argument passed to this function is true, then memory** cell pMem must contain a string or blob. In this case the content is** preserved. Otherwise, if the third parameter to this function is false,** any current string or blob value may be discarded.**** This function sets the MEM_Dyn flag and clears any xDel callback.** It also clears MEM_Ephem and MEM_Static. If the preserve flag is ** not set, Mem.n is zeroed.*/int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){  assert( 1 >=    ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +    (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) +     ((pMem->flags&MEM_Ephem) ? 1 : 0) +     ((pMem->flags&MEM_Static) ? 1 : 0)  );  assert( (pMem->flags&MEM_RowSet)==0 );  /* If the preserve flag is set to true, then the memory cell must already  ** contain a valid string or blob value.  */  assert( preserve==0 || pMem->flags&(MEM_Blob|MEM_Str) );  if( n<32 ) n = 32;  if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){    if( preserve && pMem->z==pMem->zMalloc ){      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);      preserve = 0;    }else{      sqlite3DbFree(pMem->db, pMem->zMalloc);      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);    }  }  if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){    memcpy(pMem->zMalloc, pMem->z, pMem->n);  }  if( pMem->flags&MEM_Dyn && pMem->xDel ){    assert( pMem->xDel!=SQLITE_DYNAMIC );    pMem->xDel((void *)(pMem->z));  }  pMem->z = pMem->zMalloc;  if( pMem->z==0 ){    pMem->flags = MEM_Null;  }else{    pMem->flags &= ~(MEM_Ephem|MEM_Static);  }  pMem->xDel = 0;  return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);}
开发者ID:HappyDanger,项目名称:sqlcipher,代码行数:54,


示例6: callCollNeeded

/*** Invoke the 'collation needed' callback to request a collation sequence** in the encoding enc of name zName, length nName.*/static void callCollNeeded(sqlite3 *db, int enc, const char *zName){  assert( !db->xCollNeeded || !db->xCollNeeded16 );  if( db->xCollNeeded ){    char *zExternal = sqlite3DbStrDup(db, zName);    if( !zExternal ) return;    db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal);    sqlite3DbFree(db, zExternal);  }#ifndef SQLITE_OMIT_UTF16  if( db->xCollNeeded16 ){    char const *zExternal;    sqlite3_value *pTmp = sqlite3ValueNew(db);    sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC);    zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE);    if( zExternal ){      db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal);    }    sqlite3ValueFree(pTmp);  }#endif}
开发者ID:cznic,项目名称:cc,代码行数:25,


示例7: createModule

/*** The actual function that does the work of creating a new module.** This function implements the sqlite3_create_module() and** sqlite3_create_module_v2() interfaces.*/static int createModule(  sqlite3 *db,                    /* Database in which module is registered */  const char *zName,              /* Name assigned to this module */  const sqlite3_module *pModule,  /* The definition of the module */  void *pAux,                     /* Context pointer for xCreate/xConnect */  void (*xDestroy)(void *)        /* Module destructor function */){  int rc = SQLITE_OK;  int nName;  sqlite3_mutex_enter(db->mutex);  nName = sqlite3Strlen30(zName);  if( sqlite3HashFind(&db->aModule, zName) ){    rc = SQLITE_MISUSE_BKPT;  }else{    Module *pMod;    pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);    if( pMod ){      Module *pDel;      char *zCopy = (char *)(&pMod[1]);      memcpy(zCopy, zName, nName+1);      pMod->zName = zCopy;      pMod->pModule = pModule;      pMod->pAux = pAux;      pMod->xDestroy = xDestroy;      pMod->pEpoTab = 0;      pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,(void*)pMod);      assert( pDel==0 || pDel==pMod );      if( pDel ){        db->mallocFailed = 1;        sqlite3DbFree(db, pDel);      }    }  }  rc = sqlite3ApiExit(db, rc);  if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux);  sqlite3_mutex_leave(db->mutex);  return rc;}
开发者ID:ngdmcc,项目名称:sqlite,代码行数:45,


示例8: sqlite3HashFind

/*** Locate and return an entry from the db.aCollSeq hash table. If the entry** specified by zName and nName is not found and parameter 'create' is** true, then create a new entry. Otherwise return NULL.**** Each pointer stored in the sqlite3.aCollSeq hash table contains an** array of three CollSeq structures. The first is the collation sequence** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be.**** Stored immediately after the three collation sequences is a copy of** the collation sequence name. A pointer to this string is stored in** each collation sequence structure.*/static CollSeq *findCollSeqEntry(  sqlite3 *db,  const char *zName,  int nName,  int create){  CollSeq *pColl;  if( nName<0 ) nName = sqlite3Strlen(db, zName);  pColl = sqlite3HashFind(&db->aCollSeq, zName, nName);  if( 0==pColl && create ){    pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1 );    if( pColl ){      CollSeq *pDel = 0;      pColl[0].zName = (char*)&pColl[3];      pColl[0].enc = SQLITE_UTF8;      pColl[1].zName = (char*)&pColl[3];      pColl[1].enc = SQLITE_UTF16LE;      pColl[2].zName = (char*)&pColl[3];      pColl[2].enc = SQLITE_UTF16BE;      memcpy(pColl[0].zName, zName, nName);      pColl[0].zName[nName] = 0;      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);      /* If a malloc() failure occured in sqlite3HashInsert(), it will       ** return the pColl pointer to be deleted (because it wasn't added      ** to the hash table).      */      assert( pDel==0 || pDel==pColl );      if( pDel!=0 ){        db->mallocFailed = 1;        sqlite3DbFree(db, pDel);        pColl = 0;      }    }  }  return pColl;}
开发者ID:DoganA,项目名称:nightingale-deps,代码行数:51,


示例9: sqlite3VdbeMemGrow

/*** Make sure pMem->z points to a writable allocation of at least ** n bytes.**** If the memory cell currently contains string or blob data** and the third argument passed to this function is true, the ** current content of the cell is preserved. Otherwise, it may** be discarded.  **** This function sets the MEM_Dyn flag and clears any xDel callback.** It also clears MEM_Ephem and MEM_Static. If the preserve flag is ** not set, Mem.n is zeroed.*/int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){  assert( 1 >=    ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +    (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) +     ((pMem->flags&MEM_Ephem) ? 1 : 0) +     ((pMem->flags&MEM_Static) ? 1 : 0)  );  assert( (pMem->flags&MEM_RowSet)==0 );  if( n<32 ) n = 32;  if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){    if( preserve && pMem->z==pMem->zMalloc ){      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);      preserve = 0;    }else{      sqlite3DbFree(pMem->db, pMem->zMalloc);      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);    }  }  if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){    memcpy(pMem->zMalloc, pMem->z, pMem->n);  }  if( pMem->flags&MEM_Dyn && pMem->xDel ){    assert( pMem->xDel!=SQLITE_DYNAMIC );    pMem->xDel((void *)(pMem->z));  }  pMem->z = pMem->zMalloc;  if( pMem->z==0 ){    pMem->flags = MEM_Null;  }else{    pMem->flags &= ~(MEM_Ephem|MEM_Static);  }  pMem->xDel = 0;  return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);}
开发者ID:aosm,项目名称:SQLite,代码行数:50,


示例10: createModule

/*** The actual function that does the work of creating a new module.** This function implements the sqlite3_create_module() and** sqlite3_create_module_v2() interfaces.*/static int createModule(  sqlite3 *db,                    /* Database in which module is registered */  const char *zName,              /* Name assigned to this module */  const sqlite3_module *pModule,  /* The definition of the module */  void *pAux,                     /* Context pointer for xCreate/xConnect */  void (*xDestroy)(void *)        /* Module destructor function */){  int rc, nName;  Module *pMod;  sqlite3_mutex_enter(db->mutex);  nName = sqlite3Strlen30(zName);  pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);  if( pMod ){    Module *pDel;    char *zCopy = (char *)(&pMod[1]);    memcpy(zCopy, zName, nName+1);    pMod->zName = zCopy;    pMod->pModule = pModule;    pMod->pAux = pAux;    pMod->xDestroy = xDestroy;    pDel = (Module *)sqlite3HashInsert(&db->aModule, zCopy, nName, (void*)pMod);    if( pDel && pDel->xDestroy ){      pDel->xDestroy(pDel->pAux);    }    sqlite3DbFree(db, pDel);    if( pDel==pMod ){      db->mallocFailed = 1;    }    sqlite3ResetInternalSchema(db, 0);  }else if( xDestroy ){    xDestroy(pAux);  }  rc = sqlite3ApiExit(db, SQLITE_OK);  sqlite3_mutex_leave(db->mutex);  return rc;}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:42,


示例11: sqlite3HashFind

/*** Locate and return an entry from the db.aCollSeq hash table. If the entry** specified by zName and nName is not found and parameter 'create' is** true, then create a new entry. Otherwise return NULL.**** Each pointer stored in the sqlite3.aCollSeq hash table contains an** array of three CollSeq structures. The first is the collation sequence** preferred for UTF-8, the second UTF-16le, and the third UTF-16be.**** Stored immediately after the three collation sequences is a copy of** the collation sequence name. A pointer to this string is stored in** each collation sequence structure.*/static CollSeq *findCollSeqEntry(  sqlite3 *db,          /* Database connection */  const char *zName,    /* Name of the collating sequence */  int create            /* Create a new entry if true */){  CollSeq *pColl;  pColl = sqlite3HashFind(&db->aCollSeq, zName);  if( 0==pColl && create ){    int nName = sqlite3Strlen30(zName) + 1;    pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName);    if( pColl ){      CollSeq *pDel = 0;      pColl[0].zName = (char*)&pColl[3];      pColl[0].enc = SQLITE_UTF8;      pColl[1].zName = (char*)&pColl[3];      pColl[1].enc = SQLITE_UTF16LE;      pColl[2].zName = (char*)&pColl[3];      pColl[2].enc = SQLITE_UTF16BE;      memcpy(pColl[0].zName, zName, nName);      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);      /* If a malloc() failure occurred in sqlite3HashInsert(), it will       ** return the pColl pointer to be deleted (because it wasn't added      ** to the hash table).      */      assert( pDel==0 || pDel==pColl );      if( pDel!=0 ){        sqlite3OomFault(db);        sqlite3DbFree(db, pDel);        pColl = 0;      }    }  }  return pColl;}
开发者ID:cznic,项目名称:cc,代码行数:49,


示例12: sqlite3_step

int sqlite3_step(sqlite3_stmt *pStmt){  int rc = SQLITE_MISUSE;  if( pStmt ){    int cnt = 0;    Vdbe *v = (Vdbe*)pStmt;    sqlite3 *db = v->db;    sqlite3_mutex_enter(db->mutex);    while( (rc = sqlite3Step(v))==SQLITE_SCHEMA           && cnt++ < 5           && vdbeReprepare(v) ){      sqlite3_reset(pStmt);      v->expired = 0;    }    if( rc==SQLITE_SCHEMA && v->zSql && db->pErr ){      /* This case occurs after failing to recompile an sql statement.       ** The error message from the SQL compiler has already been loaded       ** into the database handle. This block copies the error message       ** from the database handle into the statement and sets the statement      ** program counter to 0 to ensure that when the statement is       ** finalized or reset the parser error message is available via      ** sqlite3_errmsg() and sqlite3_errcode().      */      const char *zErr = (const char *)sqlite3_value_text(db->pErr);       sqlite3DbFree(db, v->zErrMsg);      if( !db->mallocFailed ){        v->zErrMsg = sqlite3DbStrDup(db, zErr);      } else {        v->zErrMsg = 0;        v->rc = SQLITE_NOMEM;      }    }    rc = sqlite3ApiExit(db, rc);    sqlite3_mutex_leave(db->mutex);  }  return rc;}
开发者ID:shenjian74,项目名称:Bitcoin-History,代码行数:36,


示例13: sqlite3DbMallocRaw

/*** Resize the block of memory pointed to by p to n bytes. If the** resize fails, set the mallocFailed flag in the connection object.*/void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){  void *pNew = 0;  if( db->mallocFailed==0 ){    if( p==0 ){      return sqlite3DbMallocRaw(db, n);    }    if( isLookaside(db, p) ){      if( n<=db->lookaside.sz ){        return p;      }      pNew = sqlite3DbMallocRaw(db, n);      if( pNew ){        memcpy(pNew, p, db->lookaside.sz);        sqlite3DbFree(db, p);      }    }else{      pNew = sqlite3_realloc(p, n);      if( !pNew ){        db->mallocFailed = 1;      }    }  }  return pNew;}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:28,


示例14: sqlite3FkDelete

/*** Free all memory associated with foreign key definitions attached to** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash** hash table.*/void sqlite3FkDelete(sqlite3 *db, Table *pTab){  FKey *pFKey;                    /* Iterator variable */  FKey *pNext;                    /* Copy of pFKey->pNextFrom */  assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) );  for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){    /* Remove the FK from the fkeyHash hash table. */    if( !db || db->pnBytesFreed==0 ){      if( pFKey->pPrevTo ){        pFKey->pPrevTo->pNextTo = pFKey->pNextTo;      }else{        void *p = (void *)pFKey->pNextTo;        const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo);        sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, sqlite3Strlen30(z), p);      }      if( pFKey->pNextTo ){        pFKey->pNextTo->pPrevTo = pFKey->pPrevTo;      }    }    /* EV: R-30323-21917 Each foreign key constraint in SQLite is    ** classified as either immediate or deferred.    */    assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 );    /* Delete any triggers created to implement actions for this FK. */#ifndef SQLITE_OMIT_TRIGGER    fkTriggerDelete(db, pFKey->apTrigger[0]);    fkTriggerDelete(db, pFKey->apTrigger[1]);#endif    pNext = pFKey->pNextFrom;    sqlite3DbFree(db, pFKey);  }}
开发者ID:77songsong,项目名称:sqlite3,代码行数:41,


示例15: sqlite3FindDbName

/*** Return a pointer corresponding to database zDb (i.e. "main", "temp")** in connection handle pDb. If such a database cannot be found, return** a NULL pointer and write an error message to pErrorDb.**** If the "temp" database is requested, it may need to be opened by this** function. If an error occurs while doing so, return 0 and write an** error message to pErrorDb.*/static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){	int i, rc;	Parse *pParse;	rc = 0;	i = sqlite3FindDbName(pDb, zDb);	if (i == 1) {		pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse));		if (pParse == 0) {			sqlite3Error(pErrorDb, SQLITE_NOMEM, "out of memory");			rc = SQLITE_NOMEM;		} else {			pParse->db = pDb;			if (sqlite3OpenTempDatabase(pParse)) {				sqlite3Error(pErrorDb, pParse->rc, "%s",				    pParse->zErrMsg);				rc = SQLITE_ERROR;				sqlite3DbFree(pDb, pParse->zErrMsg);			}			sqlite3StackFree(pErrorDb, pParse);		}		if (rc)			return 0;	}	if (i < 0) {		sqlite3Error(pErrorDb,		    SQLITE_ERROR, "unknown database %s", zDb);		return 0;	}	return pDb->aDb[i].pBt;}
开发者ID:galaxyeye,项目名称:bdb,代码行数:45,


示例16: sqlite3LoadExtension

//.........这里部分代码省略.........        }        return SQLITE_ERROR;    }        zEntry = zProc ? zProc : "sqlite3_extension_init";        handle = sqlite3OsDlOpen(pVfs, zFile);#if SQLITE_OS_UNIX || SQLITE_OS_WIN    for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){        char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);        if( zAltFile==0 ) return SQLITE_NOMEM;        handle = sqlite3OsDlOpen(pVfs, zAltFile);        sqlite3_free(zAltFile);    }#endif    if( handle==0 ){        if( pzErrMsg ){            *pzErrMsg = zErrmsg = sqlite3_malloc(nMsg);            if( zErrmsg ){                sqlite3_snprintf(nMsg, zErrmsg,                                 "unable to open shared library [%s]", zFile);                sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);            }        }        return SQLITE_ERROR;    }    xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))    sqlite3OsDlSym(pVfs, handle, zEntry);        /* If no entry point was specified and the default legacy     ** entry point name "sqlite3_extension_init" was not found, then     ** construct an entry point name "sqlite3_X_init" where the X is     ** replaced by the lowercase value of every ASCII alphabetic     ** character in the filename after the last "/" upto the first ".",     ** and eliding the first three characters if they are "lib".     ** Examples:     **     **    /usr/local/lib/libExample5.4.3.so ==>  sqlite3_example_init     **    C:/lib/mathfuncs.dll              ==>  sqlite3_mathfuncs_init     */    if( xInit==0 && zProc==0 ){        int iFile, iEntry, c;        int ncFile = sqlite3Strlen30(zFile);        zAltEntry = sqlite3_malloc(ncFile+30);        if( zAltEntry==0 ){            sqlite3OsDlClose(pVfs, handle);            return SQLITE_NOMEM;        }        memcpy(zAltEntry, "sqlite3_", 8);        for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){}        iFile++;        if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3;        for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){            if( sqlite3Isalpha(c) ){                zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c];            }        }        memcpy(zAltEntry+iEntry, "_init", 6);        zEntry = zAltEntry;        xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))        sqlite3OsDlSym(pVfs, handle, zEntry);    }    if( xInit==0 ){        if( pzErrMsg ){            nMsg += sqlite3Strlen30(zEntry);            *pzErrMsg = zErrmsg = sqlite3_malloc(nMsg);            if( zErrmsg ){                sqlite3_snprintf(nMsg, zErrmsg,                                 "no entry point [%s] in shared library [%s]", zEntry, zFile);                sqlite3OsDlError(pVfs, nMsg-1, zErrmsg);            }        }        sqlite3OsDlClose(pVfs, handle);        sqlite3_free(zAltEntry);        return SQLITE_ERROR;    }    sqlite3_free(zAltEntry);    if( xInit(db, &zErrmsg, &sqlite3Apis) ){        if( pzErrMsg ){            *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg);        }        sqlite3_free(zErrmsg);        sqlite3OsDlClose(pVfs, handle);        return SQLITE_ERROR;    }        /* Append the new shared library handle to the db->aExtension array. */    aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));    if( aHandle==0 ){        return SQLITE_NOMEM;    }    if( db->nExtension>0 ){        memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);    }    sqlite3DbFree(db, db->aExtension);    db->aExtension = aHandle;        db->aExtension[db->nExtension++] = handle;    return SQLITE_OK;}
开发者ID:pchernev,项目名称:Objective-C-iOS-Categories,代码行数:101,


示例17: sqlite3_declare_vtab

/*** This function is used to set the schema of a virtual table.  It is only** valid to call this function from within the xCreate() or xConnect() of a** virtual table module.*/int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){  VtabCtx *pCtx;  Parse *pParse;  int rc = SQLITE_OK;  Table *pTab;  char *zErr = 0;#ifdef SQLITE_ENABLE_API_ARMOR  if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){    return SQLITE_MISUSE_BKPT;  }#endif  sqlite3_mutex_enter(db->mutex);  pCtx = db->pVtabCtx;  if( !pCtx || pCtx->bDeclared ){    sqlite3Error(db, SQLITE_MISUSE);    sqlite3_mutex_leave(db->mutex);    return SQLITE_MISUSE_BKPT;  }  pTab = pCtx->pTab;  assert( (pTab->tabFlags & TF_Virtual)!=0 );  pParse = sqlite3StackAllocZero(db, sizeof(*pParse));  if( pParse==0 ){    rc = SQLITE_NOMEM_BKPT;  }else{    pParse->declareVtab = 1;    pParse->db = db;    pParse->nQueryLoop = 1;      if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr)      && pParse->pNewTable     && !db->mallocFailed     && !pParse->pNewTable->pSelect     && (pParse->pNewTable->tabFlags & TF_Virtual)==0    ){      if( !pTab->aCol ){        Table *pNew = pParse->pNewTable;        Index *pIdx;        pTab->aCol = pNew->aCol;        pTab->nCol = pNew->nCol;        pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);        pNew->nCol = 0;        pNew->aCol = 0;        assert( pTab->pIndex==0 );        if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){          rc = SQLITE_ERROR;        }        pIdx = pNew->pIndex;        if( pIdx ){          assert( pIdx->pNext==0 );          pTab->pIndex = pIdx;          pNew->pIndex = 0;          pIdx->pTable = pTab;        }      }      pCtx->bDeclared = 1;    }else{      sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);      sqlite3DbFree(db, zErr);      rc = SQLITE_ERROR;    }    pParse->declareVtab = 0;      if( pParse->pVdbe ){      sqlite3VdbeFinalize(pParse->pVdbe);    }    sqlite3DeleteTable(db, pParse->pNewTable);    sqlite3ParserReset(pParse);    sqlite3StackFree(db, pParse);  }  assert( (rc&0xff)==rc );  rc = sqlite3ApiExit(db, rc);  sqlite3_mutex_leave(db->mutex);  return rc;}
开发者ID:wangyiran126,项目名称:sqlite,代码行数:82,


示例18: vtabCallConstructor

/*** Invoke a virtual table constructor (either xCreate or xConnect). The** pointer to the function to invoke is passed as the fourth parameter** to this procedure.*/static int vtabCallConstructor(  sqlite3 *db,   Table *pTab,  Module *pMod,  int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),  char **pzErr){  VtabCtx sCtx;  VTable *pVTable;  int rc;  const char *const*azArg = (const char *const*)pTab->azModuleArg;  int nArg = pTab->nModuleArg;  char *zErr = 0;  char *zModuleName;  int iDb;  VtabCtx *pCtx;  /* 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,           "vtable constructor called recursively: %s", pTab->zName      );      return SQLITE_LOCKED;    }  }  zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);  if( !zModuleName ){    return SQLITE_NOMEM_BKPT;  }  pVTable = sqlite3DbMallocZero(db, sizeof(VTable));  if( !pVTable ){    sqlite3DbFree(db, zModuleName);    return SQLITE_NOMEM_BKPT;  }  pVTable->db = db;  pVTable->pMod = pMod;  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);  pTab->azModuleArg[1] = db->aDb[iDb].zDbSName;  /* Invoke the virtual table constructor */  assert( &db->pVtabCtx );  assert( xConstruct );  sCtx.pTab = pTab;  sCtx.pVTable = pVTable;  sCtx.pPrior = db->pVtabCtx;  sCtx.bDeclared = 0;  db->pVtabCtx = &sCtx;  rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);  db->pVtabCtx = sCtx.pPrior;  if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);  assert( sCtx.pTab==pTab );  if( SQLITE_OK!=rc ){    if( zErr==0 ){      *pzErr = sqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName);    }else {      *pzErr = sqlite3MPrintf(db, "%s", zErr);      sqlite3_free(zErr);    }    sqlite3DbFree(db, pVTable);  }else if( ALWAYS(pVTable->pVtab) ){    /* Justification of ALWAYS():  A correct vtab constructor must allocate    ** the sqlite3_vtab object if successful.  */    memset(pVTable->pVtab, 0, sizeof(pVTable->pVtab[0]));    pVTable->pVtab->pModule = pMod->pModule;    pVTable->nRef = 1;    if( sCtx.bDeclared==0 ){      const char *zFormat = "vtable constructor did not declare schema: %s";      *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);      sqlite3VtabUnlock(pVTable);      rc = SQLITE_ERROR;    }else{      int iCol;      u8 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       ** 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.  */      pVTable->pNext = pTab->pVTable;      pTab->pVTable = pVTable;      for(iCol=0; iCol<pTab->nCol; iCol++){        char *zType = sqlite3ColumnType(&pTab->aCol[iCol], "");        int nType;        int i = 0;        nType = sqlite3Strlen30(zType);        for(i=0; i<nType; i++){          if( 0==sqlite3StrNICmp("hidden", &zType[i], 6)           && (i==0 || zType[i-1]==' ')           && (zType[i+6]=='/0' || zType[i+6]==' ')//.........这里部分代码省略.........
开发者ID:wangyiran126,项目名称:sqlite,代码行数:101,


示例19: sqlite3VtabFinishParse

/*** The parser calls this routine after the CREATE VIRTUAL TABLE statement** has been completely parsed.*/void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){  Table *pTab = pParse->pNewTable;  /* The table being constructed */  sqlite3 *db = pParse->db;         /* The database connection */  if( pTab==0 ) return;  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_master) then  ** do additional initialization work and store the statement text  ** in the sqlite_master table.  */  if( !db->init.busy ){    char *zStmt;    char *zWhere;    int iDb;    int iReg;    Vdbe *v;    /* Compute the complete text of the CREATE VIRTUAL TABLE statement */    if( pEnd ){      pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n;    }    zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken);    /* A slot for the record has already been allocated in the     ** SQLITE_MASTER table.  We just need to update that slot with all    ** the information we've collected.      **    ** The VM register number pParse->regRowid holds the rowid of an    ** entry in the sqlite_master table tht was created for this vtab    ** by sqlite3StartTable().    */    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);    sqlite3NestedParse(pParse,      "UPDATE %Q.%s "         "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "       "WHERE rowid=#%d",      db->aDb[iDb].zDbSName, MASTER_NAME,      pTab->zName,      pTab->zName,      zStmt,      pParse->regRowid    );    sqlite3DbFree(db, zStmt);    v = sqlite3GetVdbe(pParse);    sqlite3ChangeCookie(pParse, iDb);    sqlite3VdbeAddOp0(v, OP_Expire);    zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName);    sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere);    iReg = ++pParse->nMem;    sqlite3VdbeLoadString(v, iReg, pTab->zName);    sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg);  }  /* If we are rereading the sqlite_master table create the in-memory  ** record of the table. The xConnect() method is not called until  ** the first time the virtual table is used in an SQL statement. This  ** allows a schema that contains virtual tables to be loaded before  ** the required virtual table implementations are registered.  */  else {    Table *pOld;    Schema *pSchema = pTab->pSchema;    const char *zName = pTab->zName;    assert( sqlite3SchemaMutexHeld(db, 0, pSchema) );    pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab);    if( pOld ){      sqlite3OomFault(db);      assert( pTab==pOld );  /* Malloc must have failed inside HashInsert() */      return;    }    pParse->pNewTable = 0;  }}
开发者ID:wangyiran126,项目名称:sqlite,代码行数:83,


示例20: sqlite3ValueFree

/*** Free an sqlite3_value object*/void sqlite3ValueFree(sqlite3_value *v){  if( !v ) return;  sqlite3VdbeMemRelease((Mem *)v);  sqlite3DbFree(((Mem*)v)->db, v);}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:8,


示例21: sqlite3SetString

/*** Free any prior content in *pz and replace it with a copy of zNew.*/void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){  sqlite3DbFree(db, *pz);  *pz = sqlite3DbStrDup(db, zNew);}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:7,


示例22: replaceFunc

/*** The replace() function.  Three arguments are all strings: call** them A, B, and C. The result is also a string which is derived** from A by replacing every occurance of B with C.  The match** must be exact.  Collating sequences are not used.*/static void replaceFunc(  sqlite3_context *context,  int argc,  sqlite3_value **argv){  const unsigned char *zStr;        /* The input string A */  const unsigned char *zPattern;    /* The pattern string B */  const unsigned char *zRep;        /* The replacement string C */  unsigned char *zOut;              /* The output */  int nStr;                /* Size of zStr */  int nPattern;            /* Size of zPattern */  int nRep;                /* Size of zRep */  i64 nOut;                /* Maximum size of zOut */  int loopLimit;           /* Last zStr[] that might match zPattern[] */  int i, j;                /* Loop counters */  assert( argc==3 );  UNUSED_PARAMETER(argc);  zStr = sqlite3_value_text(argv[0]);  if( zStr==0 ) return;  nStr = sqlite3_value_bytes(argv[0]);  assert( zStr==sqlite3_value_text(argv[0]) );  /* No encoding change */  zPattern = sqlite3_value_text(argv[1]);  if( zPattern==0 ){    assert( sqlite3_value_type(argv[1])==SQLITE_NULL            || sqlite3_context_db_handle(context)->mallocFailed );    return;  }  if( zPattern[0]==0 ){    assert( sqlite3_value_type(argv[1])!=SQLITE_NULL );    sqlite3_result_value(context, argv[0]);    return;  }  nPattern = sqlite3_value_bytes(argv[1]);  assert( zPattern==sqlite3_value_text(argv[1]) );  /* No encoding change */  zRep = sqlite3_value_text(argv[2]);  if( zRep==0 ) return;  nRep = sqlite3_value_bytes(argv[2]);  assert( zRep==sqlite3_value_text(argv[2]) );  nOut = nStr + 1;  assert( nOut<SQLITE_MAX_LENGTH );  zOut = contextMalloc(context, (i64)nOut);  if( zOut==0 ){    return;  }  loopLimit = nStr - nPattern;    for(i=j=0; i<=loopLimit; i++){    if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){      zOut[j++] = zStr[i];    }else{      u8 *zOld;      sqlite3 *db = sqlite3_context_db_handle(context);      nOut += nRep - nPattern;      testcase( nOut-1==db->aLimit[SQLITE_LIMIT_LENGTH] );      testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] );      if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){        sqlite3_result_error_toobig(context);        sqlite3DbFree(db, zOut);        return;      }      zOld = zOut;      zOut = sqlite3_realloc(zOut, (int)nOut);      if( zOut==0 ){        sqlite3_result_error_nomem(context);        sqlite3DbFree(db, zOld);        return;      }      memcpy(&zOut[j], zRep, nRep);      j += nRep;      i += nPattern-1;    }  }  assert( j+nStr-i+1==nOut );  memcpy(&zOut[j], &zStr[i], nStr-i);  j += nStr - i;  assert( j<=nOut );  zOut[j] = 0;  sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);}
开发者ID:kaomte,项目名称:sqlcipher,代码行数:85,


示例23: sqlite3AlterFinishAddColumn

/*** This function is called after an "ALTER TABLE ... ADD" statement** has been parsed. Argument pColDef contains the text of the new** column definition.**** The Table structure pParse->pNewTable was extended to include** the new column during parsing.*/void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){  Table *pNew;              /* Copy of pParse->pNewTable */  Table *pTab;              /* Table being altered */  int iDb;                  /* Database number */  const char *zDb;          /* Database name */  const char *zTab;         /* Table name */  char *zCol;               /* Null-terminated column definition */  Column *pCol;             /* The new column */  Expr *pDflt;              /* Default value for the new column */  sqlite3 *db;              /* The database connection; */  db = pParse->db;  if( pParse->nErr || db->mallocFailed ) return;  pNew = pParse->pNewTable;  assert( pNew );  assert( sqlite3BtreeHoldsAllMutexes(db) );  iDb = sqlite3SchemaToIndex(db, pNew->pSchema);  zDb = db->aDb[iDb].zName;  zTab = &pNew->zName[16];  /* Skip the "sqlite_altertab_" prefix on the name */  pCol = &pNew->aCol[pNew->nCol-1];  pDflt = pCol->pDflt;  pTab = sqlite3FindTable(db, zTab, zDb);  assert( pTab );#ifndef SQLITE_OMIT_AUTHORIZATION  /* Invoke the authorization callback. */  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){    return;  }#endif  /* If the default value for the new column was specified with a   ** literal NULL, then set pDflt to 0. This simplifies checking  ** for an SQL NULL default below.  */  if( pDflt && pDflt->op==TK_NULL ){    pDflt = 0;  }  /* Check that the new column is not specified as PRIMARY KEY or UNIQUE.  ** If there is a NOT NULL constraint, then the default value for the  ** column must not be NULL.  */  if( pCol->isPrimKey ){    sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column");    return;  }  if( pNew->pIndex ){    sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column");    return;  }  if( pCol->notNull && !pDflt ){    sqlite3ErrorMsg(pParse,         "Cannot add a NOT NULL column with default value NULL");    return;  }  /* Ensure the default expression is something that sqlite3ValueFromExpr()  ** can handle (i.e. not CURRENT_TIME etc.)  */  if( pDflt ){    sqlite3_value *pVal;    if( sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal) ){      db->mallocFailed = 1;      return;    }    if( !pVal ){      sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default");      return;    }    sqlite3ValueFree(pVal);  }  /* Modify the CREATE TABLE statement. */  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);  if( zCol ){    char *zEnd = &zCol[pColDef->n-1];    while( (zEnd>zCol && *zEnd==';') || sqlite3Isspace(*zEnd) ){      *zEnd-- = '/0';    }    sqlite3NestedParse(pParse,         "UPDATE /"%w/".%s SET "          "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "        "WHERE type = 'table' AND name = %Q",       zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,      zTab    );    sqlite3DbFree(db, zCol);  }  /* If the default value of the new column is NULL, then set the file//.........这里部分代码省略.........
开发者ID:qiuping,项目名称:sqlcipher,代码行数:101,


示例24: sqlite3AlterRenameTable

//.........这里部分代码省略.........    goto exit_rename_table;  }#endif#ifndef SQLITE_OMIT_VIRTUALTABLE  if( sqlite3ViewGetColumnNames(pParse, pTab) ){    goto exit_rename_table;  }  if( IsVirtual(pTab) && pTab->pMod->pModule->xRename ){    isVirtualRename = 1;  }#endif  /* Begin a transaction and code the VerifyCookie for database iDb.   ** Then modify the schema cookie (since the ALTER TABLE modifies the  ** schema). Open a statement transaction if the table is a virtual  ** table.  */  v = sqlite3GetVdbe(pParse);  if( v==0 ){    goto exit_rename_table;  }  sqlite3BeginWriteOperation(pParse, isVirtualRename, iDb);  sqlite3ChangeCookie(pParse, iDb);  /* If this is a virtual table, invoke the xRename() function if  ** one is defined. The xRename() callback will modify the names  ** of any resources used by the v-table implementation (including other  ** SQLite tables) that are identified by the name of the virtual table.  */#ifndef SQLITE_OMIT_VIRTUALTABLE  if( isVirtualRename ){    int i = ++pParse->nMem;    sqlite3VdbeAddOp4(v, OP_String8, 0, i, 0, zName, 0);    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pTab->pVtab, P4_VTAB);  }#endif  /* figure out how many UTF-8 characters are in zName */  zTabName = pTab->zName;  nTabName = sqlite3Utf8CharLen(zTabName, -1);  /* Modify the sqlite_master table to use the new table name. */  sqlite3NestedParse(pParse,      "UPDATE %Q.%s SET "#ifdef SQLITE_OMIT_TRIGGER          "sql = sqlite_rename_table(sql, %Q), "#else          "sql = CASE "            "WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)"            "ELSE sqlite_rename_table(sql, %Q) END, "#endif          "tbl_name = %Q, "          "name = CASE "            "WHEN type='table' THEN %Q "            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "             "'sqlite_autoindex_' || %Q || substr(name,%d+18) "            "ELSE name END "      "WHERE tbl_name=%Q AND "          "(type='table' OR type='index' OR type='trigger');",       zDb, SCHEMA_TABLE(iDb), zName, zName, zName, #ifndef SQLITE_OMIT_TRIGGER      zName,#endif      zName, nTabName, zTabName  );#ifndef SQLITE_OMIT_AUTOINCREMENT  /* If the sqlite_sequence table exists in this database, then update   ** it with the new table name.  */  if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){    sqlite3NestedParse(pParse,        "UPDATE /"%w/".sqlite_sequence set name = %Q WHERE name = %Q",        zDb, zName, pTab->zName);  }#endif#ifndef SQLITE_OMIT_TRIGGER  /* If there are TEMP triggers on this table, modify the sqlite_temp_master  ** table. Don't do this if the table being ALTERed is itself located in  ** the temp database.  */  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){    sqlite3NestedParse(pParse,         "UPDATE sqlite_temp_master SET "            "sql = sqlite_rename_trigger(sql, %Q), "            "tbl_name = %Q "            "WHERE %s;", zName, zName, zWhere);    sqlite3DbFree(db, zWhere);  }#endif  /* Drop and reload the internal table schema. */  reloadTableSchema(pParse, pTab, zName);exit_rename_table:  sqlite3SrcListDelete(db, pSrc);  sqlite3DbFree(db, zName);}
开发者ID:qiuping,项目名称:sqlcipher,代码行数:101,


示例25: attachFunc

//.........这里部分代码省略.........  /* Open the database file. If the btree is successfully opened, use  ** it to obtain the database schema. At this point the schema may  ** or may not be initialised.  */  rc = sqlite3BtreeFactory(db, zFile, 0, SQLITE_DEFAULT_CACHE_SIZE,                           db->openFlags | SQLITE_OPEN_MAIN_DB,                           &aNew->pBt);  db->nDb++;  if( rc==SQLITE_CONSTRAINT ){    rc = SQLITE_ERROR;    zErrDyn = sqlite3MPrintf(db, "database is already attached");  }else if( rc==SQLITE_OK ){    Pager *pPager;    aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);    if( !aNew->pSchema ){      rc = SQLITE_NOMEM;    }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){      zErrDyn = sqlite3MPrintf(db,         "attached databases must use the same text encoding as main database");      rc = SQLITE_ERROR;    }    pPager = sqlite3BtreePager(aNew->pBt);    sqlite3PagerLockingMode(pPager, db->dfltLockMode);    sqlite3PagerJournalMode(pPager, db->dfltJournalMode);  }  aNew->zName = sqlite3DbStrDup(db, zName);  aNew->safety_level = 3;#if SQLITE_HAS_CODEC  {    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);    int nKey;    char *zKey;    int t = sqlite3_value_type(argv[2]);    switch( t ){      case SQLITE_INTEGER:      case SQLITE_FLOAT:        zErrDyn = sqlite3DbStrDup(db, "Invalid key value");        rc = SQLITE_ERROR;        break;              case SQLITE_TEXT:      case SQLITE_BLOB:        nKey = sqlite3_value_bytes(argv[2]);        zKey = (char *)sqlite3_value_blob(argv[2]);        sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);        break;      case SQLITE_NULL:        /* No key specified.  Use the key from the main database */        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);        sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);        break;    }  }#endif  /* If the file was opened successfully, read the schema for the new database.  ** If this fails, or if opening the file failed, then close the file and   ** remove the entry from the db->aDb[] array. i.e. put everything back the way  ** we found it.  */  if( rc==SQLITE_OK ){    (void)sqlite3SafetyOn(db);    sqlite3BtreeEnterAll(db);    rc = sqlite3Init(db, &zErrDyn);    sqlite3BtreeLeaveAll(db);    (void)sqlite3SafetyOff(db);  }  if( rc ){    int iDb = db->nDb - 1;    assert( iDb>=2 );    if( db->aDb[iDb].pBt ){      sqlite3BtreeClose(db->aDb[iDb].pBt);      db->aDb[iDb].pBt = 0;      db->aDb[iDb].pSchema = 0;    }    sqlite3ResetInternalSchema(db, 0);    db->nDb = iDb;    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){      db->mallocFailed = 1;      sqlite3DbFree(db, zErrDyn);      zErrDyn = sqlite3MPrintf(db, "out of memory");    }else if( zErrDyn==0 ){      zErrDyn = sqlite3MPrintf(db, "unable to open database: %s", zFile);    }    goto attach_error;  }    return;attach_error:  /* Return an error if we get here */  if( zErrDyn ){    sqlite3_result_error(context, zErrDyn, -1);    sqlite3DbFree(db, zErrDyn);  }  if( rc ) sqlite3_result_error_code(context, rc);}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:101,


示例26: sqlite3ValueFromExpr

//.........这里部分代码省略.........){  int op;  char *zVal = 0;  sqlite3_value *pVal = 0;  int negInt = 1;  const char *zNeg = "";  if( !pExpr ){    *ppVal = 0;    return SQLITE_OK;  }  op = pExpr->op;  /* op can only be TK_REGISTER if we have compiled with SQLITE_ENABLE_STAT3.  ** The ifdef here is to enable us to achieve 100% branch test coverage even  ** when SQLITE_ENABLE_STAT3 is omitted.  */#ifdef SQLITE_ENABLE_STAT3  if( op==TK_REGISTER ) op = pExpr->op2;#else  if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;#endif  /* Handle negative integers in a single step.  This is needed in the  ** case when the value is -9223372036854775808.  */  if( op==TK_UMINUS   && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){    pExpr = pExpr->pLeft;    op = pExpr->op;    negInt = -1;    zNeg = "-";  }  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){    pVal = sqlite3ValueNew(db);    if( pVal==0 ) goto no_mem;    if( ExprHasProperty(pExpr, EP_IntValue) ){      sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt);    }else{      zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken);      if( zVal==0 ) goto no_mem;      sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);      if( op==TK_FLOAT ) pVal->type = SQLITE_FLOAT;    }    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8);    }else{      sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8);    }    if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str;    if( enc!=SQLITE_UTF8 ){      sqlite3VdbeChangeEncoding(pVal, enc);    }  }else if( op==TK_UMINUS ) {    /* This branch happens for multiple negative signs.  Ex: -(-5) */    if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){      sqlite3VdbeMemNumerify(pVal);      if( pVal->u.i==SMALLEST_INT64 ){        pVal->flags &= MEM_Int;        pVal->flags |= MEM_Real;        pVal->r = (double)LARGEST_INT64;      }else{        pVal->u.i = -pVal->u.i;      }      pVal->r = -pVal->r;      sqlite3ValueApplyAffinity(pVal, affinity, enc);    }  }else if( op==TK_NULL ){    pVal = sqlite3ValueNew(db);    if( pVal==0 ) goto no_mem;  }#ifndef SQLITE_OMIT_BLOB_LITERAL  else if( op==TK_BLOB ){    int nVal;    assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );    assert( pExpr->u.zToken[1]=='/'' );    pVal = sqlite3ValueNew(db);    if( !pVal ) goto no_mem;    zVal = &pExpr->u.zToken[2];    nVal = sqlite3Strlen30(zVal)-1;    assert( zVal[nVal]=='/'' );    sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,                         0, SQLITE_DYNAMIC);  }#endif  if( pVal ){    sqlite3VdbeMemStoreType(pVal);  }  *ppVal = pVal;  return SQLITE_OK;no_mem:  db->mallocFailed = 1;  sqlite3DbFree(db, zVal);  sqlite3ValueFree(pVal);  *ppVal = 0;  return SQLITE_NOMEM;}
开发者ID:HappyDanger,项目名称:sqlcipher,代码行数:101,


示例27: sqlite3AlterFinishAddColumn

//.........这里部分代码省略.........  assert( sqlite3BtreeHoldsAllMutexes(db) );  iDb = sqlite3SchemaToIndex(db, pNew->pSchema);  zDb = db->aDb[iDb].zName;  zTab = &pNew->zName[16];  /* Skip the "sqlite_altertab_" prefix on the name */  pCol = &pNew->aCol[pNew->nCol-1];  pDflt = pCol->pDflt;  pTab = sqlite3FindTable(db, zTab, zDb);  assert( pTab );#ifndef SQLITE_OMIT_AUTHORIZATION  /* Invoke the authorization callback. */  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){    return;  }#endif  /* If the default value for the new column was specified with a  ** literal NULL, then set pDflt to 0. This simplifies checking  ** for an SQL NULL default below.  */  if( pDflt && pDflt->op==TK_NULL ){    pDflt = 0;  }  /* Check that the new column is not specified as PRIMARY KEY or UNIQUE.  ** If there is a NOT NULL constraint, then the default value for the  ** column must not be NULL.  */  if( pCol->colFlags & COLFLAG_PRIMKEY ){    sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column");    return;  }  if( pNew->pIndex ){    sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column");    return;  }  if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){    sqlite3ErrorMsg(pParse,        "Cannot add a REFERENCES column with non-NULL default value");    return;  }  if( pCol->notNull && !pDflt ){    sqlite3ErrorMsg(pParse,        "Cannot add a NOT NULL column with default value NULL");    return;  }  /* Ensure the default expression is something that sqlite3ValueFromExpr()  ** can handle (i.e. not CURRENT_TIME etc.)  */  if( pDflt ){    sqlite3_value *pVal = 0;    int rc;    rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal);    assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );    if( rc!=SQLITE_OK ){      assert( db->mallocFailed == 1 );      return;    }    if( !pVal ){      sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default");      return;    }    sqlite3ValueFree(pVal);  }  /* Modify the CREATE TABLE statement. */  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);  if( zCol ){    char *zEnd = &zCol[pColDef->n-1];    int savedDbFlags = db->flags;    while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){      *zEnd-- = '/0';    }    db->flags |= SQLITE_PreferBuiltin;    sqlite3NestedParse(pParse,        "UPDATE /"%w/".%s SET "          "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "        "WHERE type = 'table' AND name = %Q",      zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,      zTab    );    sqlite3DbFree(db, zCol);    db->flags = savedDbFlags;  }  /* If the default value of the new column is NULL, then the file  ** format to 2. If the default value of the new column is not NULL,  ** the file format be 3.  Back when this feature was first added  ** in 2006, we went to the trouble to upgrade the file format to the  ** minimum support values.  But 10-years on, we can assume that all  ** extent versions of SQLite support file-format 4, so we always and  ** unconditionally upgrade to 4.  */  sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT,                    SQLITE_MAX_FILE_FORMAT);  /* Reload the schema of the modified table. */  reloadTableSchema(pParse, pTab, pTab->zName);}
开发者ID:arizwanp,项目名称:intel_sgx,代码行数:101,


示例28: sqlite3RunParser

//.........这里部分代码省略.........#ifdef YYTRACKMAXSTACKDEPTH  sqlite3_mutex_enter(sqlite3MallocMutex());  sqlite3StatusHighwater(SQLITE_STATUS_PARSER_STACK,      sqlite3ParserStackPeak(pEngine)  );  sqlite3_mutex_leave(sqlite3MallocMutex());#endif /* YYDEBUG */#ifdef sqlite3Parser_ENGINEALWAYSONSTACK  sqlite3ParserFinalize(pEngine);#else  sqlite3ParserFree(pEngine, sqlite3_free);#endif  if( db->mallocFailed ){    pParse->rc = SQLITE_NOMEM_BKPT;  }  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){    pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));  }  assert( pzErrMsg!=0 );  if( pParse->zErrMsg ){    *pzErrMsg = pParse->zErrMsg;    sqlite3_log(pParse->rc, "%s in /"%s/"",                 *pzErrMsg, pParse->zTail);    pParse->zErrMsg = 0;    nErr++;  }  pParse->zTail = zSql;  if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){    sqlite3VdbeDelete(pParse->pVdbe);    pParse->pVdbe = 0;  }#ifndef SQLITE_OMIT_SHARED_CACHE  if( pParse->nested==0 ){    sqlite3DbFree(db, pParse->aTableLock);    pParse->aTableLock = 0;    pParse->nTableLock = 0;  }#endif#ifndef SQLITE_OMIT_VIRTUALTABLE  sqlite3_free(pParse->apVtabLock);#endif  if( !IN_SPECIAL_PARSE ){    /* If the pParse->declareVtab flag is set, do not delete any table     ** structure built up in pParse->pNewTable. The calling code (see vtab.c)    ** will take responsibility for freeing the Table structure.    */    sqlite3DeleteTable(db, pParse->pNewTable);  }  if( !IN_RENAME_OBJECT ){    sqlite3DeleteTrigger(db, pParse->pNewTrigger);  }  if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree);  sqlite3DbFree(db, pParse->pVList);  while( pParse->pAinc ){    AutoincInfo *p = pParse->pAinc;    pParse->pAinc = p->pNext;    sqlite3DbFreeNN(db, p);  }  while( pParse->pZombieTab ){    Table *p = pParse->pZombieTab;    pParse->pZombieTab = p->pNextZombie;    sqlite3DeleteTable(db, p);  }  assert( nErr==0 || pParse->rc!=SQLITE_OK );
开发者ID:SCALE-GmbH,项目名称:sqlcipher,代码行数:67,


示例29: sqlite3DeleteFrom

//.........这里部分代码省略.........        iAddrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);      }      testcase( IsVirtual(pTab) );      sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,                                 iTabCur, aToOpen, &iDataCur, &iIdxCur);      assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );      assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 );      if( eOnePass==ONEPASS_MULTI ) sqlite3VdbeJumpHere(v, iAddrOnce);    }      /* Set up a loop over the rowids/primary-keys that were found in the    ** where-clause loop above.    */    if( eOnePass!=ONEPASS_OFF ){      assert( nKey==nPk );  /* OP_Found will use an unpacked key */      if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){        assert( pPk!=0 || pTab->pSelect!=0 );        sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey);        VdbeCoverage(v);      }    }else if( pPk ){      addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v);      sqlite3VdbeAddOp2(v, OP_RowKey, iEphCur, iKey);      assert( nKey==0 );  /* OP_Found will use a composite key */    }else{      addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey);      VdbeCoverage(v);      assert( nKey==1 );    }        /* Delete the row */#ifndef SQLITE_OMIT_VIRTUALTABLE    if( IsVirtual(pTab) ){      const char *pVTab = (const char *)sqlite3GetVTable(db, pTab);      sqlite3VtabMakeWritable(pParse, pTab);      sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB);      sqlite3VdbeChangeP5(v, OE_Abort);      assert( eOnePass==ONEPASS_OFF || eOnePass==ONEPASS_SINGLE );      sqlite3MayAbort(pParse);      if( eOnePass==ONEPASS_SINGLE && sqlite3IsToplevel(pParse) ){        pParse->isMultiWrite = 0;      }    }else#endif    {      int count = (pParse->nested==0);    /* True to count changes */      int iIdxNoSeek = -1;      if( bComplex==0 && aiCurOnePass[1]!=iDataCur ){        iIdxNoSeek = aiCurOnePass[1];      }      sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur,          iKey, nKey, count, OE_Default, eOnePass, iIdxNoSeek);    }      /* End of the loop over all rowids/primary-keys. */    if( eOnePass!=ONEPASS_OFF ){      sqlite3VdbeResolveLabel(v, addrBypass);      sqlite3WhereEnd(pWInfo);    }else if( pPk ){      sqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1); VdbeCoverage(v);      sqlite3VdbeJumpHere(v, addrLoop);    }else{      sqlite3VdbeGoto(v, addrLoop);      sqlite3VdbeJumpHere(v, addrLoop);    }           /* Close the cursors open on the table and its indexes. */    if( !isView && !IsVirtual(pTab) ){      if( !pPk ) sqlite3VdbeAddOp1(v, OP_Close, iDataCur);      for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){        sqlite3VdbeAddOp1(v, OP_Close, iIdxCur + i);      }    }  } /* End non-truncate path */  /* Update the sqlite_sequence table by storing the content of the  ** maximum rowid counter values recorded while inserting into  ** autoincrement tables.  */  if( pParse->nested==0 && pParse->pTriggerTab==0 ){    sqlite3AutoincrementEnd(pParse);  }  /* Return the number of rows that were deleted. If this routine is   ** generating code because of a call to sqlite3NestedParse(), do not  ** invoke the callback function.  */  if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){    sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);    sqlite3VdbeSetNumCols(v, 1);    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);  }delete_from_cleanup:  sqlite3AuthContextPop(&sContext);  sqlite3SrcListDelete(db, pTabList);  sqlite3ExprDelete(db, pWhere);  sqlite3DbFree(db, aToOpen);  return;}
开发者ID:chinesemanbobo,项目名称:PPDemo,代码行数:101,


示例30: sqlite3AlterRenameTable

//.........这里部分代码省略.........    goto exit_rename_table;  }  sqlite3BeginWriteOperation(pParse, pVTab!=0, iDb);  sqlite3ChangeCookie(pParse, iDb);  /* If this is a virtual table, invoke the xRename() function if  ** one is defined. The xRename() callback will modify the names  ** of any resources used by the v-table implementation (including other  ** SQLite tables) that are identified by the name of the virtual table.  */#ifndef SQLITE_OMIT_VIRTUALTABLE  if( pVTab ){    int i = ++pParse->nMem;    sqlite3VdbeLoadString(v, i, zName);    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB);    sqlite3MayAbort(pParse);  }#endif  /* figure out how many UTF-8 characters are in zName */  zTabName = pTab->zName;  nTabName = sqlite3Utf8CharLen(zTabName, -1);#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)  if( db->flags&SQLITE_ForeignKeys ){    /* If foreign-key support is enabled, rewrite the CREATE TABLE    ** statements corresponding to all child tables of foreign key constraints    ** for which the renamed table is the parent table.  */    if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){      sqlite3NestedParse(pParse,          "UPDATE /"%w/".%s SET "              "sql = sqlite_rename_parent(sql, %Q, %Q) "              "WHERE %s;", zDb, SCHEMA_TABLE(iDb), zTabName, zName, zWhere);      sqlite3DbFree(db, zWhere);    }  }#endif  /* Modify the sqlite_master table to use the new table name. */  sqlite3NestedParse(pParse,      "UPDATE %Q.%s SET "#ifdef SQLITE_OMIT_TRIGGER          "sql = sqlite_rename_table(sql, %Q), "#else          "sql = CASE "            "WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)"            "ELSE sqlite_rename_table(sql, %Q) END, "#endif          "tbl_name = %Q, "          "name = CASE "            "WHEN type='table' THEN %Q "            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "             "'sqlite_autoindex_' || %Q || substr(name,%d+18) "            "ELSE name END "      "WHERE tbl_name=%Q COLLATE nocase AND "          "(type='table' OR type='index' OR type='trigger');",      zDb, SCHEMA_TABLE(iDb), zName, zName, zName,#ifndef SQLITE_OMIT_TRIGGER      zName,#endif      zName, nTabName, zTabName  );#ifndef SQLITE_OMIT_AUTOINCREMENT  /* If the sqlite_sequence table exists in this database, then update  ** it with the new table name.
开发者ID:arizwanp,项目名称:intel_sgx,代码行数:67,



注:本文中的sqlite3DbFree函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sqlite3DbMallocRaw函数代码示例
C++ sqlite3BtreePager函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。