** 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. */
| 9130 | ** zIn before returning. |
| 9131 | */ |
| 9132 | static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){ |
| 9133 | va_list ap; |
| 9134 | char *zAppend = 0; |
| 9135 | char *zRet = 0; |
| 9136 | int nIn = zIn ? STRLEN(zIn) : 0; |
| 9137 | int nAppend = 0; |
| 9138 | va_start(ap, zFmt); |
| 9139 | if( *pRc==SQLITE_OK ){ |
| 9140 | zAppend = sqlite3_vmprintf(zFmt, ap); |
| 9141 | if( zAppend ){ |
| 9142 | nAppend = STRLEN(zAppend); |
| 9143 | zRet = (char*)sqlite3_malloc(nIn + nAppend + 1); |
| 9144 | } |
| 9145 | if( zAppend && zRet ){ |
| 9146 | if( nIn ) memcpy(zRet, zIn, nIn); |
| 9147 | memcpy(&zRet[nIn], zAppend, nAppend+1); |
| 9148 | }else{ |
| 9149 | sqlite3_free(zRet); |
| 9150 | zRet = 0; |
| 9151 | *pRc = SQLITE_NOMEM; |
| 9152 | } |
| 9153 | sqlite3_free(zAppend); |
| 9154 | sqlite3_free(zIn); |
| 9155 | } |
| 9156 | va_end(ap); |
| 9157 | return zRet; |
| 9158 | } |
| 9159 | |
| 9160 | /* |
| 9161 | ** Return true if zId must be quoted in order to use it as an SQL |
no outgoing calls
no test coverage detected