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

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

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

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

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

示例1: void

/*** The first parameter (pDef) is a function implementation.  The** second parameter (pExpr) is the first argument to this function.** If pExpr is a column in a virtual table, then let the virtual** table implementation have an opportunity to overload the function.**** This routine is used to allow virtual table implementations to** overload MATCH, LIKE, GLOB, and REGEXP operators.**** Return either the pDef argument (indicating no change) or a ** new FuncDef structure that is marked as ephemeral using the** SQLITE_FUNC_EPHEM flag.*/FuncDef *sqlite3VtabOverloadFunction(  sqlite3 *db,    /* Database connection for reporting malloc problems */  FuncDef *pDef,  /* Function to possibly overload */  int nArg,       /* Number of arguments to the function */  Expr *pExpr     /* First argument to the function */){  Table *pTab;  sqlite3_vtab *pVtab;  sqlite3_module *pMod;  void (*xSFunc)(sqlite3_context*,int,sqlite3_value**) = 0;  void *pArg = 0;  FuncDef *pNew;  int rc = 0;  char *zLowerName;  unsigned char *z;  /* Check to see the left operand is a column in a virtual table */  if( NEVER(pExpr==0) ) return pDef;  if( pExpr->op!=TK_COLUMN ) return pDef;  pTab = pExpr->pTab;  if( NEVER(pTab==0) ) return pDef;  if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef;  pVtab = sqlite3GetVTable(db, pTab)->pVtab;  assert( pVtab!=0 );  assert( pVtab->pModule!=0 );  pMod = (sqlite3_module *)pVtab->pModule;  if( pMod->xFindFunction==0 ) return pDef;   /* Call the xFindFunction method on the virtual table implementation  ** to see if the implementation wants to overload this function   */  zLowerName = sqlite3DbStrDup(db, pDef->zName);  if( zLowerName ){    for(z=(unsigned char*)zLowerName; *z; z++){      *z = sqlite3UpperToLower[*z];    }    rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xSFunc, &pArg);    sqlite3DbFree(db, zLowerName);  }  if( rc==0 ){    return pDef;  }  /* Create a new ephemeral function definition for the overloaded  ** function */  pNew = sqlite3DbMallocZero(db, sizeof(*pNew)                             + sqlite3Strlen30(pDef->zName) + 1);  if( pNew==0 ){    return pDef;  }  *pNew = *pDef;  pNew->zName = (const char*)&pNew[1];  memcpy((char*)&pNew[1], pDef->zName, sqlite3Strlen30(pDef->zName)+1);  pNew->xSFunc = xSFunc;  pNew->pUserData = pArg;  pNew->funcFlags |= SQLITE_FUNC_EPHEM;  return pNew;}
开发者ID:wangyiran126,项目名称:sqlite,代码行数:72,


示例2: getTempname

