Compare commits

...

7 Commits

Author SHA1 Message Date
drh 3219cbf5d8 Omit an optimization that did not work - it runs faster with the
optimization removed.

FossilOrigin-Name: d67e28cb1bd62858aad3fd6dd6077486c93fe38099ff6d77a1da9a04348886e4
2025-02-13 23:33:47 +00:00
drh 28cfb15f31 Remove an unnecessary branch. Improvements to error messages.
FossilOrigin-Name: f49ddd80b1b75ceef47702dd753b603c06a7941f659f25eb9880e26a52893d43
2025-02-13 19:19:14 +00:00
drh 278e0bd290 Fix various problems. Appears to be working now.
FossilOrigin-Name: 7fd94f1378333e4700434c6d238ed564508466d40bce0d9a0e933bfe7796d933
2025-02-13 16:03:11 +00:00
drh a382057966 This version still does not work. This is an incremental check-in to save
my place so that I can work on other things.

FossilOrigin-Name: 2b73eb3fa7180b4a94b9d8837580eec13d411f1fc7ac4b80803cbc4dfaaead6a
2025-02-13 11:10:12 +00:00
drh 37189bd431 An attempt to allow the DEFAULT keyword in the VALUES clause of an INSERT.
This check-in does not work right.

FossilOrigin-Name: 85c108eb0ff8e47046ba6ec702accf46bd56dc077ada0afa3360ffa4fcdc0f34
2025-02-12 20:54:32 +00:00
drh 9429b59b0b Merge the latest trunk changes into the default-in-values branch.
FossilOrigin-Name: 480d7c1a1abb4b543bbc6ee37db82c5232c69d0abc2722c00e262e6c64c860ff
2025-02-12 18:22:36 +00:00
drh df3847e186 This is an experimental change to investigate the feasibility of allow
DEFAULT tokens within VALUES clauses attached to INSERT statements. There
is a lot of extra code space consumed for such an obscure feature.

