SQLite Forum

Rename Column structure elements bug
Login

Rename Column structure elements bug

(1) By Keith Medcalf (kmedcalf) on 2021-08-03 22:05:37 [source]

The following change needs to be applied to delete.c when SQLITE_ENABLE_UPDATE_DELETE_LIMIT is defined in order to access the renamed attributes.

Index: src/delete.c
==================================================================
--- src/delete.c
+++ src/delete.c
@@ -186,17 +186,17 @@
         pParse, 0, sqlite3PExpr(pParse, TK_ROW, 0, 0)
     );
   }else{
     Index *pPk = sqlite3PrimaryKeyIndex(pTab);
     if( pPk->nKeyCol==1 ){
-      const char *zName = pTab->aCol[pPk->aiColumn[0]].zName;
+      const char *zName = pTab->aCol[pPk->aiColumn[0]].zCnName;
       pLhs = sqlite3Expr(db, TK_ID, zName);
       pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, zName));
     }else{
       int i;
       for(i=0; i<pPk->nKeyCol; i++){
-        Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zName);
+        Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zCnName);
         pEList = sqlite3ExprListAppend(pParse, pEList, p);
       }
       pLhs = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
       if( pLhs ){
         pLhs->x.pList = sqlite3ExprListDup(db, pEList, 0);
tsrc/delete.c(191): error C2039: 'zName': is not a member of 'Column'
tsrc/sqliteInt.h(2032): note: see declaration of 'Column'
tsrc/delete.c(197): error C2039: 'zName': is not a member of 'Column'
tsrc/sqliteInt.h(2032): note: see declaration of 'Column'