/*** Create a temporary file name in zBuf.  zBuf must be big enough to** hold at pVfs->mxPathname characters.*/static int getTempname(int nBuf, char *zBuf ){  static const unsigned char zChars[] =    "abcdefghijklmnopqrstuvwxyz"    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"    "0123456789";  int i, j;  char zTempPathBuf[3];  PSZ zTempPath = (PSZ)&zTempPathBuf;  if( sqlite3_temp_directory ){    zTempPath = sqlite3_temp_directory;  }else{    if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){      if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){        if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){           ULONG ulDriveNum = 0, ulDriveMap = 0;           DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );           sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );        }      }    }  }  /* Strip off a trailing slashes or backslashes, otherwise we would get *   * multiple (back)slashes which causes DosOpen() to fail.              *   * Trailing spaces are not allowed, either.                            */  j = sqlite3Strlen30(zTempPath);  while( j > 0 && ( zTempPath[j-1] == '//' || zTempPath[j-1] == '/'                    || zTempPath[j-1] == ' ' ) ){    j--;  }  zTempPath[j] = '/0';  if( !sqlite3_temp_directory ){    char *zTempPathUTF = convertCpPathToUtf8( zTempPath );    sqlite3_snprintf( nBuf-30, zBuf,                      "%s//"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );    free( zTempPathUTF );  }else{    sqlite3_snprintf( nBuf-30, zBuf,                      "%s//"SQLITE_TEMP_FILE_PREFIX, zTempPath );  }  j = sqlite3Strlen30( zBuf );  sqlite3_randomness( 20, &zBuf[j] );  for( i = 0; i < 20; i++, j++ ){    zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];  }  zBuf[j] = 0;  OSTRACE2( "TEMP FILENAME: %s/n", zBuf );  return SQLITE_OK;}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:52,


示例3: sqlite3MaterializeView

/*** Evaluate a view and store its result in an ephemeral table.  The** pWhere argument is an optional WHERE clause that restricts the** set of rows in the view that are to be added to the ephemeral table.*/void sqlite3MaterializeView(  Parse *pParse,       /* Parsing context */  Table *pView,        /* View definition */  Expr *pWhere,        /* Optional WHERE clause to be added */  int iCur             /* Cursor number for ephemerial table */){  SelectDest dest;  Select *pDup;  sqlite3 *db = pParse->db;  pDup = sqlite3SelectDup(db, pView->pSelect);  if( pWhere ){    SrcList *pFrom;    Token viewName;        pWhere = sqlite3ExprDup(db, pWhere);    viewName.z = (u8*)pView->zName;    viewName.n = (unsigned int)sqlite3Strlen30((const char*)viewName.z);    pFrom = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &viewName, pDup, 0,0);    pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);  }  sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);  sqlite3Select(pParse, pDup, &dest);  sqlite3SelectDelete(db, pDup);}
开发者ID:kfengbest,项目名称:GenericDB,代码行数:30,


示例4: roundFunc

static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){  int n = 0;  double r;  char *zBuf;  assert( argc==1 || argc==2 );  if( argc==2 ){    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;    n = sqlite3_value_int(argv[1]);    if( n>30 ) n = 30;    if( n<0 ) n = 0;  }  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;  r = sqlite3_value_double(argv[0]);  /* If Y==0 and X will fit in a 64-bit int,  ** handle the rounding directly,  ** otherwise use printf.  */  if( n==0 && r>=0 && r<LARGEST_INT64-1 ){    r = (double)((sqlite_int64)(r+0.5));  }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){    r = -(double)((sqlite_int64)((-r)+0.5));  }else{    zBuf = sqlite3_mprintf("%.*f",n,r);    if( zBuf==0 ){      sqlite3_result_error_nomem(context);      return;    }    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);    sqlite3_free(zBuf);  }  sqlite3_result_double(context, r);}
开发者ID:blingstorm,项目名称:sqlcipher,代码行数:32,


示例5: 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 = addToVTrans(db, sqlite3GetVTable(db, pTab));  }  return rc;}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:40,


示例6: 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:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:37,


示例7: sqlite3VdbeMemStringify

/*** Add MEM_Str to the set of representations for the given Mem.  Numbers** are converted using sqlite3_snprintf().  Converting a BLOB to a string** is a no-op.**** Existing representations MEM_Int and MEM_Real are *not* invalidated.**** A MEM_Null value will never be passed to this function. This function is** used for converting values to text for returning to the user (i.e. via** sqlite3_value_text()), or for ensuring that values to be used as btree** keys are strings. In the former case a NULL pointer is returned the** user and the later is an internal programming error.*/int sqlite3VdbeMemStringify(Mem *pMem, int enc){  int rc = SQLITE_OK;  int fg = pMem->flags;  const int nByte = 32;  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );  assert( !(fg&MEM_Zero) );  assert( !(fg&(MEM_Str|MEM_Blob)) );  assert( fg&(MEM_Int|MEM_Real) );  assert( (pMem->flags&MEM_RowSet)==0 );  assert( EIGHT_BYTE_ALIGNMENT(pMem) );  if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){    return SQLITE_NOMEM;  }  /* For a Real or Integer, use sqlite3_mprintf() to produce the UTF-8  ** string representation of the value. Then, if the required encoding  ** is UTF-16le or UTF-16be do a translation.  **   ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.  */  if( fg & MEM_Int ){    sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);  }else{    assert( fg & MEM_Real );    sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r);  }  pMem->n = sqlite3Strlen30(pMem->z);  pMem->enc = SQLITE_UTF8;  pMem->flags |= MEM_Str|MEM_Term;  sqlite3VdbeChangeEncoding(pMem, enc);  return rc;}
开发者ID:HappyDanger,项目名称:sqlcipher,代码行数:48,


示例8: isSystemTable

/*** Parameter zName is the name of a table that is about to be altered** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN).** If the table is a system table, this function leaves an error message** in pParse->zErr (system tables may not be altered) and returns non-zero.**** Or, if zName is not a system table, zero is returned.*/static int isSystemTable(Parse *pParse, const char *zName){  if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){    sqlite3ErrorMsg(pParse, "table %s may not be altered", zName);    return 1;  }  return 0;}
开发者ID:arizwanp,项目名称:intel_sgx,代码行数:15,


示例9: sqlite3VtabEponymousTableInit

/*** Check to see if virtual tale module pMod can be have an eponymous** virtual table instance.  If it can, create one if one does not already** exist. Return non-zero if the eponymous virtual table instance exists** when this routine returns, and return zero if it does not exist.**** An eponymous virtual table instance is one that is named after its** module, and more importantly, does not require a CREATE VIRTUAL TABLE** statement in order to come into existance.  Eponymous virtual table** instances always exist.  They cannot be DROP-ed.**** Any virtual table module for which xConnect and xCreate are the same** method can have an eponymous virtual table instance.*/int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){  const sqlite3_module *pModule = pMod->pModule;  Table *pTab;  char *zErr = 0;  int nName;  int rc;  sqlite3 *db = pParse->db;  if( pMod->pEpoTab ) return 1;  if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0;  nName = sqlite3Strlen30(pMod->zName) + 1;  pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName);  if( pTab==0 ) return 0;  pMod->pEpoTab = pTab;  pTab->zName = (char*)&pTab[1];  memcpy(pTab->zName, pMod->zName, nName);  pTab->nRef = 1;  pTab->pSchema = db->aDb[0].pSchema;  pTab->tabFlags |= TF_Virtual;  pTab->nModuleArg = 0;  pTab->iPKey = -1;  addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));  addModuleArgument(db, pTab, 0);  addModuleArgument(db, pTab, sqlite3DbStrDup(db, pTab->zName));  rc = vtabCallConstructor(db, pTab, pMod, pModule->xConnect, &zErr);  if( rc ){    sqlite3ErrorMsg(pParse, "%s", zErr);    sqlite3DbFree(db, zErr);    sqlite3VtabEponymousTableClear(db, pMod);    return 0;  }  return 1;}
开发者ID:ngdmcc,项目名称:sqlite,代码行数:46,


示例10: 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 = sqlite3Strlen30(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(db, pName);}
开发者ID:Ramananda,项目名称:sqlcipher,代码行数:42,


示例11: sqlite3IsLikeFunction

/*** pExpr points to an expression which implements a function.  If** it is appropriate to apply the LIKE optimization to that function** then set aWc[0] through aWc[2] to the wildcard characters and** return TRUE.  If the function is not a LIKE-style function then** return FALSE.*/int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){  FuncDef *pDef;  if( pExpr->op!=TK_FUNCTION    || !pExpr->x.pList    || pExpr->x.pList->nExpr!=2  ){    return 0;  }  assert( !ExprHasProperty(pExpr, EP_xIsSelect) );  pDef = sqlite3FindFunction(db, pExpr->u.zToken,                              sqlite3Strlen30(pExpr->u.zToken),                             2, SQLITE_UTF8, 0);  if( NEVER(pDef==0) || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){    return 0;  }  /* The memcpy() statement assumes that the wildcard characters are  ** the first three statements in the compareInfo structure.  The  ** asserts() that follow verify that assumption  */  memcpy(aWc, pDef->pUserData, 3);  assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );  assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );  assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );  *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0;  return 1;}
开发者ID:blingstorm,项目名称:sqlcipher,代码行数:34,


