aboutsummaryrefslogtreecommitdiff
path: root/src/build.c
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2006-06-12 11:24:37 +0000
committerdanielk1977 <danielk1977@noemail.net>2006-06-12 11:24:37 +0000
commit7e6ebfb2460856acc7afb7b44d25e840866f5ccc (patch)
tree2191533e25f0e5cef3adc8c1b79b9ce8df1bff2c /src/build.c
parent78efaba10e4568817e5b75bcdfd4f599677e94c9 (diff)
downloadsqlite-7e6ebfb2460856acc7afb7b44d25e840866f5ccc.tar.gz
sqlite-7e6ebfb2460856acc7afb7b44d25e840866f5ccc.zip
Add first cut of sqlite3_declare_vtab(). Not at all well tested yet. (CVS 3213)
FossilOrigin-Name: bbeb93b5bb26ba83ee7b7ae439ca5ceebebac9a0
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/build.c b/src/build.c
index 0be7c92f9..b9fa185d5 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
-** $Id: build.c,v 1.396 2006/06/11 23:41:55 drh Exp $
+** $Id: build.c,v 1.397 2006/06/12 11:24:37 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -782,22 +782,28 @@ void sqlite3StartTable(
/* Make sure the new table name does not collide with an existing
** index or table name in the same database. Issue an error message if
- ** it does.
+ ** it does. The exception is if the statement being parsed was passed
+ ** to an sqlite3_declare_vtab() call. In that case only the column names
+ ** and types will be used, so there is no need to test for namespace
+ ** collisions.
*/
- if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
- goto begin_table_error;
- }
- pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName);
- if( pTable ){
- if( !noErr ){
- sqlite3ErrorMsg(pParse, "table %T already exists", pName);
+ if( !IN_DECLARE_VTAB ){
+ if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
+ goto begin_table_error;
+ }
+ pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName);
+ if( pTable ){
+ if( !noErr ){
+ sqlite3ErrorMsg(pParse, "table %T already exists", pName);
+ }
+ goto begin_table_error;
+ }
+ if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){
+ sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
+ goto begin_table_error;
}
- goto begin_table_error;
- }
- if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){
- sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
- goto begin_table_error;
}
+
pTable = sqliteMalloc( sizeof(Table) );
if( pTable==0 ){
pParse->rc = SQLITE_NOMEM;
@@ -1649,6 +1655,9 @@ int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
** already known.
*/
if( pTable->nCol>0 ) return 0;
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ if( pTable->isVirtual ) return 0;
+#endif
/* A negative nCol is a special marker meaning that we are currently
** trying to compute the column names. If we enter this routine with