aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/insert.c12
-rw-r--r--src/parse.y4
-rw-r--r--src/tclsqlite.c4
3 files changed, 9 insertions, 11 deletions
diff --git a/src/insert.c b/src/insert.c
index 0c79d6e61..2ee5c79e2 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.170 2006/06/19 03:05:10 danielk1977 Exp $
+** $Id: insert.c,v 1.171 2006/08/25 23:42:53 drh Exp $
*/
#include "sqliteInt.h"
@@ -387,11 +387,9 @@ void sqlite3Insert(
NameContext sNC;
memset(&sNC, 0, sizeof(sNC));
sNC.pParse = pParse;
- assert( pList!=0 );
srcTab = -1;
useTempTable = 0;
- assert( pList );
- nColumn = pList->nExpr;
+ nColumn = pList ? pList->nExpr : 0;
for(i=0; i<nColumn; i++){
if( sqlite3ExprResolveNames(&sNC, pList->a[i].pExpr) ){
goto insert_cleanup;
@@ -402,7 +400,7 @@ void sqlite3Insert(
/* Make sure the number of columns in the source data matches the number
** of columns to be inserted into the table.
*/
- if( pColumn==0 && nColumn!=pTab->nCol ){
+ if( pColumn==0 && nColumn && nColumn!=pTab->nCol ){
sqlite3ErrorMsg(pParse,
"table %S has %d columns but %d values were supplied",
pTabList, 0, pTab->nCol, nColumn);
@@ -455,7 +453,7 @@ void sqlite3Insert(
** key, the set the keyColumn variable to the primary key column index
** in the original table definition.
*/
- if( pColumn==0 ){
+ if( pColumn==0 && nColumn>0 ){
keyColumn = pTab->iPKey;
}
@@ -618,7 +616,7 @@ void sqlite3Insert(
if( pColumn->a[j].idx==i ) break;
}
}
- if( pColumn && j>=pColumn->nId ){
+ if( nColumn==0 || (pColumn && j>=pColumn->nId) ){
sqlite3ExprCode(pParse, pTab->aCol[i].pDflt);
}else if( useTempTable ){
sqlite3VdbeAddOp(v, OP_Column, srcTab, j);
diff --git a/src/parse.y b/src/parse.y
index 0c0575362..f9445113c 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -14,7 +14,7 @@
** the parser. Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
-** @(#) $Id: parse.y,v 1.207 2006/08/14 14:23:42 drh Exp $
+** @(#) $Id: parse.y,v 1.208 2006/08/25 23:42:53 drh Exp $
*/
// All token codes are small integers with #defines that begin with "TK_"
@@ -600,6 +600,8 @@ cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F)
{sqlite3Insert(pParse, X, Y, 0, F, R);}
cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) select(S).
{sqlite3Insert(pParse, X, 0, S, F, R);}
+cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) DEFAULT VALUES.
+ {sqlite3Insert(pParse, X, 0, 0, F, R);}
%type insert_cmd {int}
insert_cmd(A) ::= INSERT orconf(R). {A = R;}
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index e7b317041..622208378 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -11,7 +11,7 @@
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.169 2006/08/24 14:59:46 drh Exp $
+** $Id: tclsqlite.c,v 1.170 2006/08/25 23:42:53 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@@ -2073,8 +2073,6 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
zArg = Tcl_GetStringFromObj(objv[1], 0);
Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd);
- /* If a TCL procedure named "::sqlite3_init
-
/* If compiled with SQLITE_TEST turned on, then register the "md5sum"
** SQL function.
*/