示例12: sqlite3UnlinkAndDeleteTrigger

/*** Remove a trigger from the hash tables of the sqlite* pointer.*/void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){  Trigger *pTrigger;  int nName = sqlite3Strlen30(zName);  pTrigger = sqlite3HashInsert(&(db->aDb[iDb].pSchema->trigHash),                               zName, nName, 0);  if( pTrigger ){    Table *pTable = tableOfTrigger(pTrigger);    assert( pTable!=0 );    if( pTable->pTrigger == pTrigger ){      pTable->pTrigger = pTrigger->pNext;    }else{      Trigger *cc = pTable->pTrigger;      while( cc ){         if( cc->pNext == pTrigger ){          cc->pNext = cc->pNext->pNext;          break;        }        cc = cc->pNext;      }      assert(cc);    }    sqlite3DeleteTrigger(db, pTrigger);    db->flags |= SQLITE_InternChanges;  }}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:28,


示例13: exprProbability

/*** Expression p should encode a floating point value between 1.0 and 0.0.** Return 1024 times this value.  Or return -1 if p is not a floating point** value between 1.0 and 0.0.*/static int exprProbability(Expr *p){  double r = -1.0;  if( p->op!=TK_FLOAT ) return -1;  sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);  assert( r>=0.0 );  if( r>1.0 ) return -1;  return (int)(r*1000.0);}
开发者ID:Oceanwings,项目名称:sqlcipher,代码行数:13,


示例14: setLikeOptFlag

/*** Set the LIKEOPT flag on the 2-argument function with the given name.*/static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){  FuncDef *pDef;  pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName),                             2, SQLITE_UTF8, 0);  if( ALWAYS(pDef) ){    pDef->flags = flagVal;  }}
开发者ID:blingstorm,项目名称:sqlcipher,代码行数:11,


示例15: strHash

/*** Hash and comparison functions when the mode is SQLITE_HASH_STRING*/static int strHash(const void *pKey, int nKey){  const char *z = (const char *)pKey;  int h = 0;  if( nKey<=0 ) nKey = sqlite3Strlen30(z);  while( nKey > 0  ){    h = (h<<3) ^ h ^ sqlite3UpperToLower[(unsigned char)*z++];    nKey--;  }  return h & 0x7fffffff;}
开发者ID:kfengbest,项目名称:GenericDB,代码行数:13,


示例16: sqlite3_compileoption_used

/*** Given the name of a compile-time option, return true if that option** was used and false if not.**** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix** is not required for a match.*/int sqlite3_compileoption_used(const char *zOptName){  int i, n;  if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;  n = sqlite3Strlen30(zOptName);  /* Since ArraySize(azCompileOpt) is normally in single digits, a  ** linear search is adequate.  No need for a binary search. */  for(i=0; i<ArraySize(azCompileOpt); i++){    if(   (sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0)       && ( (azCompileOpt[i][n]==0) || (azCompileOpt[i][n]=='=') ) ) return 1;  }  return 0;}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:20,


示例17: sqlite3Strlen30

/*** Make a copy of a string in memory obtained from sqliteMalloc(). These ** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This** is because when memory debugging is turned on, these two functions are ** called via macros that record the current file and line number in the** ThreadData structure.*/char *sqlite3DbStrDup(sqlite3 *db, const char *z){  char *zNew;  size_t n;  if( z==0 ){    return 0;  }  n = sqlite3Strlen30(z) + 1;  assert( (n&0x7fffffff)==n );  zNew = sqlite3DbMallocRaw(db, (int)n);  if( zNew ){    memcpy(zNew, z, n);  }  return zNew;}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:21,


示例18: sqlite3UnlinkAndDeleteTrigger

