/ Check-in [2dbffb3a]
Login

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

Overview
Comment:If a table column name begins with "__hidden__" then do not include that column in "*" expansions in SELECT statements, nor fill in that column in an INSERT INTO that omits the column list. This branch is a proof-of-concept only and is not intended to ever be merged into trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | hidden-columns-in-tables
Files: files | file ages | folders
SHA1: 2dbffb3a3b20dba7d7d86c8ad2e34633f616c78a
User & Date: drh 2015-11-18 18:43:15
Original Comment: If a table column name begins with "__hidden__" then do not include that column in "*" expansions in SELECT statements, nor fill in that column in an INSERT INTO that omits the column list. This branch is a proof-of-concept only and is not intended to ever be merged into trunk.
Context
2015-11-18
20:07
Add a test for the __hidden__ hack on this branch. check-in: ebf4bbff user: dan tags: hidden-columns-in-tables
18:43
If a table column name begins with "__hidden__" then do not include that column in "*" expansions in SELECT statements, nor fill in that column in an INSERT INTO that omits the column list. This branch is a proof-of-concept only and is not intended to ever be merged into trunk. check-in: 2dbffb3a user: drh tags: hidden-columns-in-tables
2015-11-17
21:42
When using mmap mode on Win32, use a read-only mapping by default. Write to the database file using WriteFile(). Unless SQLITE_MMAP_READWRITE is defined, in which case use a read/write mapping and write into the file using memcpy(). check-in: 4f521b5b user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  1100   1100         return;
  1101   1101       }
  1102   1102       p->aCol = aNew;
  1103   1103     }
  1104   1104     pCol = &p->aCol[p->nCol];
  1105   1105     memset(pCol, 0, sizeof(p->aCol[0]));
  1106   1106     pCol->zName = z;
         1107  +  if( sqlite3_strnicmp(z, "__hidden__", 10)==0 ){
         1108  +    pCol->colFlags |= COLFLAG_HIDDEN;
         1109  +  }
  1107   1110    
  1108   1111     /* If there is no type specified, columns have the default affinity
  1109   1112     ** 'BLOB'. If there is a type specified, then sqlite3AddColumnType() will
  1110   1113     ** be called next to set pCol->affinity correctly.
  1111   1114     */
  1112   1115     pCol->affinity = SQLITE_AFF_BLOB;
  1113   1116     pCol->szEst = 1;

Changes to src/insert.c.

   732    732     if( pColumn==0 && nColumn>0 ){
   733    733       ipkColumn = pTab->iPKey;
   734    734     }
   735    735   
   736    736     /* Make sure the number of columns in the source data matches the number
   737    737     ** of columns to be inserted into the table.
   738    738     */
   739         -  if( IsVirtual(pTab) ){
   740         -    for(i=0; i<pTab->nCol; i++){
   741         -      nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);
   742         -    }
          739  +  for(i=0; i<pTab->nCol; i++){
          740  +    nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);
   743    741     }
   744    742     if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
   745    743       sqlite3ErrorMsg(pParse, 
   746    744          "table %S has %d columns but %d values were supplied",
   747    745          pTabList, 0, pTab->nCol-nHidden, nColumn);
   748    746       goto insert_cleanup;
   749    747     }
................................................................................
   930    928           ** taking up data space with information that will never be used.
   931    929           ** As there may be shallow copies of this value, make it a soft-NULL */
   932    930           sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore);
   933    931           continue;
   934    932         }
   935    933         if( pColumn==0 ){
   936    934           if( IsHiddenColumn(&pTab->aCol[i]) ){
   937         -          assert( IsVirtual(pTab) );
          935  +          assert( IsVirtual(pTab)
          936  +                || sqlite3_strnicmp(pTab->aCol[i].zName,"__hidden__",10)==0 );
   938    937             j = -1;
   939    938             nHidden++;
   940    939           }else{
   941    940             j = i - nHidden;
   942    941           }
   943    942         }else{
   944    943           for(j=0; j<pColumn->nId; j++){

Changes to src/select.c.

  4361   4361               }
  4362   4362   
  4363   4363               /* If a column is marked as 'hidden' (currently only possible
  4364   4364               ** for virtual tables), do not include it in the expanded
  4365   4365               ** result-set list.
  4366   4366               */
  4367   4367               if( IsHiddenColumn(&pTab->aCol[j]) ){
  4368         -              assert(IsVirtual(pTab));
         4368  +              assert( IsVirtual(pTab)
         4369  +               || sqlite3_strnicmp(pTab->aCol[j].zName,"__hidden__", 10)==0 );
  4369   4370                 continue;
  4370   4371               }
  4371   4372               tableSeen = 1;
  4372   4373   
  4373   4374               if( i>0 && zTName==0 ){
  4374   4375                 if( (pFrom->fg.jointype & JT_NATURAL)!=0
  4375   4376                   && tableAndColumnIndex(pTabList, i, zName, 0, 0)