From: <mie...@us...> - 2012-11-21 00:01:03
|
Revision: 8605 http://sourceforge.net/p/oorexx/code-0/8605 Author: miesfeld Date: 2012-11-21 00:00:59 +0000 (Wed, 21 Nov 2012) Log Message: ----------- #1144 OOsqlite3 Foreign_keys See ticket [Bugs:#1144] Modified Paths: -------------- incubator/ooSQLite/Makefile.lin incubator/ooSQLite/Makefile.mac incubator/ooSQLite/Makefile.win incubator/ooSQLite/ReleaseNotes incubator/ooSQLite/src/ooSQLite.cpp Modified: incubator/ooSQLite/Makefile.lin =================================================================== --- incubator/ooSQLite/Makefile.lin 2012-11-20 23:58:52 UTC (rev 8604) +++ incubator/ooSQLite/Makefile.lin 2012-11-21 00:00:59 UTC (rev 8605) @@ -90,7 +90,7 @@ VERDEFS=-DOOSQLITE_VER_MAJOR=$(OOSQLITE_MAJOR) -DOOSQLITE_VER_MINOR=$(OOSQLITE_MINOR) -DOOSQLITE_VER_LEVEL=$(OOSQLITE_MOD_LVL) -DOOSQLITE_VER_BUILD=$(OOSQLITE_BLD_LVL) -DOOSQLITE_VER_STRING=$(OOSQLITE_VER_STR) -DOOSQLITE_COPYRIGHT_YEAR=$(OOSQLITE_COPY_YEAR) EXTRAINCLUDE=-I src/sqlite -SQLITEFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_MEMORY_MANAGEMENT +SQLITEFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_DEFAULT_FOREIGN_KEYS=1 BASEFLAGS = $(WARNINGFLAGS) $(VERDEFS) $(EXTRAINCLUDE) $(SQLITEFLAGS) $(CONFFLAGS) OUT_DIR=build/release Modified: incubator/ooSQLite/Makefile.mac =================================================================== --- incubator/ooSQLite/Makefile.mac 2012-11-20 23:58:52 UTC (rev 8604) +++ incubator/ooSQLite/Makefile.mac 2012-11-21 00:00:59 UTC (rev 8605) @@ -93,7 +93,7 @@ VERDEFS=-DOOSQLITE_VER_MAJOR=$(OOSQLITE_MAJOR) -DOOSQLITE_VER_MINOR=$(OOSQLITE_MINOR) -DOOSQLITE_VER_LEVEL=$(OOSQLITE_MOD_LVL) -DOOSQLITE_VER_BUILD=$(OOSQLITE_BLD_LVL) -DOOSQLITE_VER_STRING=$(OOSQLITE_VER_STR) -DOOSQLITE_COPYRIGHT_YEAR=$(OOSQLITE_COPY_YEAR) EXTRAINCLUDE=-I src/sqlite -SQLITEFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_MEMORY_MANAGEMENT +SQLITEFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_DEFAULT_FOREIGN_KEYS=1 BASEFLAGS = $(WARNINGFLAGS) $(VERDEFS) $(EXTRAINCLUDE) $(SQLITEFLAGS) $(CONFFLAGS) OUT_DIR=build/release Modified: incubator/ooSQLite/Makefile.win =================================================================== --- incubator/ooSQLite/Makefile.win 2012-11-20 23:58:52 UTC (rev 8604) +++ incubator/ooSQLite/Makefile.win 2012-11-21 00:00:59 UTC (rev 8605) @@ -126,7 +126,7 @@ VERDEFS = /DOOSQLITE_VER_MAJOR=$(OOSQLITE_MAJOR) /DOOSQLITE_VER_MINOR=$(OOSQLITE_MINOR) /DOOSQLITE_VER_LEVEL=$(OOSQLITE_MOD_LVL) /DOOSQLITE_VER_BUILD=$(OOSQLITE_BLD_LVL) /DOOSQLITE_VER_STRING=$(OOSQLITE_VER_STR) /DOOSQLITE_COPYRIGHT_YEAR=\"$(OOSQLITE_COPY_YEAR)\" EXTRAINCLUDE = /I src\sqlite -SQLITEFLAGS=/DSQLITE_ENABLE_COLUMN_METADATA /DSQLITE_ENABLE_MEMORY_MANAGEMENT /DSQLITE_ENABLE_FTS3 /DSQLITE_ENABLE_FTS3_PARENTHESIS +SQLITEFLAGS=/DSQLITE_ENABLE_COLUMN_METADATA /DSQLITE_ENABLE_MEMORY_MANAGEMENT /DSQLITE_ENABLE_FTS3 /DSQLITE_ENABLE_FTS3_PARENTHESIS /DSQLITE_DEFAULT_FOREIGN_KEYS=1 BASEFLAGS = $(WARNINGFLAGS) $(VERDEFS) $(EXTRAINCLUDE) $(SQLITEFLAGS) # The linker flag /OPT:REF removes unreferenced functions and data. In order for Modified: incubator/ooSQLite/ReleaseNotes =================================================================== --- incubator/ooSQLite/ReleaseNotes 2012-11-20 23:58:52 UTC (rev 8604) +++ incubator/ooSQLite/ReleaseNotes 2012-11-21 00:00:59 UTC (rev 8605) @@ -224,7 +224,24 @@ * #1142 ooSQLite callback functions can use larger than needed memory resources + * #1144 OOsqlite3 Foreign_keys + + + Enhancements: + ------------- + + * Enforcement of foreign key constraints is enabled by default for new + database connections, in both ooSQLite and ooSQLite3. Each database + connection can always turn enforcement of foreign key constraints off + at run-time using the foreign_keys pragma. This "enhancement" is a + result of bug #1144 listed above. + + In SQLite, enforcement of foreign key constraints is normally off by + default. This is changed in ooSQLite so that enforcement of foreign + key constraints will be on by default. + + Documentation: -------------- Modified: incubator/ooSQLite/src/ooSQLite.cpp =================================================================== --- incubator/ooSQLite/src/ooSQLite.cpp 2012-11-20 23:58:52 UTC (rev 8604) +++ incubator/ooSQLite/src/ooSQLite.cpp 2012-11-21 00:00:59 UTC (rev 8605) @@ -321,35 +321,6 @@ } /** - * Enables foreign key support in the specified database connection. - * - * Foreign key support is disabled by default in SQLite 3.7.13 and must be - * explicitly enabled on each database connection. In ooSQLite, foreign key - * support is enabled by default - this function is called for each opened - * database. - * - * @param db - * - * @return bool - */ -static bool enableForeignKeys(sqlite3 *db) -{ - sqlite3_stmt *stmt; - const char sql[] = "PRAGMA foreign_keys = ON;"; - - int rc = sqlite3_prepare_v2(db, sql, (int)strlen(sql) + 1, &stmt, NULL); - if ( rc != SQLITE_OK ) - { - return false; - } - - rc = sqlite3_step(stmt); - sqlite3_finalize(stmt); - - return rc == SQLITE_DONE; -} - -/** * Similar to the other ooSQLiteErr() functions above, but the primary purpose * is to set the databas connection last error message and last error code. * @@ -3775,7 +3746,6 @@ // Here we enable things that are enabled / disabled on a per database // connection basis that are set by default for ooSQLite. sqlite3_extended_result_codes(pConn->db, 1); - enableForeignKeys(db); } c->SetObjectVariable("rxLastErrMsg", pConn->lastErrMsg); @@ -9318,7 +9288,6 @@ // Here we enable things that are enabled / disabled on a per database // connection basis that are set by default for ooSQLite. sqlite3_extended_result_codes(db, 1); - enableForeignKeys(db); } context->SetContextVariable(dbConn, context->NewPointer(db)); |