/*** Remove a trigger from the hash tables of the sqlite* pointer.*/void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){  Hash *pHash = &(db->aDb[iDb].pSchema->trigHash);  Trigger *pTrigger;  pTrigger = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), 0);  if( ALWAYS(pTrigger) ){    if( pTrigger->pSchema==pTrigger->pTabSchema ){      Table *pTab = tableOfTrigger(pTrigger);      Trigger **pp;      for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext));      *pp = (*pp)->pNext;    }    sqlite3DeleteTrigger(db, pTrigger);    db->flags |= SQLITE_InternChanges;  }}
开发者ID:Ramananda,项目名称:sqlcipher,代码行数:18,


示例19: synthCollSeq

/*** This routine is called if the collation factory fails to deliver a** collation function in the best encoding but there may be other versions** of this collation function (for other text encodings) available. Use one** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if** possible.*/static int synthCollSeq(sqlite3 *db, CollSeq *pColl){  CollSeq *pColl2;  char *z = pColl->zName;  int n = sqlite3Strlen30(z);  int i;  static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };  for(i=0; i<3; i++){    pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, n, 0);    if( pColl2->xCmp!=0 ){      memcpy(pColl, pColl2, sizeof(CollSeq));      pColl->xDel = 0;         /* Do not copy the destructor */      return SQLITE_OK;    }  }  return SQLITE_ERROR;}
开发者ID:DoganA,项目名称:nightingale-deps,代码行数:23,


示例20: sqlite3FuncDefInsert

/*** Insert a new FuncDef into a FuncDefHash hash table.*/void sqlite3FuncDefInsert(  FuncDefHash *pHash,  /* The hash table into which to insert */  FuncDef *pDef        /* The function definition to insert */){  FuncDef *pOther;  int nName = sqlite3Strlen30(pDef->zName);  u8 c1 = (u8)pDef->zName[0];  int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);  pOther = functionSearch(pHash, h, pDef->zName, nName);  if( pOther ){    pDef->pNext = pOther->pNext;    pOther->pNext = pDef;  }else{    pDef->pNext = 0;    pDef->pHash = pHash->a[h];    pHash->a[h] = pDef;  }}
开发者ID:DoganA,项目名称:nightingale-deps,代码行数:21,


示例21: parseDateOrTime

/*** Attempt to parse the given string into a julian day number.  Return** the number of errors.**** The following are acceptable forms for the input string:****      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM**      DDDD.DD **      now**** In the first form, the +/-HH:MM is always optional.  The fractional** seconds extension (the ".FFF") is optional.  The seconds portion** (":SS.FFF") is option.  The year and date can be omitted as long** as there is a time string.  The time string can be omitted as long** as there is a year and date.*/static int parseDateOrTime(  sqlite3_context *context,   const char *zDate,   DateTime *p){  double r;  if( parseYyyyMmDd(zDate,p)==0 ){    return 0;  }else if( parseHhMmSs(zDate, p)==0 ){    return 0;  }else if( sqlite3StrICmp(zDate,"now")==0){    return setDateTimeToCurrent(context, p);  }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){    p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);    p->validJD = 1;    return 0;  }  return 1;}
开发者ID:1018824313,项目名称:sqlite,代码行数:35,


示例22: sqlite3SchemaToIndex

/*** Convert the pStep->target token into a SrcList and return a pointer** to that SrcList.**** This routine adds a specific database name, if needed, to the target when** forming the SrcList.  This prevents a trigger in one database from** referring to a target in another database.  An exception is when the** trigger is in TEMP in which case it can refer to any other database it** wants.*/static SrcList *targetSrcList(  Parse *pParse,       /* The parsing context */  TriggerStep *pStep   /* The trigger containing the target token */){  Token sDb;           /* Dummy database name token */  int iDb;             /* Index of the database to use */  SrcList *pSrc;       /* SrcList to be returned */  iDb = sqlite3SchemaToIndex(pParse->db, pStep->pTrig->pSchema);  if( iDb==0 || iDb>=2 ){    assert( iDb<pParse->db->nDb );    sDb.z = (u8*)pParse->db->aDb[iDb].zName;    sDb.n = sqlite3Strlen30((char*)sDb.z);    pSrc = sqlite3SrcListAppend(pParse->db, 0, &sDb, &pStep->target);  } else {    pSrc = sqlite3SrcListAppend(pParse->db, 0, &pStep->target, 0);  }  return pSrc;}
开发者ID:erik-knudsen,项目名称:eCos-enhancements,代码行数:29,


