** This function appends an index column definition suitable for constraint ** pCons to the string passed as zIn and returns the result. */
| 9180 | ** pCons to the string passed as zIn and returns the result. |
| 9181 | */ |
| 9182 | static char *idxAppendColDefn( |
| 9183 | int *pRc, /* IN/OUT: Error code */ |
| 9184 | char *zIn, /* Column defn accumulated so far */ |
| 9185 | IdxTable *pTab, /* Table index will be created on */ |
| 9186 | IdxConstraint *pCons |
| 9187 | ){ |
| 9188 | char *zRet = zIn; |
| 9189 | IdxColumn *p = &pTab->aCol[pCons->iCol]; |
| 9190 | if( zRet ) zRet = idxAppendText(pRc, zRet, ", "); |
| 9191 | |
| 9192 | if( idxIdentifierRequiresQuotes(p->zName) ){ |
| 9193 | zRet = idxAppendText(pRc, zRet, "%Q", p->zName); |
| 9194 | }else{ |
| 9195 | zRet = idxAppendText(pRc, zRet, "%s", p->zName); |
| 9196 | } |
| 9197 | |
| 9198 | if( sqlite3_stricmp(p->zColl, pCons->zColl) ){ |
| 9199 | if( idxIdentifierRequiresQuotes(pCons->zColl) ){ |
| 9200 | zRet = idxAppendText(pRc, zRet, " COLLATE %Q", pCons->zColl); |
| 9201 | }else{ |
| 9202 | zRet = idxAppendText(pRc, zRet, " COLLATE %s", pCons->zColl); |
| 9203 | } |
| 9204 | } |
| 9205 | |
| 9206 | if( pCons->bDesc ){ |
| 9207 | zRet = idxAppendText(pRc, zRet, " DESC"); |
| 9208 | } |
| 9209 | return zRet; |
| 9210 | } |
| 9211 | |
| 9212 | /* |
| 9213 | ** Search database dbm for an index compatible with the one idxCreateFromCons() |
no test coverage detected