/ Check-in [20c1e9ce]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Get the __hidden__ column mechanism working on views with INSTEAD OF triggers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | hidden-columns-in-tables
Files: files | file ages | folders
SHA1: 20c1e9ce75cc0b5f7456379f35a4fe24edd98088
User & Date: drh 2015-11-18 21:22:02
Context
2015-11-19
13:53
Only support the magic "__hidden__" column name prefix interpretation when compiled with SQLITE_ENABLE_HIDDEN_COLUMNS. Closed-Leaf check-in: 5490646b user: drh tags: hidden-columns-in-tables
2015-11-18
21:22
Get the __hidden__ column mechanism working on views with INSTEAD OF triggers. check-in: 20c1e9ce user: drh tags: hidden-columns-in-tables
20:59
Add tests for views to hidden.test. check-in: 27d4b6f5 user: dan tags: hidden-columns-in-tables
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

   829    829       /* Cannot have triggers on a virtual table. If it were possible,
   830    830       ** this block would have to account for hidden column.
   831    831       */
   832    832       assert( !IsVirtual(pTab) );
   833    833   
   834    834       /* Create the new column data
   835    835       */
   836         -    for(i=0; i<pTab->nCol; i++){
   837         -      if( pColumn==0 ){
   838         -        j = i;
   839         -      }else{
          836  +    for(i=j=0; i<pTab->nCol; i++){
          837  +      if( pColumn ){
   840    838           for(j=0; j<pColumn->nId; j++){
   841    839             if( pColumn->a[j].idx==i ) break;
   842    840           }
   843    841         }
   844         -      if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId) ){
          842  +      if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId)
          843  +            || (pColumn==0 && IsHiddenColumn(&pTab->aCol[i])) ){
   845    844           sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1);
   846    845         }else if( useTempTable ){
   847    846           sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i+1); 
   848    847         }else{
   849    848           assert( pSelect==0 ); /* Otherwise useTempTable is true */
   850    849           sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i+1);
   851    850         }
          851  +      if( pColumn==0 && !IsHiddenColumn(&pTab->aCol[i]) ) j++;
   852    852       }
   853    853   
   854    854       /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger,
   855    855       ** do not attempt any conversions before assembling the record.
   856    856       ** If this is a real table, attempt conversions as required by the
   857    857       ** table column affinities.
   858    858       */