Hi Christian,
I'm not sure what this patch to SQLite 3.3.12 does.
Is it fixing a bug or extending SQLite for use in your ODBC driver?
Should a ticket be created for it in SQLite CVSTrac?
thanks.
# patch: parse foreign key constraints on virtual tables
patch -d sqlite3 -p1 <<'EOD'
diff -ur sqlite3.orig/src/build.c sqlite3/src/build.c
--- sqlite3.orig/src/build.c 2007-01-09 14:53:04.000000000 +0100
+++ sqlite3/src/build.c 2007-01-30 08:14:41.000000000 +0100
@@ -2063,7 +2063,7 @@
char *z;
assert( pTo!=0 );
- if( p==0 || pParse->nErr || IN_DECLARE_VTAB ) goto fk_end;
+ if( p==0 || pParse->nErr ) goto fk_end;
if( pFromCol==0 ){
int iCol = p->nCol-1;
if( iCol<0 ) goto fk_end;
diff -ur sqlite3.orig/src/pragma.c sqlite3/src/pragma.c
--- sqlite3.orig/src/pragma.c 2007-01-27 03:24:56.000000000 +0100
+++ sqlite3/src/pragma.c 2007-01-30 09:19:30.000000000 +0100
@@ -589,6 +589,9 @@
pTab = sqlite3FindTable(db, zRight, zDb);
if( pTab ){
v = sqlite3GetVdbe(pParse);
+#ifndef SQLITE_OMIT_VIRTUAL_TABLE
+ if( pTab->isVirtual ) sqlite3ViewGetColumnNames(pParse, pTab);
+#endif
pFK = pTab->pFKey;
if( pFK ){
int i = 0;
diff -ur sqlite3.orig/src/vtab.c sqlite3/src/vtab.c
--- sqlite3.orig/src/vtab.c 2007-01-09 15:01:14.000000000 +0100
+++ sqlite3/src/vtab.c 2007-01-30 08:23:22.000000000 +0100
@@ -436,6 +436,9 @@
int rc = SQLITE_OK;
Table *pTab = db->pVTab;
char *zErr = 0;
+#ifndef SQLITE_OMIT_FOREIGN_KEYS
+ FKey *pFKey;
+#endif
if( !pTab ){
sqlite3Error(db, SQLITE_MISUSE, 0);
@@ -464,6 +467,15 @@
}
sParse.declareVtab = 0;
+#ifndef SQLITE_OMIT_FOREIGN_KEYS
+ assert( pTab->pFKey==0 );
+ pTab->pFKey = sParse.pNewTable->pFKey;
+ sParse.pNewTable->pFKey = 0;
+ for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
+ pFKey->pFrom=pTab;
+ }
+#endif
+
sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
sqlite3DeleteTable(0, sParse.pNewTable);
sParse.pNewTable = 0;
EOD
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------