FossilOrigin-Name: 2ff4129ea05c1cc5a0c58540c7de9cdd5831a808514d11ac5ba2d4a44ca20354
2025-02-06 21:14:27 +00:00
14 changed files with 216 additions and 31 deletions
+18 -18
View File
@@ -1,5 +1,5 @@
C Remove\sold\sfunction\sdeclaration\saccidentally\sleft\sin\ssqlite3session.h.
D 2025-02-12T15:31:26.463
C Omit\san\soptimization\sthat\sdid\snot\swork\s-\sit\sruns\sfaster\swith\sthe\noptimization\sremoved.
D 2025-02-13T23:33:47.587
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -729,7 +729,7 @@ F src/date.c 842c08ac143a56a627b05ac51d68624f2b7b03e3b4cba596205e735eed64ee57
F src/dbpage.c 2e677acb658a29965e55398bbc61161cb7819da538057c8032adac7ab8e4a8c0
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c ca943270395374afc65256ce86cdb152a22fa6ff146895175833b89ba870e117
F src/expr.c d5d87528151de24b85f8d49d8fd1eb35e503a231b3d4c4871531561743573b93
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c b2fb33139972d7d65640b27ea962a49f1616265428001090cab39fcf270228e1
@@ -738,7 +738,7 @@ F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7
F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf
F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6
F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 05e04ef637cbc0dccb9a5c5d188a5a2608891e554c8ec17c7a71afe2cf896a06
F src/insert.c 2e78d5f8d36f92f36898ecbb13600d20087fc4630819e6212ddccc8560af2cf0
F src/json.c 2663a0c7e574cb928de944720dcdcc11c931877d877549b8f1258a4002efd6f7
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36
@@ -768,22 +768,22 @@ F src/os_win.c 49c7725b500f5867e8360e75eeb30f9d70b62fa1f05c8a101da627210578df32
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 3a1c4e7f69af482e33c8cba8a75afe0dda0ea6391240adac22b040ce1bdeef44
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
F src/parse.y f84673f1454e2bcf517623d4346e67fb2d73e57826ea103681ad5848238f6029
F src/parse.y 3da35b1c665df67ed15b4d463b28824a922ece1d838399c9596f1ad0050e0197
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 49516ad7718a3626f28f710fa7448ef1fce3c07fd169acbb4817341950264319
F src/pragma.c ce1182217aa540e034c6da2f17515e3706bf52c837e8222361be9ccd7a9d495a
F src/pragma.c 409e35bf91026abe6ac188bb6fb98b94df1dd4d09ce9a9f0ed8697b237ec1c78
F src/prepare.c 1832be043fce7d489959aae6f994c452d023914714c4d5457beaed51c0f3d126
F src/printf.c 96f7f8baeedc7639da94e4e7a4a2c200e2537c4eec9e5e1c2ffc821f40eb3105
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 626c24b258b111f75c22107aa5614ad89810df3026f5ca071116d3fe75925c75
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 57893cc8b099f231f7ed5b84faff14841f2aabb4776e32e17fae00aeae0a8993
F src/select.c db244d449fcb7c7e50797becec19ec26bec512b4fda0ce117b1a51243065220a
F src/shell.c.in b377a59822f207106424f08aead37e78b609222e98f86f04cc8a03563ccf3237
F src/sqlite.h.in d2902f13ace94d3d3609646bd6d12a2d7a4f6cbdf6a5a4097580ac305f54c3f0
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54
F src/sqliteInt.h 8cbfef6c26efd539eb93011905f4d3ce7fdb77475d1280764d86f9e7954c464b
F src/sqliteInt.h dc012bb2be3842542fa5ee7cbd32e4e193eccd1861ea23184daaf0f29ae12e82
F src/sqliteLimit.h 1bbdbf72bd0411d003267ffebc59a262f061df5653027a75627d03f48ca30523
F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
@@ -847,9 +847,9 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
F src/utf.c 8b29d9a5956569ea2700f869669b8ef67a9662ee5e724ff77ab3c387e27094ba
F src/util.c 9ff6470dabcf943fd796d2da766c98bd328c8f6fe036a31e5b338e628603f989
F src/vacuum.c b763b6457bd058d2072ef9364832351fd8d11e8abf70cbb349657360f7d55c40
F src/vdbe.c b98d86de7f0e6c02fb14e0e1ae8feab6aa84669d389771a848e23f59eb70dcad
F src/vdbe.h 3d26d5c7660c5c7bd33ffb0d8784615072d8b23c81f8110870efe2631136bc89
F src/vdbeInt.h 078b1c15b26587b54c1c1879d0d2f4dec812b9de4c337fed9faf73fbcc3bf091
F src/vdbe.c c5414c7c2efd3752ce62cfc954de24270a2b2a377aa6309f0281daf41bad887c
F src/vdbe.h bcb446c44fb6dabc1517d5e3804edf1adda6090da76c4057cd58d032f73d608d
F src/vdbeInt.h 4836978baf3f70a8042d81c0649046d18e721a3ca64cc73f594869730873386f
F src/vdbeapi.c 82fe278a7c71b653235c6f9fb5de0b5de589908dfcb011ba2a782e8becf06f86
F src/vdbeaux.c 541d3d232714455960eab4ed10b34cb48b4bcd565d7539ef31092f5e73648e6b
F src/vdbeblob.c 9166b6eb7054e5da82e35255892fb1ed551355a4716452539e8e3ac14f25fbe3
@@ -862,7 +862,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 4e6181d8780ab0af2e1388d0754cbe6f2f04593d2b1ab6c41699a89942fd8997
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 09dc313e7223ca1217c39c7026b00f16ff449a8323511a762fcba7863a00f4cd
F src/where.c 1ca8a781c4735b2fecb5b72ce49a97c7cdc41c650b8279a93a87443f67b47d2a
F src/whereInt.h d20cddddb1d61b18d5cb1fcfa9b77fbeebbc4afe44d996e603452a23b3009ee1
F src/wherecode.c 5baa06f0daae7d38aca1d4814030b82ad4f127fe6bad18f0644776a474f6088b
F src/whereexpr.c 2415c8eee5ff89a8b709d7d83d71c1ff986cd720d0520057e1d8a5371339012a
@@ -2134,8 +2134,8 @@ F tool/genfkey.test b6afd7b825d797a1e1274f519ab5695373552ecad5cd373530c63533638a
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/index_usage.c f62a0c701b2c7ff2f3e21d206f093c123f222dbf07136a10ffd1ca15a5c706c5
F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f
F tool/lemon.c 2418ee31f65764d150f7dd87ef00b4408f1b01a55db0b30bed673a3e336ae718
F tool/lempar.c e6b649778e5c027c8365ff01d7ef39297cd7285fa1f881cce31792689541e79f
F tool/lemon.c 8a87e0ac84a9bfe48c5f13fec2282f5ffe4b2cb259f3fa6be4890e1188a32493
F tool/lempar.c bf92d06432a217adb9cc143392b0eaac4e4083321cee1dcd14ece83eb14a7acf
F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669
@@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P da94e551c0ed354ae782c89fd9495d607b77ad7572d90c41ceac12bd6ec4c31b
R 6f7f1710621940ea4683c778ed859375
U dan
Z 8c9d99e3c5ea71beb7debabd9d22f723
P f49ddd80b1b75ceef47702dd753b603c06a7941f659f25eb9880e26a52893d43
R cb6849d8d68db9f37513514790181050
U drh
Z 7f1f6d3fa08f490f2b4ba88b7a79b427
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
0cfbe349d4b740f3d2be8c714cf679901fc2465db4c64e4c3742da700d82f4e7
d67e28cb1bd62858aad3fd6dd6077486c93fe38099ff6d77a1da9a04348886e4
+4
View File
@@ -4896,6 +4896,10 @@ expr_code_doover:
sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
return target;
}
case TK_DEFAULT: {
sqlite3VdbeAddOp1(v, OP_DfltNull, target);
return target;
}
default: {
/* Make NULL the default case so that if a bug causes an illegal
** Expr node to be passed into this function, it will be handled
+43 -1
View File
@@ -791,6 +791,37 @@ static int xferOptimization(
int iDbDest /* The database of pDest */
);
/*
** If the iCol-th column of pTab has a default value, then add
** code that checks the content of register iReg to see if it
** is a SQLITE_NULL_DEFAULT and if it is, changes the content
** of iReg to the default value of the iCol-th column of pTab.
*/
static void insertResolveValuesDflt(
Parse *pParse, /* Parsing context */
Table *pTab, /* Table being inserted into */
int iCol, /* Column being inserted into */
int iReg /* Register containing the value to insert */
){
Vdbe *v = pParse->pVdbe;
sqlite3 *db = pParse->db;
sqlite3_value *pValue = 0;
Column *pCol;
assert( pParse->bValuesDflt );
assert( pParse->pVdbe!=0 );
assert( pTab->aCol[iCol].iDflt>0 );
assert( !IsView(pTab) );
assert( iCol<pTab->nCol );
pCol = &pTab->aCol[iCol];
sqlite3ValueFromExpr(db,
sqlite3ColumnExpr(pTab,pCol), ENC(db),
pCol->affinity, &pValue);
sqlite3VdbeAddOp1(v, OP_ToDefault, iReg);
sqlite3VdbeAppendP4(v, pValue, P4_MEM);
}
/*
** This routine is called to handle SQL of the following forms:
**
@@ -1423,9 +1454,20 @@ void sqlite3Insert(
if( regFromSelect!=regData ){
sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+k, iRegStore);
}
if( pParse->bValuesDflt && pTab->aCol[i].iDflt ){
insertResolveValuesDflt(pParse, pTab, i, iRegStore);
}
}else{
Expr *pX = pList->a[k].pExpr;
int y = sqlite3ExprCodeTarget(pParse, pX, iRegStore);
int y;
if( pX->op==TK_DEFAULT ){
Expr *pDflt = sqlite3ColumnExpr(pTab, &pTab->aCol[i]);
if( pDflt ){
sqlite3ExprCodeFactorable(pParse, pDflt, iRegStore);
continue;
}
}
y = sqlite3ExprCodeTarget(pParse, pX, iRegStore);
if( y!=iRegStore ){
sqlite3VdbeAddOp2(v,
ExprHasProperty(pX, EP_Subquery) ? OP_Copy : OP_SCopy, y, iRegStore);
+70 -1
View File
@@ -120,7 +120,9 @@ struct FrameBound { int eType; Expr *pExpr; };
** Generate a syntax error
*/
static void parserSyntaxError(Parse *pParse, Token *p){
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", p);
if( sqlite3_strglob("*syntax error*", pParse->zErrMsg)!=0 ){
sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", p);
}
}
/*
@@ -1532,6 +1534,73 @@ nexprlist(A) ::= nexprlist(A) COMMA expr(Y).
nexprlist(A) ::= expr(Y).
{A = sqlite3ExprListAppend(pParse,0,Y); /*A-overwrites-Y*/}
%include {
/* Forward declaration */
static SQLITE_NOINLINE void parserRequireInsertContext(
Parse *pParse, /* The SQLite parsing context */
void *pLemon, /* The LEMON parser state */
Token *pErrToken, /* Token that might be a syntax error */
int nRhs /* Number of RHS tokens on the ruls */
);
}
%code {
/* This routine checks to see if the parser stack looks like either of these:
**
** insert_cmd INTO xfullname idlist_opt VALUES LP
** insert_cmd INTO xfullname idlist_opt values COMMA LP
**
** If the parser stack is different from both of these, then raise a syntax error
** on pErrToken.
*/
static SQLITE_NOINLINE void parserRequireInsertContext(
Parse *pParse, /* The SQLite parsing context */
void *pLemon, /* The LEMON parser state */
Token *pErrToken, /* Token that might be a syntax error */
int nRhs /* Number of RHS tokens on the ruls */
){
yyParser *yypParser = (yyParser*)pLemon;
yyStackEntry *yytos = yypParser->yytos - nRhs;
int bFault = 0;
if( (yytos - yypParser->yystack) < 6
|| yytos[0].major!=TK_LP
){
bFault = 1;
}else
if( yytos[-1].major==TK_COMMA
&& (yytos[-2].major==YYNT_values || yytos[-2].major==YYNT_mvalues)
&& yytos[-3].major==YYNT_idlist_opt
){
/* This is ok */
}else
if( yytos[-1].major==TK_VALUES
&& yytos[-2].major==YYNT_idlist_opt
){
/* This is ok */
}else
{
bFault = 1; /* Cannot match */
}
if( bFault ) parserSyntaxError(pParse, pErrToken);
pParse->bValuesDflt = 1;
}
}
// The following reduction rules only succeed if the previous two
// tokens are "VALUES LP". If the previous two tokens are anything
// different, a syntax error is raised.
//
nexprlist(A) ::= nexprlist(A) COMMA DEFAULT(D). {
Expr *p = sqlite3PExpr(pParse,TK_DEFAULT,0,0);
parserRequireInsertContext(pParse, yypParser, &D, 3);
A = sqlite3ExprListAppend(pParse,A,p);
}
nexprlist(A) ::= DEFAULT(D). {
Expr *p = sqlite3PExpr(pParse,TK_DEFAULT,0,0);
parserRequireInsertContext(pParse, yypParser, &D, 1);
A = sqlite3ExprListAppend(pParse,0,p);
}
%ifndef SQLITE_OMIT_SUBQUERY
/* A paren_exprlist is an optional expression list contained inside
** of parenthesis */
+2 -1
View File
@@ -1821,7 +1821,8 @@ void sqlite3Pragma(
}else{
pPk = sqlite3PrimaryKeyIndex(pTab);
r2 = sqlite3GetTempRange(pParse, pPk->nKeyCol);
sqlite3VdbeAddOp3(v, OP_Null, 1, r2, r2+pPk->nKeyCol-1);
sqlite3VdbeAddOp3(v, OP_Null,
SQLITE_NULL_CLEARED, r2, r2+pPk->nKeyCol-1);
}
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
1, 0, &iDataCur, &iIdxCur);
+1 -1
View File
@@ -1025,7 +1025,7 @@ static void fixDistinctOpenEph(
** the loop even if the first row is all NULLs. */
VdbeOp *pOp = sqlite3VdbeGetOp(v, iOpenEphAddr);
pOp->opcode = OP_Null;
pOp->p1 = 1;
pOp->p1 = SQLITE_NULL_CLEARED;
pOp->p2 = iVal;
}
}
+1
View File
@@ -3855,6 +3855,7 @@ struct Parse {
bft bHasWith :1; /* True if statement contains WITH */
bft okConstFactor :1; /* OK to factor out constants */
bft checkSchema :1; /* Causes schema cookie check after an error */
bft bValuesDflt :1; /* DEFAULT keyword appears in a VALUES clause */
int nRangeReg; /* Size of the temporary register block */
int iRangeReg; /* First register in temporary register block */
int nErr; /* Number of errors seen */
+56 -6
View File
@@ -581,7 +581,11 @@ static void memTracePrint(Mem *p){
if( p->flags & MEM_Undefined ){
printf(" undefined");
}else if( p->flags & MEM_Null ){
printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
if( p->flags==(MEM_Null|MEM_Term|MEM_Subtype) && p->eSubtype==0 ){
printf(" NULL-default");
}else{
printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");
}
}else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
printf(" si:%lld", p->u.i);
}else if( (p->flags & (MEM_IntReal))!=0 ){
@@ -601,7 +605,11 @@ static void memTracePrint(Mem *p){
sqlite3VdbeMemPrettyPrint(p, &acc);
printf(" %s", sqlite3StrAccumFinish(&acc));
}
if( p->flags & MEM_Subtype ) printf(" subtype=0x%02x", p->eSubtype);
if( (p->flags & MEM_Subtype)!=0
&& (p->eSubtype!=0 || (p->flags & MEM_Null)==0)
){
printf(" subtype=0x%02x", p->eSubtype);
}
}
static void registerTrace(int iReg, Mem *p){
printf("R[%d] = ", iReg);
@@ -1473,9 +1481,10 @@ case OP_String: { /* out2 */
** is less than P2 (typically P3 is zero) then only register P2 is
** set to NULL.
**
** If the P1 value is non-zero, then also set the MEM_Cleared flag so that
** NULL values will not compare equal even if SQLITE_NULLEQ is set on
** OP_Ne or OP_Eq.
** If the P1 value can be SQLITE_NULL_CLEARED to create a NULL value that
** will not compare equal even if SQLITE_NULLEQ is set on OP_Ne or OP_Eq.
** In other words, SQLITE_NULL_CLEARED creates a NULL that never compares
** equal to any other NULL.
*/
case OP_BeginSubrtn:
case OP_Null: { /* out2 */
@@ -1484,7 +1493,9 @@ case OP_Null: { /* out2 */
pOut = out2Prerelease(p, pOp);
cnt = pOp->p3-pOp->p2;
assert( pOp->p3<=(p->nMem+1 - p->nCursor) );
pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
assert( pOp->p1==0 || pOp->p1==MEM_Cleared );
assert( SQLITE_NULL_CLEARED==MEM_Cleared );
pOut->flags = nullFlag = pOp->p1 | MEM_Null;
pOut->n = 0;
#ifdef SQLITE_DEBUG
pOut->uTemp = 0;
@@ -1515,6 +1526,45 @@ case OP_SoftNull: {
break;
}
/* Opcode: DfltNull P1 * * * *
** Synopsis: r[P1]=DEFAULT-NULL
**
** Set register P1 to have the value NULL that has a special pointer
** value to indicate that it originated as a DEFAULT keyword in a VALUES
** clause.
*/
case OP_DfltNull: {
assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
pOut = &aMem[pOp->p1];
memAboutToChange(p, pOut);
sqlite3VdbeMemSetNull(pOut);
pOut->flags = MEM_Null|MEM_Term|MEM_Subtype;
pOut->eSubtype = 0;
break;
}
/* Opcode: ToDefault P1 * * P4 *
** Synopsis: if r[P1]==DEFAULT then r[P1]=P4
**
** If register P1 contains the special NULL value created by the
** OP_DfltNull opcode that indicates that it originated from the
** DEFAULT keyword in a VALUES clause, then change its value to
** the value in P4.
*/
case OP_ToDefault: { /* in1 */
assert( pOp->p4type==P4_MEM );
pIn1 = &aMem[pOp->p1];
if( (pIn1->flags & (MEM_TypeMask|MEM_Term))==(MEM_Null|MEM_Term|MEM_Subtype)
&& pIn1->eSubtype==0
){
memAboutToChange(p, pIn1);
sqlite3VdbeMemShallowCopy(pIn1, pOp->p4.pMem, MEM_Static);
UPDATE_MAX_BLOBSIZE(pIn1);
REGISTER_TRACE(pOp->p1, pIn1);
}
break;
}
/* Opcode: Blob P1 P2 * P4 *
** Synopsis: r[P2]=P4 (len=P1)
**
+5
View File
@@ -188,6 +188,11 @@ typedef struct VdbeOpList VdbeOpList;
#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
#define SQLITE_PREPARE_MASK 0x1f /* Mask of public flags */
/*
** Allowed P1 arguments to OP_Null for special kinds of NULLs.
*/
#define SQLITE_NULL_CLEARED 0x0100 /* NULL always <> to other NULLs */
/*
** Prototypes for the VDBE interface. See comments on the implementation
** for a description of what each of these routines does.
+3 -2
View File
@@ -259,8 +259,9 @@ struct sqlite3_value {
**
** * MEM_Null An SQL NULL value
**
** * MEM_Null|MEM_Zero An SQL NULL with the virtual table
** UPDATE no-change flag set
** * MEM_Null|MEM_Zero An SQL NULL with flag that indicates
** UPDATE no-change for virtual tables and
** DEFAULT for ordinary tables.
**
** * MEM_Null|MEM_Term| An SQL NULL, but also contains a
** MEM_Subtype pointer accessible using
+1
View File
@@ -749,6 +749,7 @@ static void translateColumnToCopy(
#ifdef SQLITE_ALLOW_ROWID_IN_VIEW
if( iAutoidxCur==0 ){
pOp->opcode = OP_Null;
pOp->p1 = 0;
pOp->p3 = 0;
}
#endif
+8
View File
@@ -4934,6 +4934,14 @@ void ReportTable(
}
tplt_xfer(lemp->name,in,out,&lineno);
/* Generate internal #defines for every non-terminal symbol.
*/
for(i=0; i<lemp->nsymbol; i++){
if( !ISLOWER(lemp->symbols[i]->name[0]) ) continue;
fprintf(out,"#define YYNT_%-20s %4d\n",lemp->symbols[i]->name, i);lineno++;
}
tplt_xfer(lemp->name,in,out,&lineno);
/* Generate a table containing a text string that describes every
** rule in the rule set of the grammar. This information is used
** when tracing REDUCE actions.
+3
View File
@@ -280,6 +280,9 @@ static const char *const yyTokenName[] = {
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
/* Numeric values assigned to non-terminal symbols. */
%%
#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/