Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the name of Column.isPrimKey to Column.iPrimKey, make it a u16, and make it hold the integer column number of the column within the primary key. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6d33ce14cd9cb4e06e2b913ecca83cfd |
User & Date: | drh 2013-07-29 20:26:45.753 |
Context
2013-07-30
| ||
01:30 | Combine the OP_IdxInsert, OP_SorterInsert, and OP_Insert opcodes into the single OP_Insert opcode. check-in: 3b7caafe8c user: drh tags: trunk | |
2013-07-29
| ||
20:26 | Change the name of Column.isPrimKey to Column.iPrimKey, make it a u16, and make it hold the integer column number of the column within the primary key. check-in: 6d33ce14cd user: drh tags: trunk | |
19:31 | Remove the unused OP_InsertInt opcode from the VDBE. check-in: 3e371e1a44 user: drh tags: trunk | |
Changes
Changes to src/alter.c.
︙ | ︙ | |||
635 636 637 638 639 640 641 | pDflt = 0; } /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. ** If there is a NOT NULL constraint, then the default value for the ** column must not be NULL. */ | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | pDflt = 0; } /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. ** If there is a NOT NULL constraint, then the default value for the ** column must not be NULL. */ if( pCol->iPrimKey>0 ){ sqlite4ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); return; } if( pNew->pIndex ){ sqlite4ErrorMsg(pParse, "Cannot add a UNIQUE column"); return; } |
︙ | ︙ |
Changes to src/build.c.
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | sqlite4ErrorMsg(pParse, "table \"%s\" has more than one primary key", pTab->zName); goto primary_key_exit; } pTab->tabFlags |= TF_HasPrimaryKey; if( pList==0 ){ iCol = pTab->nCol - 1; | | | | 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | sqlite4ErrorMsg(pParse, "table \"%s\" has more than one primary key", pTab->zName); goto primary_key_exit; } pTab->tabFlags |= TF_HasPrimaryKey; if( pList==0 ){ iCol = pTab->nCol - 1; pTab->aCol[iCol].iPrimKey = 1; pTab->aCol[iCol].notNull = 1; }else{ for(i=0; i<pList->nExpr; i++){ for(iCol=0; iCol<pTab->nCol; iCol++){ if( sqlite4_stricmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ break; } } if( iCol<pTab->nCol ){ pTab->aCol[iCol].iPrimKey = i+1; pTab->aCol[iCol].notNull = 1; } } if( pList->nExpr>1 ) iCol = -1; } pPk = sqlite4CreateIndex(pParse, 0, pList, 0, onError, 0, sortOrder, 1); |
︙ | ︙ |
Changes to src/fkey.c.
︙ | ︙ | |||
862 863 864 865 866 867 868 | /* Check if any parent key columns are being modified. */ for(p=sqlite4FkReferences(pTab); p; p=p->pNextTo){ for(i=0; i<p->nCol; i++){ char *zKey = p->aCol[i].zCol; int iKey; for(iKey=0; iKey<pTab->nCol; iKey++){ Column *pCol = &pTab->aCol[iKey]; | | | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | /* Check if any parent key columns are being modified. */ for(p=sqlite4FkReferences(pTab); p; p=p->pNextTo){ for(i=0; i<p->nCol; i++){ char *zKey = p->aCol[i].zCol; int iKey; for(iKey=0; iKey<pTab->nCol; iKey++){ Column *pCol = &pTab->aCol[iKey]; if( (zKey ? !sqlite4_stricmp(pCol->zName,zKey) : pCol->iPrimKey>0) ){ if( aChange[iKey]>=0 ) return 1; } } } } } } |
︙ | ︙ |
Changes to src/pragma.c.
︙ | ︙ | |||
368 369 370 371 372 373 374 | pCol->zType ? pCol->zType : "", 0); sqlite4VdbeAddOp2(v, OP_Integer, (pCol->notNull ? 1 : 0), 4); if( pCol->zDflt ){ sqlite4VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); }else{ sqlite4VdbeAddOp2(v, OP_Null, 0, 5); } | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | pCol->zType ? pCol->zType : "", 0); sqlite4VdbeAddOp2(v, OP_Integer, (pCol->notNull ? 1 : 0), 4); if( pCol->zDflt ){ sqlite4VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); }else{ sqlite4VdbeAddOp2(v, OP_Null, 0, 5); } sqlite4VdbeAddOp2(v, OP_Integer, pCol->iPrimKey, 6); sqlite4VdbeAddOp2(v, OP_ResultRow, 1, 6); } } }else if( sqlite4_stricmp(zPragma, "index_info")==0 && zRight ){ Index *pIdx; |
︙ | ︙ |
Changes to src/sqliteInt.h.
︙ | ︙ | |||
1038 1039 1040 1041 1042 1043 1044 1045 | */ struct Column { char *zName; /* Name of this column */ Expr *pDflt; /* Default value of this column */ char *zDflt; /* Original text of the default value */ char *zType; /* Data type for this column */ char *zColl; /* Collating sequence. If NULL, use the default */ u8 notNull; /* True if there is a NOT NULL constraint */ | > < | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | */ struct Column { char *zName; /* Name of this column */ Expr *pDflt; /* Default value of this column */ char *zDflt; /* Original text of the default value */ char *zType; /* Data type for this column */ char *zColl; /* Collating sequence. If NULL, use the default */ u16 iPrimKey; /* Index of in the primary key. 0 if not part of PK */ u8 notNull; /* True if there is a NOT NULL constraint */ char affinity; /* One of the SQLITE4_AFF_... values */ #ifndef SQLITE4_OMIT_VIRTUALTABLE u8 isHidden; /* True if this column is 'hidden' */ #endif }; /* |
︙ | ︙ |