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

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

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

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

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

示例1: sqliteMalloc

ExprList *sqliteExprListDup(ExprList *p){  ExprList *pNew;  struct ExprList_item *pItem;  int i;  if( p==0 ) return 0;  pNew = sqliteMalloc( sizeof(*pNew) );  if( pNew==0 ) return 0;  pNew->nExpr = pNew->nAlloc = p->nExpr;  pNew->a = pItem = sqliteMalloc( p->nExpr*sizeof(p->a[0]) );  for(i=0; pItem && i<p->nExpr; i++, pItem++){    Expr *pNewExpr, *pOldExpr;    pItem->pExpr = pNewExpr = sqliteExprDup(pOldExpr = p->a[i].pExpr);    if( pOldExpr->span.z!=0 && pNewExpr ){      /* Always make a copy of the span for top-level expressions in the      ** expression list.  The logic in SELECT processing that determines      ** the names of columns in the result set needs this information */      sqliteTokenCopy(&pNewExpr->span, &pOldExpr->span);    }    assert( pNewExpr==0 || pNewExpr->span.z!=0             || pOldExpr->span.z==0 || sqlite_malloc_failed );    pItem->zName = sqliteStrDup(p->a[i].zName);    pItem->sortOrder = p->a[i].sortOrder;    pItem->isAgg = p->a[i].isAgg;    pItem->done = 0;  }  return pNew;}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:27,


示例2: quoteFunc

/*** EXPERIMENTAL - This is not an official function.  The interface may** change.  This function may disappear.  Do not write code that depends** on this function.**** Implementation of the QUOTE() function.  This function takes a single** argument.  If the argument is numeric, the return value is the same as** the argument.  If the argument is NULL, the return value is the string** "NULL".  Otherwise, the argument is enclosed in single quotes with** single-quote escapes.*/static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv) {    if( argc<1 ) return;    switch( sqlite3_value_type(argv[0]) ) {    case SQLITE_NULL: {        sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC);        break;    }    case SQLITE_INTEGER:    case SQLITE_FLOAT: {        sqlite3_result_value(context, argv[0]);        break;    }    case SQLITE_BLOB: {        char *zText = 0;        int nBlob = sqlite3_value_bytes(argv[0]);        char const *zBlob = sqlite3_value_blob(argv[0]);        zText = (char *)sqliteMalloc((2*nBlob)+4);        if( !zText ) {            sqlite3_result_error(context, "out of memory", -1);        } else {            int i;            for(i=0; i<nBlob; i++) {                zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];                zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];            }            zText[(nBlob*2)+2] = '/'';            zText[(nBlob*2)+3] = '/0';            zText[0] = 'X';            zText[1] = '/'';            sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);            sqliteFree(zText);        }        break;    }    case SQLITE_TEXT: {        int i,j,n;        const unsigned char *zArg = sqlite3_value_text(argv[0]);        char *z;        for(i=n=0; zArg[i]; i++) {            if( zArg[i]=='/'' ) n++;        }        z = sqliteMalloc( i+n+3 );        if( z==0 ) return;        z[0] = '/'';        for(i=0, j=1; zArg[i]; i++) {            z[j++] = zArg[i];            if( zArg[i]=='/'' ) {                z[j++] = '/'';            }        }        z[j++] = '/'';        z[j] = 0;        sqlite3_result_text(context, z, j, SQLITE_TRANSIENT);        sqliteFree(z);    }    }}
开发者ID:rock6tsai,项目名称:nebula3,代码行数:70,


示例3: sqlite3VdbeMemNulTerminate

/*** Make sure the given Mem is /u0000 terminated.*/int sqlite3VdbeMemNulTerminate(Mem *pMem) {    /* In SQLite, a string without a nul terminator occurs when a string    ** is loaded from disk (in this case the memory management is ephemeral),    ** or when it is supplied by the user as a bound variable or function    ** return value. Therefore, the memory management of the string must be    ** either ephemeral, static or controlled by a user-supplied destructor.    */    assert(        !(pMem->flags&MEM_Str) ||                /* it's not a string, or      */        (pMem->flags&MEM_Term) ||                /* it's nul term. already, or */        (pMem->flags&(MEM_Ephem|MEM_Static)) ||  /* it's static or ephem, or   */        (pMem->flags&MEM_Dyn && pMem->xDel)      /* external management        */    );    if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ) {        return SQLITE_OK;   /* Nothing to do */    }    if( pMem->flags & (MEM_Static|MEM_Ephem) ) {        return sqlite3VdbeMemMakeWriteable(pMem);    } else {        char *z = sqliteMalloc(pMem->n+2);        if( !z ) return SQLITE_NOMEM;        memcpy(z, pMem->z, pMem->n);        z[pMem->n] = 0;        z[pMem->n+1] = 0;        pMem->xDel(pMem->z);        pMem->xDel = 0;        pMem->z = z;    }    return SQLITE_OK;}
开发者ID:kanbang,项目名称:Colt,代码行数:34,


示例4: sqliteMalloc

/*** Add a new element to the end of a statement list.  If pList is** initially NULL, then create a new statement list.*/StmtList *sqliteStmtListAppend(StmtList *pList, Stmt *pStmt){  if( pList==0 ){    pList = sqliteMalloc( sizeof(StmtList) );    if( pList==0 ){      /* sqliteStmtDelete(pExpr); // Leak memory if malloc fails */      return 0;    }    assert( pList->nAlloc==0 );  }  if( pList->nAlloc<=pList->nStmt ){    pList->nAlloc = pList->nAlloc*2 + 4;    pList->a = sqliteRealloc(pList->a, pList->nAlloc*sizeof(pList->a[0]));    if( pList->a==0 ){      /* sqliteStmtDelete(pExpr); // Leak memory if malloc fails */      pList->nStmt = pList->nAlloc = 0;      return pList;    }  }  assert( pList->a!=0 );  if( pStmt ){    struct StmtList_item *pItem = &pList->a[pList->nStmt++];    memset(pItem, 0, sizeof(*pItem));    pItem->pStmt = pStmt;  }  return pList;}
开发者ID:araymund,项目名称:sqlite-2.8.17-proc,代码行数:30,


示例5: algorithm

/*** The parser calls this routine when it sees a SQL statement inside the** body of a block*/Stmt *sqliteSQLStmt(  int op,			        /* One of TK_SELECT, TK_INSERT, TK_UPDATE, TK_DELETE */  Token *pTableName,  /* Name of the table into which we insert */  IdList *pColumn,    /* List of columns in pTableName to insert into */  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */  Select *pSelect,    /* A SELECT statement that supplies values */  Expr *pWhere,       /* The WHERE clause */  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */){  Stmt *pNew;  pNew = sqliteMalloc( sizeof(Stmt)+sizeof(SQLStmt) );  if( pNew==0 ){    /* When malloc fails, we leak memory */    return 0;  }  pNew->pSql = (SQLStmt*) (pNew+1);  pNew->op = TK_SQL;  pNew->pSql->op		  = op;  pNew->pSql->pSelect   = pSelect;  if( pTableName ) {    pNew->pSql->target    = *pTableName;  }  pNew->pSql->pIdList   = pColumn;  pNew->pSql->pExprList = pEList;  pNew->pSql->pWhere    = pWhere;  pNew->pSql->orconf	  = orconf;  return pNew;}
开发者ID:araymund,项目名称:sqlite-2.8.17-proc,代码行数:35,


示例6: findCollSeqEntry

/*** 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:DSD-TELCEL-ESCOM,项目名称:INE-Votation-Distributed-System,代码行数:47,


示例7: quoteFunc

/*** EXPERIMENTAL - This is not an official function.  The interface may** change.  This function may disappear.  Do not write code that depends** on this function.**** Implementation of the QUOTE() function.  This function takes a single** argument.  If the argument is numeric, the return value is the same as** the argument.  If the argument is NULL, the return value is the string** "NULL".  Otherwise, the argument is enclosed in single quotes with** single-quote escapes.*/static void quoteFunc(sqlite_func *context, int argc, const char **argv){  if( argc<1 ) return;  if( argv[0]==0 ){    sqlite_set_result_string(context, "NULL", 4);  }else if( sqliteIsNumber(argv[0]) ){    sqlite_set_result_string(context, argv[0], -1);  }else{    int i,j,n;    char *z;    for(i=n=0; argv[0][i]; i++){ if( argv[0][i]=='/'' ) n++; }    z = sqliteMalloc( i+n+3 );    if( z==0 ) return;    z[0] = '/'';    for(i=0, j=1; argv[0][i]; i++){      z[j++] = argv[0][i];      if( argv[0][i]=='/'' ){        z[j++] = '/'';      }    }    z[j++] = '/'';    z[j] = 0;    sqlite_set_result_string(context, z, j);    sqliteFree(z);  }}
开发者ID:82488059,项目名称:csaori,代码行数:36,


示例8: minmaxStep

/*** Routines to implement min() and max() aggregate functions.*/static void minmaxStep(sqlite_func *context, int argc, const char **argv){  MinMaxCtx *p;  int (*xCompare)(const char*, const char*);  int mask;    /* 0 for min() or 0xffffffff for max() */  assert( argc==2 );  if( argv[0]==0 ) return;  /* Ignore NULL values */  if( argv[1][0]=='n' ){    xCompare = sqliteCompare;  }else{    xCompare = strcmp;  }  mask = (int)sqlite_user_data(context);  assert( mask==0 || mask==-1 );  p = sqlite_aggregate_context(context, sizeof(*p));  if( p==0 || argc<1 ) return;  if( p->z==0 || (xCompare(argv[0],p->z)^mask)<0 ){    int len;    if( p->zBuf[0] ){      sqliteFree(p->z);    }    len = strlen(argv[0]);    if( len < sizeof(p->zBuf)-1 ){      p->z = &p->zBuf[1];      p->zBuf[0] = 0;    }else{      p->z = sqliteMalloc( len+1 );      p->zBuf[0] = 1;      if( p->z==0 ) return;    }    strcpy(p->z, argv[0]);  }}
开发者ID:82488059,项目名称:csaori,代码行数:36,


示例9: sqlite_bind

/*** Set the values of all variables.  Variable $1 in the original SQL will** be the string azValue[0].  $2 will have the value azValue[1].  And** so forth.  If a value is out of range (for example $3 when nValue==2)** then its value will be NULL.**** This routine overrides any prior call.*/int sqlite_bind(sqlite_vm *pVm, int i, const char *zVal, int len, int copy){  Vdbe *p = (Vdbe*)pVm;  if( p->magic!=VDBE_MAGIC_RUN || p->pc!=0 ){    return SQLITE_MISUSE;  }  if( i<1 || i>p->nVar ){    return SQLITE_RANGE;  }  i--;  if( p->abVar[i] ){    sqliteFree(p->azVar[i]);  }  if( zVal==0 ){    copy = 0;    len = 0;  }  if( len<0 ){    len = strlen(zVal)+1;  }  if( copy ){    p->azVar[i] = sqliteMalloc( len );    if( p->azVar[i] ) memcpy(p->azVar[i], zVal, len);  }else{    p->azVar[i] = (char*)zVal;  }  p->abVar[i] = copy;  p->anVar[i] = len;  return SQLITE_OK;}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:37,


示例10: algorithm

/*** Build a trigger step out of an INSERT statement.  Return a pointer** to the new trigger step.**** The parser calls this routine when it sees an INSERT inside the** body of a trigger.*/TriggerStep *sqlite3TriggerInsertStep(  Token *pTableName,  /* Name of the table into which we insert */  IdList *pColumn,    /* List of columns in pTableName to insert into */  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */  Select *pSelect,    /* A SELECT statement that supplies values */  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  assert(pEList == 0 || pSelect == 0);  assert(pEList != 0 || pSelect != 0);  if( pTriggerStep ){    pTriggerStep->op = TK_INSERT;    pTriggerStep->pSelect = pSelect;    pTriggerStep->target  = *pTableName;    pTriggerStep->pIdList = pColumn;    pTriggerStep->pExprList = pEList;    pTriggerStep->orconf = orconf;    sqlitePersistTriggerStep(pTriggerStep);  }else{    sqlite3IdListDelete(pColumn);    sqlite3ExprListDelete(pEList);    sqlite3SelectDup(pSelect);  }  return pTriggerStep;}
开发者ID:Matrix0xCC,项目名称:lemon,代码行数:35,


示例11: sqliteRbtreeOpen

int sqliteRbtreeOpen(  const char *zFilename,  int mode,  int nPg,  Btree **ppBtree){  Rbtree **ppRbtree = (Rbtree**)ppBtree;  *ppRbtree = (Rbtree *)sqliteMalloc(sizeof(Rbtree));  if( sqlite_malloc_failed ) goto open_no_mem;  sqliteHashInit(&(*ppRbtree)->tblHash, SQLITE_HASH_INT, 0);  /* Create a binary tree for the SQLITE_MASTER table at location 2 */  btreeCreateTable(*ppRbtree, 2);  if( sqlite_malloc_failed ) goto open_no_mem;  (*ppRbtree)->next_idx = 3;  (*ppRbtree)->pOps = &sqliteRbtreeOps;  /* Set file type to 4; this is so that "attach ':memory:' as ...."  does not  ** think that the database in uninitialised and refuse to attach  */  (*ppRbtree)->aMetaData[2] = 4;    return SQLITE_OK;open_no_mem:  *ppBtree = 0;  return SQLITE_NOMEM;}
开发者ID:NobleGaz,项目名称:PHP,代码行数:27,


示例12: while

/*** Locate a user function given a name and a number of arguments.** Return a pointer to the FuncDef structure that defines that** function, or return NULL if the function does not exist.**** If the createFlag argument is true, then a new (blank) FuncDef** structure is created and liked into the "db" structure if a** no matching function previously existed.  When createFlag is true** and the nArg parameter is -1, then only a function that accepts** any number of arguments will be returned.**** If createFlag is false and nArg is -1, then the first valid** function found is returned.  A function is valid if either xFunc** or xStep is non-zero.*/FuncDef *sqliteFindFunction(  sqlite *db,        /* An open database */  const char *zName, /* Name of the function.  Not null-terminated */  int nName,         /* Number of characters in the name */  int nArg,          /* Number of arguments.  -1 means any number */  int createFlag     /* Create new entry if true and does not otherwise exist */){  FuncDef *pFirst, *p, *pMaybe;  pFirst = p = (FuncDef*)sqliteHashFind(&db->aFunc, zName, nName);  if( p && !createFlag && nArg<0 ){    while( p && p->xFunc==0 && p->xStep==0 ){ p = p->pNext; }    return p;  }  pMaybe = 0;  while( p && p->nArg!=nArg ){    if( p->nArg<0 && !createFlag && (p->xFunc || p->xStep) ) pMaybe = p;    p = p->pNext;  }  if( p && !createFlag && p->xFunc==0 && p->xStep==0 ){    return 0;  }  if( p==0 && pMaybe ){    assert( createFlag==0 );    return pMaybe;  }  if( p==0 && createFlag && (p = sqliteMalloc(sizeof(*p)))!=0 ){    p->nArg = nArg;    p->pNext = pFirst;    p->dataType = pFirst ? pFirst->dataType : SQLITE_NUMERIC;    sqliteHashInsert(&db->aFunc, zName, nName, (void*)p);  }  return p;}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:48,


示例13: test_destructor

static void test_destructor(  sqlite3_context *pCtx,   int nArg,  sqlite3_value **argv){  char *zVal;  int len;  sqlite3 *db = sqlite3_user_data(pCtx);   test_destructor_count_var++;  assert( nArg==1 );  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;  len = sqlite3ValueBytes(argv[0], ENC(db));   zVal = sqliteMalloc(len+3);  zVal[len] = 0;  zVal[len-1] = 0;  assert( zVal );  zVal++;  memcpy(zVal, sqlite3ValueText(argv[0], ENC(db)), len);  if( ENC(db)==SQLITE_UTF8 ){    sqlite3_result_text(pCtx, zVal, -1, destructor);#ifndef SQLITE_OMIT_UTF16  }else if( ENC(db)==SQLITE_UTF16LE ){    sqlite3_result_text16le(pCtx, zVal, -1, destructor);  }else{    sqlite3_result_text16be(pCtx, zVal, -1, destructor);#endif /* SQLITE_OMIT_UTF16 */  }}
开发者ID:f059074251,项目名称:interested,代码行数:29,


示例14: test_auxdata

static void test_auxdata(  sqlite3_context *pCtx,   int nArg,  sqlite3_value **argv){  int i;  char *zRet = sqliteMalloc(nArg*2);  if( !zRet ) return;  for(i=0; i<nArg; i++){    char const *z = (char*)sqlite3_value_text(argv[i]);    if( z ){      char *zAux = sqlite3_get_auxdata(pCtx, i);      if( zAux ){        zRet[i*2] = '1';        if( strcmp(zAux, z) ){          sqlite3_result_error(pCtx, "Auxilary data corruption", -1);          return;        }      }else{        zRet[i*2] = '0';        zAux = sqliteStrDup(z);        sqlite3_set_auxdata(pCtx, i, zAux, free_test_auxdata);      }      zRet[i*2+1] = ' ';    }  }  sqlite3_result_text(pCtx, zRet, 2*nArg-1, free_test_auxdata);}
开发者ID:f059074251,项目名称:interested,代码行数:28,


示例15: cacheBlock

/*** Load block 'blk' into the cache of pFile.*/static int cacheBlock(OsTestFile *pFile, int blk){  if( blk>=pFile->nBlk ){    int n = ((pFile->nBlk * 2) + 100 + blk);    /* if( pFile->nBlk==0 ){ printf("DIRTY %s/n", pFile->zName); } */    pFile->apBlk = (u8 **)sqliteRealloc(pFile->apBlk, n * sizeof(u8*));    if( !pFile->apBlk ) return SQLITE_NOMEM;    memset(&pFile->apBlk[pFile->nBlk], 0, (n - pFile->nBlk)*sizeof(u8*));    pFile->nBlk = n;  }  if( !pFile->apBlk[blk] ){    i64 filesize;    int rc;    u8 *p = sqliteMalloc(BLOCKSIZE);    if( !p ) return SQLITE_NOMEM;    pFile->apBlk[blk] = p;    rc = sqlite3RealFileSize(&pFile->fd, &filesize);    if( rc!=SQLITE_OK ) return rc;    if( BLOCK_OFFSET(blk)<filesize ){      int len = BLOCKSIZE;      rc = sqlite3RealSeek(&pFile->fd, blk*BLOCKSIZE);      if( BLOCK_OFFSET(blk+1)>filesize ){        len = filesize - BLOCK_OFFSET(blk);      }      if( rc!=SQLITE_OK ) return rc;      rc = sqlite3RealRead(&pFile->fd, p, len);      if( rc!=SQLITE_OK ) return rc;    }  }  return SQLITE_OK;}
开发者ID:DSD-TELCEL-ESCOM,项目名称:INE-Votation-Distributed-System,代码行数:38,


示例16: sqlite3ValueNew

/*** Create a new sqlite3_value object.*/sqlite3_value* sqlite3ValueNew() {    Mem *p = sqliteMalloc(sizeof(*p));    if( p ) {        p->flags = MEM_Null;        p->type = SQLITE_NULL;    }    return p;}
开发者ID:kanbang,项目名称:Colt,代码行数:11,


示例17: 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(  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 (*xFunc)(sqlite3_context*,int,sqlite3_value**);  void *pArg;  FuncDef *pNew;  int rc;  char *zLowerName;  unsigned char *z;  /* Check to see the left operand is a column in a virtual table */  if( pExpr==0 ) return pDef;  if( pExpr->op!=TK_COLUMN ) return pDef;  pTab = pExpr->pTab;  if( pTab==0 ) return pDef;  if( !pTab->isVirtual ) return pDef;  pVtab = pTab->pVtab;  assert( pVtab!=0 );  assert( pVtab->pModule!=0 );  pMod = (sqlite3_module *)pVtab->pModule;  if( pMod->xFindFunction==0 ) return pDef;   /* Call the xFuncFunction method on the virtual table implementation  ** to see if the implementation wants to overload this function   */  zLowerName = sqlite3StrDup(pDef->zName);  for(z=(unsigned char*)zLowerName; *z; z++){    *z = sqlite3UpperToLower[*z];  }  rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg);  sqliteFree(zLowerName);  if( rc==0 ){    return pDef;  }  /* Create a new ephemeral function definition for the overloaded  ** function */  pNew = sqliteMalloc( sizeof(*pNew) + strlen(pDef->zName) );  if( pNew==0 ){    return pDef;  }  *pNew = *pDef;  strcpy(pNew->zName, pDef->zName);  pNew->xFunc = xFunc;  pNew->pUserData = pArg;  pNew->flags |= SQLITE_FUNC_EPHEM;  return pNew;}
开发者ID:Bracket-,项目名称:psp-ports,代码行数:67,


示例18: sqliteMalloc

/*** Turn a SELECT statement (that the pSelect parameter points to) into** a trigger step.  Return a pointer to a TriggerStep structure.**** The parser calls this routine when it finds a SELECT statement in** body of a TRIGGER.  */TriggerStep *sqlite3TriggerSelectStep(Select *pSelect){  TriggerStep *pTriggerStep = sqliteMalloc(sizeof(TriggerStep));  if( pTriggerStep==0 ) return 0;  pTriggerStep->op = TK_SELECT;  pTriggerStep->pSelect = pSelect;  pTriggerStep->orconf = OE_Default;  sqlitePersistTriggerStep(pTriggerStep);  return pTriggerStep;}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:18,


示例19: sqlite3VdbeSetNumCols

/*** Set the number of result columns that will be returned by this SQL** statement. This is now set at compile time, rather than during** execution of the vdbe program so that sqlite3_column_count() can** be called on an SQL statement before sqlite3_step().*/void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){  Mem *pColName;  int n;  assert( 0==p->nResColumn );  p->nResColumn = nResColumn;  n = nResColumn*2;  p->aColName = pColName = (Mem*)sqliteMalloc( sizeof(Mem)*n );  if( p->aColName==0 ) return;  while( n-- > 0 ){    (pColName++)->flags = MEM_Null;  }}
开发者ID:Shad000w,项目名称:NWNX2-windows,代码行数:18,


示例20: initFile

/*** Initialise the os_test.c specific fields of pFile.*/static void initFile(OsFile *id, char const *zName){  OsTestFile *pFile = (OsTestFile *)      sqliteMalloc(sizeof(OsTestFile) + strlen(zName)+1);  pFile->nMaxWrite = 0;   pFile->nBlk = 0;   pFile->apBlk = 0;   pFile->zName = (char *)(&pFile[1]);  strcpy(pFile->zName, zName);  *id = pFile;  pFile->pNext = pAllFiles;  pAllFiles = pFile;}
开发者ID:DSD-TELCEL-ESCOM,项目名称:INE-Votation-Distributed-System,代码行数:15,


示例21: assert

/*** Allocate or return the aggregate context for a user function.  A new** context is allocated on the first call.  Subsequent calls return the** same context that was returned on prior calls.**** This routine is defined here in vdbe.c because it depends on knowing** the internals of the sqlite_func structure which is only defined in** this source file.*/void *sqlite_aggregate_context(sqlite_func *p, int nByte){  assert( p && p->pFunc && p->pFunc->xStep );  if( p->pAgg==0 ){    if( nByte<=NBFS ){      p->pAgg = (void*)p->s.z;      memset(p->pAgg, 0, nByte);    }else{      p->pAgg = sqliteMalloc( nByte );    }  }  return p->pAgg;}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:21,


示例22: sqlite3DeleteNew

Delete* sqlite3DeleteNew(SrcList *pTabList, Expr *pWhere, Expr *pLimit, Expr *pOffset) {    Delete* pNew = NULL;    pNew = (Delete*) sqliteMalloc(sizeof(*pNew));    if (pNew == NULL) {        return NULL;    }    pNew->pTabList = pTabList;    pNew->pWhere = pWhere;    pNew->pLimit = pLimit;    pNew->pOffset = pOffset;    return pNew;}
开发者ID:rannger,项目名称:Matrix,代码行数:13,


示例23: lowerFunc

static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){  unsigned char *z;  int i;  if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;  z = sqliteMalloc(sqlite3_value_bytes(argv[0])+1);  if( z==0 ) return;  strcpy((char*)z, (char*)sqlite3_value_text(argv[0]));  for(i=0; z[i]; i++){    z[i] = tolower(z[i]);  }  sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);  sqliteFree(z);}
开发者ID:f059074251,项目名称:interested,代码行数:13,


示例24: sqliteMalloc

/*** Create a new virtual database engine.*/Vdbe *sqlite3VdbeCreate(sqlite3 *db){  Vdbe *p;  p = sqliteMalloc( sizeof(Vdbe) );  if( p==0 ) return 0;  p->db = db;  if( db->pVdbe ){    db->pVdbe->pPrev = p;  }  p->pNext = db->pVdbe;  p->pPrev = 0;  db->pVdbe = p;  p->magic = VDBE_MAGIC_INIT;  return p;}
开发者ID:Shad000w,项目名称:NWNX2-windows,代码行数:17,


示例25:

/*** Find and return the schema associated with a BTree.  Create** a new one if necessary.*/Schema *sqlite3SchemaGet(Btree *pBt){  Schema * p;  if( pBt ){    p = (Schema *)sqlite3BtreeSchema(pBt,sizeof(Schema),sqlite3SchemaFree);  }else{    p = (Schema *)sqliteMalloc(sizeof(Schema));  }  if( p && 0==p->file_format ){    sqlite3HashInit(&p->tblHash, SQLITE_HASH_STRING, 0);    sqlite3HashInit(&p->idxHash, SQLITE_HASH_STRING, 0);    sqlite3HashInit(&p->trigHash, SQLITE_HASH_STRING, 0);    sqlite3HashInit(&p->aFKey, SQLITE_HASH_STRING, 1);  }  return p;}
开发者ID:DrEastex,项目名称:Platinum,代码行数:19,


示例26: sqliteMalloc

/*** Resize a prior allocation.  If p==0, then this routine** works just like sqliteMalloc().  If n==0, then this routine** works just like sqliteFree().*/void *sqlite3Realloc(void *p, int n){  void *p2;  if( p==0 ){    return sqliteMalloc(n);  }  if( n==0 ){    sqliteFree(p);    return 0;  }  p2 = realloc(p, n);  if( p2==0 ){    if( n>0 ) sqlite3_malloc_failed++;  }  return p2;}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:20,



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


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