MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / idxAppendText

Function idxAppendText

modules/dasSQLITE/sqlite/shell.c:10989–11015  ·  view source on GitHub ↗

** This function is a no-op if *pRc is set to anything other than ** SQLITE_OK when it is called. ** ** If *pRc is initially set to SQLITE_OK, then the text specified by ** the printf() style arguments is appended to zIn and the result returned ** in a buffer allocated by sqlite3_malloc(). sqlite3_free() is called on ** zIn before returning. */

Source from the content-addressed store, hash-verified

10987** zIn before returning.
10988*/
10989static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){
10990 va_list ap;
10991 char *zAppend = 0;
10992 char *zRet = 0;
10993 int nIn = zIn ? STRLEN(zIn) : 0;
10994 int nAppend = 0;
10995 va_start(ap, zFmt);
10996 if( *pRc==SQLITE_OK ){
10997 zAppend = sqlite3_vmprintf(zFmt, ap);
10998 if( zAppend ){
10999 nAppend = STRLEN(zAppend);
11000 zRet = (char*)sqlite3_malloc(nIn + nAppend + 1);
11001 }
11002 if( zAppend && zRet ){
11003 if( nIn ) memcpy(zRet, zIn, nIn);
11004 memcpy(&zRet[nIn], zAppend, nAppend+1);
11005 }else{
11006 sqlite3_free(zRet);
11007 zRet = 0;
11008 *pRc = SQLITE_NOMEM;
11009 }
11010 sqlite3_free(zAppend);
11011 sqlite3_free(zIn);
11012 }
11013 va_end(ap);
11014 return zRet;
11015}
11016
11017/*
11018** Return true if zId must be quoted in order to use it as an SQL

Callers 6

idxAppendColDefnFunction · 0.85
idxFindIndexesFunction · 0.85
idxProcessOneTriggerFunction · 0.85
idxCreateVtabSchemaFunction · 0.85
idxPopulateOneStat1Function · 0.85
sqlite3_expert_analyzeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected