这篇教程C++ sqlite3HashFind函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sqlite3HashFind函数的典型用法代码示例。如果您正苦于以下问题:C++ sqlite3HashFind函数的具体用法?C++ sqlite3HashFind怎么用?C++ sqlite3HashFind使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sqlite3HashFind函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: sqlite3DropTrigger/*** This function is called to drop a trigger from the database schema. **** This may be called directly from the parser and therefore identifies** the trigger by name. The sqlite3DropTriggerPtr() routine does the** same job as this routine except it takes a pointer to the trigger** instead of the trigger name.**/void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){ Trigger *pTrigger = 0; int i; const char *zDb; const char *zName; int nName; sqlite3 *db = pParse->db; if( db->mallocFailed ) goto drop_trigger_cleanup; if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ goto drop_trigger_cleanup; } assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; nName = strlen(zName); for(i=OMIT_TEMPDB; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue; pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName); if( pTrigger ) break; } if( !pTrigger ){ if( !noErr ){ sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0); } goto drop_trigger_cleanup; } sqlite3DropTriggerPtr(pParse, pTrigger);drop_trigger_cleanup: sqlite3SrcListDelete(pName);}
开发者ID:evlinsky,项目名称:FBReader,代码行数:42,
示例2: sqlite3VtabCallCreate/*** This function is invoked by the vdbe to call the xCreate method** of the virtual table named zTab in database iDb. **** If an error occurs, *pzErr is set to point an an English language** description of the error and an SQLITE_XXX error code is returned.** In this case the caller must call sqlite3DbFree(db, ) on *pzErr.*/int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){ int rc = SQLITE_OK; Table *pTab; Module *pMod; const char *zMod; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable ); /* Locate the required virtual table module */ zMod = pTab->azModuleArg[0]; pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod)); /* 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 ){ *pzErr = sqlite3MPrintf(db, "no such module: %s", zMod); rc = SQLITE_ERROR; }else{ rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr); } /* Justification of ALWAYS(): The xConstructor method is required to ** create a valid sqlite3_vtab if it returns SQLITE_OK. */ if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){ rc = growVTrans(db); if( rc==SQLITE_OK ){ addToVTrans(db, sqlite3GetVTable(db, pTab)); } } return rc;}
开发者ID:Ashod,项目名称:SqliteCompressed,代码行数:43,
示例3: sqlite3VtabCallConnect/*** 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 ** and an error left in pParse.**** This call is a no-op if table pTab is not a virtual table.*/int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){ sqlite3 *db = pParse->db; const char *zMod; Module *pMod; int rc; assert( pTab ); if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){ return SQLITE_OK; } /* Locate the required virtual table module */ zMod = pTab->azModuleArg[0]; pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod)); if( !pMod ){ const char *zModule = pTab->azModuleArg[0]; sqlite3ErrorMsg(pParse, "no such module: %s", zModule); rc = SQLITE_ERROR; }else{ char *zErr = 0; rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr); if( rc!=SQLITE_OK ){ sqlite3ErrorMsg(pParse, "%s", zErr); } sqlite3DbFree(db, zErr); } return rc;}
开发者ID:Ashod,项目名称:SqliteCompressed,代码行数:37,
示例4: 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 = strlen(zName); pColl = sqlite3HashFind(&db->aCollSeq, zName, nName); if( 0==pColl && create ) { pColl = sqliteMalloc( 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 || (sqlite3_malloc_failed && pDel==pColl) ); sqliteFree(pDel); } } return pColl;}
开发者ID:pfchrono,项目名称:mudmagic-client,代码行数:47,
示例5: exist_callbackstatic int exist_callback(void *pArg, int argc, char **argv, char **columnNames){ extension_cache *cache; char key[ARRAY_SIZE]; int pri; time_t now; int needs_add=0; switch_config *config=NULL; int timeout=0; char *context; if (pArg) { config = pArg; timeout = config->timeout; } if (!timeout) timeout = default_timeout; context = argv[5] ? argv[5] : argv[0]; if (!strcmp(context,"_any_")) { ast_verbose(VERBOSE_PREFIX_2 "SQLiteSwitch: magic extension: %s not cached/n",argv[1]); return 0; } snprintf(key, ARRAY_SIZE, "%s.%s", argv[1], context); time(&now); pri = atoi(argv[2]); cache = (extension_cache *) sqlite3HashFind(&extens,key,strlen(key)); if (! cache) { cache = malloc(sizeof(extension_cache)); needs_add = 1; } if (needs_add || cache->expires < now) { memset(cache,0,sizeof(extension_cache)); strncpy(cache->context,argv[0],sizeof(cache->context)); strncpy(cache->exten,argv[1],sizeof(cache->exten)); } cache->expires = now + timeout; if (config && ! config->seeheads) { ast_verbose(VERBOSE_PREFIX_2 "SQLiteSwitch: extension %[email C++ sqlite3MPrintf函数代码示例 C++ sqlite3GetVdbe函数代码示例
|