** 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. */
| 10987 | ** zIn before returning. |
| 10988 | */ |
| 10989 | static 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 |
no outgoing calls
no test coverage detected