示例23: sqlite3DecOrHexToI64

/*** Transform a UTF-8 integer literal, in either decimal or hexadecimal,** into a 64-bit signed integer.  This routine accepts hexadecimal literals,** whereas sqlite3Atoi64() does not.**** Returns:****     0    Successful transformation.  Fits in a 64-bit signed integer.**     1    Integer too large for a 64-bit signed integer or is malformed**     2    Special case of 9223372036854775808*/int sqlite3DecOrHexToI64(const char *z, i64 *pOut){#ifndef SQLITE_OMIT_HEX_INTEGER  if( z[0]=='0'   && (z[1]=='x' || z[1]=='X')   && sqlite3Isxdigit(z[2])  ){    u64 u = 0;    int i, k;    for(i=2; z[i]=='0'; i++){}    for(k=i; sqlite3Isxdigit(z[k]); k++){      u = u*16 + sqlite3HexToInt(z[k]);    }    memcpy(pOut, &u, 8);    return (z[k]==0 && k-i<=16) ? 0 : 1;  }else#endif /* SQLITE_OMIT_HEX_INTEGER */  {    return sqlite3Atoi64(z, pOut, sqlite3Strlen30(z), SQLITE_UTF8);  }}
开发者ID:whr4935,项目名称:sqlite,代码行数:31,


示例24: 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,


示例25: sqlite3_compileoption_used

/*** Given the name of a compile-time option, return true if that option** was used and false if not.**** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix** is not required for a match.*/int sqlite3_compileoption_used(const char *zOptName){  int i, n;#if SQLITE_ENABLE_API_ARMOR  if( zOptName==0 ){    (void)SQLITE_MISUSE_BKPT;    return 0;  }#endif  if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;  n = sqlite3Strlen30(zOptName);  /* Since ArraySize(azCompileOpt) is normally in single digits, a  ** linear search is adequate.  No need for a binary search. */  for(i=0; i<ArraySize(azCompileOpt); i++){    if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0     && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0    ){      return 1;    }  }  return 0;}
开发者ID:blastmann,项目名称:wxSqlite3-WinRT-Project,代码行数:30,


示例26: sqlite3InsertBuiltinFuncs

/*** Insert a new FuncDef into a FuncDefHash hash table.*/void sqlite3InsertBuiltinFuncs(  FuncDef *aDef,      /* List of global functions to be inserted */  int nDef            /* Length of the apDef[] list */){  int i;  for(i=0; i<nDef; i++){    FuncDef *pOther;    const char *zName = aDef[i].zName;    int nName = sqlite3Strlen30(zName);    int h = (zName[0] + nName) % SQLITE_FUNC_HASH_SZ;    assert( zName[0]>='a' && zName[0]<='z' );    pOther = functionSearch(h, zName);    if( pOther ){      assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );      aDef[i].pNext = pOther->pNext;      pOther->pNext = &aDef[i];    }else{      aDef[i].pNext = 0;      aDef[i].u.pHash = sqlite3BuiltinFunctions.a[h];      sqlite3BuiltinFunctions.a[h] = &aDef[i];    }  }}
开发者ID:cznic,项目名称:cc,代码行数:26,


示例27: 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,


示例28: sqlite3Strlen30

/*** 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,          /* Database connection */  const char *zName,    /* Name of the collating sequence */  int create            /* Create a new entry if true */){  CollSeq *pColl;  int nName = sqlite3Strlen30(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 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 ){        db->mallocFailed = 1;        sqlite3DbFree(db, pDel);        pColl = 0;      }    }  }  return pColl;}
开发者ID:0xr0ot,项目名称:sqlcipher,代码行数:50,


示例29: 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,



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


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