Index: Doc/Extra/version.html
==================================================================
--- Doc/Extra/version.html
+++ Doc/Extra/version.html
@@ -46,10 +46,13 @@
1.0.83.0 - November XX, 2012 (release scheduled)
- Updated to SQLite 3.7.15.
- Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.
- Add Visual Studio 2012 support to the redesigned designer support installer.
+ - Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.
+ - Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class.
+ - Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.
- Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.
- All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.
- Make sure the error code of the SQLiteException class gets serialized.
- Make the test project for the .NET Compact Framework more flexible.
- When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.
Index: Membership/SQLiteProvider.2008.csproj
==================================================================
--- Membership/SQLiteProvider.2008.csproj
+++ Membership/SQLiteProvider.2008.csproj
@@ -18,11 +18,11 @@
Properties
SQLiteProvider
SQLiteProvider
2.0
$(MSBuildProjectDirectory)\..
- true
+ true
2008
$(BinaryOutputPath)
Index: Membership/SQLiteProvider.2010.csproj
==================================================================
--- Membership/SQLiteProvider.2010.csproj
+++ Membership/SQLiteProvider.2010.csproj
@@ -18,10 +18,11 @@
Properties
SQLiteProvider
SQLiteProvider
3.5
$(MSBuildProjectDirectory)\..
+ true
2010
$(BinaryOutputPath)
Index: Membership/SQLiteProvider.2012.csproj
==================================================================
--- Membership/SQLiteProvider.2012.csproj
+++ Membership/SQLiteProvider.2012.csproj
@@ -16,10 +16,11 @@
Library
Properties
SQLiteProvider
SQLiteProvider
$(MSBuildProjectDirectory)\..
+ true
2012
v4.5
Index: SQLite.Designer/SQLite.Designer.2008.csproj
==================================================================
--- SQLite.Designer/SQLite.Designer.2008.csproj
+++ SQLite.Designer/SQLite.Designer.2008.csproj
@@ -18,11 +18,11 @@
Properties
SQLite.Designer
SQLite.Designer
2.0
$(MSBuildProjectDirectory)\..
- true
+ true
2008
Index: SQLite.Designer/SQLite.Designer.2010.csproj
==================================================================
--- SQLite.Designer/SQLite.Designer.2010.csproj
+++ SQLite.Designer/SQLite.Designer.2010.csproj
@@ -18,10 +18,11 @@
Properties
SQLite.Designer
SQLite.Designer
3.5
$(MSBuildProjectDirectory)\..
+ true
2010
Index: SQLite.Designer/SQLite.Designer.2012.csproj
==================================================================
--- SQLite.Designer/SQLite.Designer.2012.csproj
+++ SQLite.Designer/SQLite.Designer.2012.csproj
@@ -16,10 +16,11 @@
Library
Properties
SQLite.Designer
SQLite.Designer
$(MSBuildProjectDirectory)\..
+ true
2012
v4.5
Index: SQLite.Interop/SQLite.Interop.2005.vcproj
==================================================================
--- SQLite.Interop/SQLite.Interop.2005.vcproj
+++ SQLite.Interop/SQLite.Interop.2005.vcproj
@@ -51,11 +51,11 @@
Name="VCMIDLTool"
/>
true
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -165,11 +165,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -207,11 +207,11 @@
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -242,11 +242,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
Index: SQLite.Interop/SQLite.Interop.2012.vcxproj
==================================================================
--- SQLite.Interop/SQLite.Interop.2012.vcxproj
+++ SQLite.Interop/SQLite.Interop.2012.vcxproj
@@ -130,11 +130,11 @@
true
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -172,11 +172,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -214,11 +214,11 @@
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
@@ -249,11 +249,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebugDLL
Level4
ProgramDatabase
Index: SQLite.Interop/SQLite.Interop.CE.2005.vcproj
==================================================================
--- SQLite.Interop/SQLite.Interop.CE.2005.vcproj
+++ SQLite.Interop/SQLite.Interop.CE.2005.vcproj
@@ -55,11 +55,11 @@
/>
true
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -165,11 +165,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -207,11 +207,11 @@
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -242,11 +242,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
Index: SQLite.Interop/SQLite.Interop.Static.2012.vcxproj
==================================================================
--- SQLite.Interop/SQLite.Interop.Static.2012.vcxproj
+++ SQLite.Interop/SQLite.Interop.Static.2012.vcxproj
@@ -130,11 +130,11 @@
true
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -172,11 +172,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -214,11 +214,11 @@
Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
@@ -249,11 +249,11 @@
Disabled
- WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);%(PreprocessorDefinitions)
+ WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)
false
Default
MultiThreadedDebug
Level4
ProgramDatabase
Index: SQLite.Interop/props/SQLite.Interop.2005.vsprops
==================================================================
--- SQLite.Interop/props/SQLite.Interop.2005.vsprops
+++ SQLite.Interop/props/SQLite.Interop.2005.vsprops
@@ -35,10 +35,15 @@
+
Index: SQLite.Interop/props/SQLite.Interop.2008.vsprops
==================================================================
--- SQLite.Interop/props/SQLite.Interop.2008.vsprops
+++ SQLite.Interop/props/SQLite.Interop.2008.vsprops
@@ -35,10 +35,15 @@
+
Index: SQLite.Interop/props/SQLite.Interop.2010.props
==================================================================
--- SQLite.Interop/props/SQLite.Interop.2010.props
+++ SQLite.Interop/props/SQLite.Interop.2010.props
@@ -12,10 +12,11 @@
2010
083
1.0
1.0.83.0
1,0,83,0
+ INTEROP_TEST_EXTENSION=1
INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1
/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp
$(ProjectDir)..\System.Data.SQLite\System.Data.SQLite.snk
SQLite.Interop
System.Data.SQLite
@@ -39,10 +40,14 @@
$(INTEROP_RC_VERSION)
true
+
+ $(INTEROP_DEBUG_DEFINES)
+ true
+
$(INTEROP_EXTRA_DEFINES)
true
Index: SQLite.Interop/props/SQLite.Interop.2012.props
==================================================================
--- SQLite.Interop/props/SQLite.Interop.2012.props
+++ SQLite.Interop/props/SQLite.Interop.2012.props
@@ -12,10 +12,11 @@
2012
083
1.0
1.0.83.0
1,0,83,0
+ INTEROP_TEST_EXTENSION=1
INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_CODEC=1
/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp
$(ProjectDir)..\System.Data.SQLite\System.Data.SQLite.snk
SQLite.Interop
System.Data.SQLite
@@ -39,10 +40,14 @@
$(INTEROP_RC_VERSION)
true
+
+ $(INTEROP_DEBUG_DEFINES)
+ true
+
$(INTEROP_EXTRA_DEFINES)
true
Index: SQLite.Interop/props/sqlite3.props
==================================================================
--- SQLite.Interop/props/sqlite3.props
+++ SQLite.Interop/props/sqlite3.props
@@ -14,11 +14,11 @@
_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1
SQLITE_HAS_CODEC=1
SQLITE_OMIT_WAL=1
SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1
SQLITE_WIN32_MALLOC=1
- 4100;4127;4210;4232;4244;4267;4306;4389;4701;4703;4706
+ 4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706
$(SQLITE_MANIFEST_VERSION)
Index: SQLite.Interop/props/sqlite3.vsprops
==================================================================
--- SQLite.Interop/props/sqlite3.vsprops
+++ SQLite.Interop/props/sqlite3.vsprops
@@ -47,11 +47,11 @@
Value="SQLITE_WIN32_MALLOC=1"
PerformEnvironmentSet="true"
/>
-// #define COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
-//#define HAVE_ACOSH 1
-//#define HAVE_ASINH 1
-//#define HAVE_ATANH 1
+/* #define COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */
+/* #define HAVE_ACOSH 1 */
+/* #define HAVE_ASINH 1 */
+/* #define HAVE_ATANH 1 */
#define HAVE_SINH 1
#define HAVE_COSH 1
#define HAVE_TANH 1
#define HAVE_LOG10 1
-//#define HAVE_ISBLANK 1
+/* #define HAVE_ISBLANK 1 */
#define SQLITE_SOUNDEX 1
#define HAVE_TRIM 1 /* LMH 2007-03-25 if sqlite has trim functions */
#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
#include "../core/sqlite3ext.h"
@@ -128,11 +128,11 @@
#include
#ifndef _MAP_H_
#define _MAP_H_
-//#include
+/* #include */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed int int16_t;
typedef unsigned int uint16_t;
@@ -195,11 +195,11 @@
int double_cmp(const void *a, const void *b);
#endif /* _MAP_H_ */
typedef uint8_t u8;
-//typedef uint16_t u16;
+/* typedef uint16_t u16; */
typedef int64_t i64;
static char *sqlite3StrDup( const char *z ) {
char *res = sqlite3_malloc( strlen(z)+1 );
return strcpy( res, z );
@@ -310,11 +310,11 @@
** it creates code for a function to use in SQlite that gets one numeric input
** and returns a floating point value.
**
** Could have been implemented using pointers to functions but this way it's inline
** and thus more efficient. Lower * ranking though...
-**
+**
** Parameters:
** name: function name to de defined (eg: sinFunc)
** function: function defined in math.h to wrap (eg: sin)
** domain: boolean condition that CAN'T happen in terms of the input parameter rVal
** (eg: rval<0 for sqrt)
@@ -355,11 +355,11 @@
GEN_MATH_WRAP_DOUBLE_1(asinFunc, asin)
GEN_MATH_WRAP_DOUBLE_1(atanFunc, atan)
/*
** Many of systems don't have inverse hyperbolic trig functions so this will emulate
-** them on those systems in terms of log and sqrt (formulas are too trivial to demand
+** them on those systems in terms of log and sqrt (formulas are too trivial to demand
** written proof here)
*/
#ifndef HAVE_ACOSH
static double acosh(double x){
@@ -510,31 +510,31 @@
** Wraps the pow math.h function
** When both the base and the exponent are integers the result should be integer
** (see sqrt just before this). Here the result is always double
*/
/* LMH 2007-03-25 Changed to use errno; no pre-checking for errors. Also removes
- but that was present in the pre-checking that called sqlite3_result_error on
+ but that was present in the pre-checking that called sqlite3_result_error on
a non-positive first argument, which is not always an error. */
static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
double r1 = 0.0;
double r2 = 0.0;
double val;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
r1 = sqlite3_value_double(argv[0]);
r2 = sqlite3_value_double(argv[1]);
errno = 0;
val = pow(r1,r2);
if (errno == 0) {
sqlite3_result_double(context, val);
- } else {
+ } else {
sqlite3_result_error(context, strerror(errno), errno);
- }
+ }
}
}
/*
** atan2 wrapper
@@ -542,13 +542,13 @@
static void atn2Func(sqlite3_context *context, int argc, sqlite3_value **argv){
double r1 = 0.0;
double r2 = 0.0;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
r1 = sqlite3_value_double(argv[0]);
r2 = sqlite3_value_double(argv[1]);
sqlite3_result_double(context, atan2(r1,r2));
}
@@ -634,18 +634,18 @@
}
}
}
/*
-** Given a string (s) in the first argument and an integer (n) in the second returns the
+** Given a string (s) in the first argument and an integer (n) in the second returns the
** string that constains s contatenated n times
*/
static void replicateFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
unsigned char *z; /* input string */
unsigned char *zo; /* result string */
i64 iCount; /* times to repeat */
- i64 nLen; /* length of the input string (no multibyte considerations) */
+ i64 nLen; /* length of the input string (no multibyte considerations) */
i64 nTLen; /* length of the result string (no multibyte considerations) */
i64 i=0;
if( argc!=2 || SQLITE_NULL==sqlite3_value_type(argv[0]) )
return;
@@ -676,11 +676,11 @@
sqlite3_free(z);
sqlite3_free(zo);
}
}
-/*
+/*
** Some systems (win32 among others) don't have an isblank function, this will emulate it.
** This function is not UFT-8 safe since it only analyses a byte character.
*/
#ifndef HAVE_ISBLANK
int isblank(char c){
@@ -741,13 +741,13 @@
const char *zi; /* input string */
char *zo; /* output string */
char *zt;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
zi = (char *)sqlite3_value_text(argv[0]);
ilen = sqlite3_value_int64(argv[1]);
/* check domain */
if(ilen<0){
@@ -795,13 +795,13 @@
const char *zi; /* input string */
char *zo; /* output string */
char *zt;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
zi = (char *)sqlite3_value_text(argv[0]);
ilen = sqlite3_value_int64(argv[1]);
/* check domain */
if(ilen<0){
@@ -850,13 +850,13 @@
const char *zi; /* input string */
char *zo; /* output string */
char *zt;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
zi = (char *)sqlite3_value_text(argv[0]);
ilen = sqlite3_value_int64(argv[1]);
/* check domain */
if(ilen<0){
@@ -909,21 +909,21 @@
char *zot;
int c1 = 0;
int c2 = 0;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
- sqlite3_result_null(context);
+ sqlite3_result_null(context);
}else{
zi1 = (char *)sqlite3_value_text(argv[0]);
zi2 = (char *)sqlite3_value_text(argv[1]);
- /*
- ** maybe I could allocate less, but that would imply 2 passes, rather waste
+ /*
+ ** maybe I could allocate less, but that would imply 2 passes, rather waste
** (possibly) some memory
*/
- zo = sqlite3_malloc(strlen(zi1)+1);
+ zo = sqlite3_malloc(strlen(zi1)+1);
if (!zo){
sqlite3_result_error_nomem(context);
return;
}
zot = zo;
@@ -963,15 +963,15 @@
int c1,c2;
if( '\0'==*z1 ){
return -1;
}
-
+
while( (sqliteCharVal((unsigned char *)z2) != 0) && (c++) 0 ){
sqliteNextChar(zt);
}
rz = sqlite3_malloc(ze-zt+1);
@@ -1126,11 +1126,11 @@
if (!rz){
sqlite3_result_error_nomem(context);
return;
}
strcpy((char*) rz, (char*) (zt));
- sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT);
sqlite3_free(rz);
}
#ifndef HAVE_TRIM
/*
@@ -1164,11 +1164,11 @@
if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
sqlite3_result_null(context);
return;
}
z = sqlite3_value_text(argv[0]);
- sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT);
}
/*
** Removes the whitespace at the end of a string
*/
@@ -1216,15 +1216,17 @@
** given a pointer to a string s1, the length of that string (l1), a new string (s2)
** and it's length (l2) appends s2 to s1.
** All lengths in bytes.
** This is just an auxiliary function
*/
-// static void _append(char **s1, int l1, const char *s2, int l2){
-// *s1 = realloc(*s1, (l1+l2+1)*sizeof(char));
-// strncpy((*s1)+l1, s2, l2);
-// *(*(s1)+l1+l2) = '\0';
-// }
+/*
+ static void _append(char **s1, int l1, const char *s2, int l2){
+ *s1 = realloc(*s1, (l1+l2+1)*sizeof(char));
+ strncpy((*s1)+l1, s2, l2);
+ *(*(s1)+l1+l2) = '\0';
+ }
+*/
#ifndef HAVE_TRIM
/*
** given strings s, s1 and s2 replaces occurrences of s1 in s by s2
@@ -1403,11 +1405,11 @@
assert( argc==1 );
type = sqlite3_value_numeric_type(argv[0]);
if( type == SQLITE_NULL)
return;
-
+
p = sqlite3_aggregate_context(context, sizeof(*p));
if( 0==(p->m) ){
p->m = calloc(1, sizeof(map));
if( type==SQLITE_INTEGER ){
@@ -1442,11 +1444,11 @@
*/
static void modeIterate(void* e, i64 c, void* pp){
i64 ei;
double ed;
ModeCtx *p = (ModeCtx*)pp;
-
+
if( 0==p->is_double ){
ei = *(int*)(e);
if( p->mcnt==c ){
++p->mn;
@@ -1468,11 +1470,11 @@
}
}
/*
** Auxiliary function that iterates all elements in a map and finds the median
-** (the value such that the number of elements smaller is equal the the number of
+** (the value such that the number of elements smaller is equal the the number of
** elements larger)
*/
static void medianIterate(void* e, i64 c, void* pp){
i64 ei;
double ed;
@@ -1661,16 +1663,16 @@
int i = 0;
const u8 *zIn1;
const u8 *zIn2;
assert( argc==2 );
-
+
if( sqlite3_value_type(argv[0])==SQLITE_NULL || sqlite3_value_type(argv[1])==SQLITE_NULL ){
sqlite3_result_null(context);
return;
}
-
+
zIn1 = (u8*)sqlite3_value_text(argv[0]);
zIn2 = (u8*)sqlite3_value_text(argv[1]);
soundex(zIn1, zR1);
soundex(zIn2, zR2);
@@ -1785,17 +1787,17 @@
void *pArg = 0;
switch( aFuncs[i].argType ){
case 1: pArg = db; break;
case 2: pArg = (void *)(-1); break;
}
- //sqlite3CreateFunc
+ /* sqlite3CreateFunc */
/* LMH no error checking */
sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
#if 1
if( aFuncs[i].needCollSeq ){
- struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName,
+ struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName,
strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
if( pFunc && aFuncs[i].needCollSeq ){
pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
}
}
@@ -1806,13 +1808,13 @@
void *pArg = 0;
switch( aAggs[i].argType ){
case 1: pArg = db; break;
case 2: pArg = (void *)(-1); break;
}
- //sqlite3CreateFunc
+ /* sqlite3CreateFunc */
/* LMH no error checking */
- sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8,
+ sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8,
pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
#if 0
if( aAggs[i].needCollSeq ){
struct FuncDefAgg *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
strlen(aAggs[i].zName), aAggs[i].nArg, SQLITE_UTF8, 0);
Index: SQLite.Interop/src/win/SQLite.Interop.rc
==================================================================
--- SQLite.Interop/src/win/SQLite.Interop.rc
+++ SQLite.Interop/src/win/SQLite.Interop.rc
@@ -12,22 +12,22 @@
#endif
#include "..\core\sqlite3.h"
#include "interop.h"
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+/*
+** English (U.S.) resources
+*/
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
+/*
+** Version
+*/
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTEROP_RC_VERSION
PRODUCTVERSION INTEROP_RC_VERSION
FILEFLAGSMASK 0x17L
Index: SQLite.Interop/src/win/crypt.c
==================================================================
--- SQLite.Interop/src/win/crypt.c
+++ SQLite.Interop/src/win/crypt.c
@@ -6,46 +6,43 @@
********************************************************/
#ifndef SQLITE_OMIT_DISKIO
#ifdef SQLITE_HAS_CODEC
-//#ifdef SQLITE_DEBUG
-//#include "splitsource\pager.c"
-//#endif
-
#include
#include
-// Extra padding before and after the cryptographic buffer
+/* Extra padding before and after the cryptographic buffer */
#define CRYPT_OFFSET 8
typedef struct _CRYPTBLOCK
{
- Pager *pPager; // Pager this cryptblock belongs to
- HCRYPTKEY hReadKey; // Key used to read from the database and write to the journal
- HCRYPTKEY hWriteKey; // Key used to write to the database
- DWORD dwPageSize; // Size of pages
- LPVOID pvCrypt; // A buffer for encrypting/decrypting (if necessary)
- DWORD dwCryptSize; // Equal to or greater than dwPageSize. If larger, pvCrypt is valid and this is its size
+ Pager *pPager; /* Pager this cryptblock belongs to */
+ HCRYPTKEY hReadKey; /* Key used to read from the database and write to the journal */
+ HCRYPTKEY hWriteKey; /* Key used to write to the database */
+ DWORD dwPageSize; /* Size of pages */
+ LPVOID pvCrypt; /* A buffer for encrypting/decrypting (if necessary) */
+ DWORD dwCryptSize; /* Equal to or greater than dwPageSize. If larger, pvCrypt is valid and this is its size */
} CRYPTBLOCK, *LPCRYPTBLOCK;
-HCRYPTPROV g_hProvider = 0; // Global instance of the cryptographic provider
+HCRYPTPROV g_hProvider = 0; /* Global instance of the cryptographic provider */
#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"
-// Needed for re-keying
+/* Needed for re-keying */
static void * sqlite3pager_get_codecarg(Pager *pPager)
{
return (pPager->xCodec) ? pPager->pCodec: NULL;
}
void sqlite3_activate_see(const char *info)
{
}
-// Create a cryptographic context. Use the enhanced provider because it is available on
-// most platforms
+/* Create a cryptographic context. Use the enhanced provider because it is available on
+** most platforms
+*/
static BOOL InitializeProvider()
{
if (g_hProvider) return TRUE;
if (!CryptAcquireContext(&g_hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
@@ -53,28 +50,29 @@
return FALSE;
}
return TRUE;
}
-// Create or update a cryptographic context for a pager.
-// This function will automatically determine if the encryption algorithm requires
-// extra padding, and if it does, will create a temp buffer big enough to provide
-// space to hold it.
+/* Create or update a cryptographic context for a pager.
+** This function will automatically determine if the encryption algorithm requires
+** extra padding, and if it does, will create a temp buffer big enough to provide
+** space to hold it.
+*/
static LPCRYPTBLOCK CreateCryptBlock(HCRYPTKEY hKey, Pager *pager, int pageSize, LPCRYPTBLOCK pExisting)
{
LPCRYPTBLOCK pBlock;
- if (!pExisting) // Creating a new cryptblock
+ if (!pExisting) /* Creating a new cryptblock */
{
pBlock = sqlite3_malloc(sizeof(CRYPTBLOCK));
if (!pBlock) return NULL;
ZeroMemory(pBlock, sizeof(CRYPTBLOCK));
pBlock->hReadKey = hKey;
pBlock->hWriteKey = hKey;
}
- else // Updating an existing cryptblock
+ else /* Updating an existing cryptblock */
{
pBlock = pExisting;
}
if (pageSize == -1)
@@ -82,55 +80,55 @@
pBlock->pPager = pager;
pBlock->dwPageSize = (DWORD)pageSize;
pBlock->dwCryptSize = pBlock->dwPageSize;
- // Existing cryptblocks may have a buffer, if so, delete it
+ /* Existing cryptblocks may have a buffer, if so, delete it */
if (pBlock->pvCrypt)
{
sqlite3_free(pBlock->pvCrypt);
pBlock->pvCrypt = NULL;
}
- // Figure out how big to make our spare crypt block
+ /* Figure out how big to make our spare crypt block */
CryptEncrypt(hKey, 0, TRUE, 0, NULL, &pBlock->dwCryptSize, pBlock->dwCryptSize * 2);
pBlock->pvCrypt = sqlite3_malloc(pBlock->dwCryptSize + (CRYPT_OFFSET * 2));
if (!pBlock->pvCrypt)
{
- // We created a new block in here, so free it. Otherwise leave the original intact
- if (pBlock != pExisting)
+ /* We created a new block in here, so free it. Otherwise leave the original intact */
+ if (pBlock != pExisting)
sqlite3_free(pBlock);
return NULL;
}
return pBlock;
}
-// Destroy a cryptographic context and any buffers and keys allocated therein
+/* Destroy a cryptographic context and any buffers and keys allocated therein */
static void sqlite3CodecFree(LPVOID pv)
{
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pv;
- // Destroy the read key if there is one
+ /* Destroy the read key if there is one */
if (pBlock->hReadKey)
{
CryptDestroyKey(pBlock->hReadKey);
}
- // If there's a writekey and its not equal to the readkey, destroy it
+ /* If there's a writekey and its not equal to the readkey, destroy it */
if (pBlock->hWriteKey && pBlock->hWriteKey != pBlock->hReadKey)
{
CryptDestroyKey(pBlock->hWriteKey);
}
- // If there's extra buffer space allocated, free it as well
+ /* If there's extra buffer space allocated, free it as well */
if (pBlock->pvCrypt)
{
sqlite3_free(pBlock->pvCrypt);
}
- // All done with this cryptblock
+ /* All done with this cryptblock */
sqlite3_free(pBlock);
}
void sqlite3CodecSizeChange(void *pArg, int pageSize, int reservedSize)
{
@@ -137,32 +135,32 @@
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;
if (pBlock->dwPageSize != pageSize)
{
CreateCryptBlock(pBlock->hReadKey, pBlock->pPager, pageSize, pBlock);
- // If this fails, pvCrypt will be NULL, and the next time sqlite3Codec() is called, it will result in an error
+ /* If this fails, pvCrypt will be NULL, and the next time sqlite3Codec() is called, it will result in an error */
}
}
-// Encrypt/Decrypt functionality, called by pager.c
+/* Encrypt/Decrypt functionality, called by pager.c */
void * sqlite3Codec(void *pArg, void *data, Pgno nPageNum, int nMode)
{
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;
DWORD dwPageSize;
LPVOID pvTemp = NULL;
if (!pBlock) return data;
- if (pBlock->pvCrypt == NULL) return NULL; // This only happens if CreateCryptBlock() failed to make scratch space
+ if (pBlock->pvCrypt == NULL) return NULL; /* This only happens if CreateCryptBlock() failed to make scratch space */
switch(nMode)
{
- case 0: // Undo a "case 7" journal file encryption
- case 2: // Reload a page
- case 3: // Load a page
+ case 0: /* Undo a "case 7" journal file encryption */
+ case 2: /* Reload a page */
+ case 3: /* Load a page */
if (!pBlock->hReadKey) break;
- /* Block ciphers often need to write extra padding beyond the
+ /* Block ciphers often need to write extra padding beyond the
data block. We don't have that luxury for a given page of data so
we must copy the page data to a buffer that IS large enough to hold
the padding. We then encrypt the block and write the buffer back to
the page without the unnecessary padding.
We only use the special block of memory if its absolutely necessary. */
@@ -174,29 +172,30 @@
}
dwPageSize = pBlock->dwCryptSize;
CryptDecrypt(pBlock->hReadKey, 0, TRUE, 0, (LPBYTE)data, &dwPageSize);
- // If the encryption algorithm required extra padding and we were forced to encrypt or
- // decrypt a copy of the page data to a temp buffer, then write the contents of the temp
- // buffer back to the page data minus any padding applied.
+ /* If the encryption algorithm required extra padding and we were forced to encrypt or
+ ** decrypt a copy of the page data to a temp buffer, then write the contents of the temp
+ ** buffer back to the page data minus any padding applied.
+ */
if (pBlock->dwCryptSize != pBlock->dwPageSize)
{
CopyMemory(pvTemp, data, pBlock->dwPageSize);
data = pvTemp;
}
break;
- case 6: // Encrypt a page for the main database file
+ case 6: /* Encrypt a page for the main database file */
if (!pBlock->hWriteKey) break;
CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;
dwPageSize = pBlock->dwPageSize;
CryptEncrypt(pBlock->hWriteKey, 0, TRUE, 0, ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, &dwPageSize, pBlock->dwCryptSize);
break;
- case 7: // Encrypt a page for the journal file
+ case 7: /* Encrypt a page for the journal file */
/* Under normal circumstances, the readkey is the same as the writekey. However,
when the database is being rekeyed, the readkey is not the same as the writekey.
The rollback journal must be written using the original key for the
database file because it is, by nature, a rollback journal.
Therefore, for case 7, when the rollback is being written, always encrypt using
@@ -214,11 +213,11 @@
}
return data;
}
-// Derive an encryption key from a user-supplied buffer
+/* Derive an encryption key from a user-supplied buffer */
static HCRYPTKEY DeriveKey(const void *pKey, int nKeyLen)
{
HCRYPTHASH hHash = 0;
HCRYPTKEY hKey;
@@ -234,69 +233,69 @@
if (CryptHashData(hHash, (LPBYTE)pKey, nKeyLen, 0))
{
CryptDeriveKey(g_hProvider, CALG_RC4, hHash, 0, &hKey);
}
CryptDestroyHash(hHash);
- }
+ }
return hKey;
}
-// Called by sqlite and sqlite3_key_interop to attach a key to a database.
+/* Called by sqlite and sqlite3_key_interop to attach a key to a database. */
int sqlite3CodecAttach(sqlite3 *db, int nDb, const void *pKey, int nKeyLen)
{
int rc = SQLITE_ERROR;
HCRYPTKEY hKey = 0;
- // No key specified, could mean either use the main db's encryption or no encryption
+ /* No key specified, could mean either use the main db's encryption or no encryption */
if (!pKey || !nKeyLen)
{
if (!nDb)
{
- return SQLITE_OK; // Main database, no key specified so not encrypted
+ return SQLITE_OK; /* Main database, no key specified so not encrypted */
}
- else // Attached database, use the main database's key
+ else /* Attached database, use the main database's key */
{
- // Get the encryption block for the main database and attempt to duplicate the key
- // for use by the attached database
+ /* Get the encryption block for the main database and attempt to duplicate the key
+ ** for use by the attached database
+ */
Pager *p = sqlite3BtreePager(db->aDb[0].pBt);
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
- if (!pBlock) return SQLITE_OK; // Main database is not encrypted so neither will be any attached database
- if (!pBlock->hReadKey) return SQLITE_OK; // Not encrypted
+ if (!pBlock) return SQLITE_OK; /* Main database is not encrypted so neither will be any attached database */
+ if (!pBlock->hReadKey) return SQLITE_OK; /* Not encrypted */
if (!CryptDuplicateKey(pBlock->hReadKey, NULL, 0, &hKey))
- return rc; // Unable to duplicate the key
+ return rc; /* Unable to duplicate the key */
}
}
- else // User-supplied passphrase, so create a cryptographic key out of it
+ else /* User-supplied passphrase, so create a cryptographic key out of it */
{
hKey = DeriveKey(pKey, nKeyLen);
if (hKey == MAXDWORD)
{
sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
return rc;
}
}
- // Create a new encryption block and assign the codec to the new attached database
+ /* Create a new encryption block and assign the codec to the new attached database */
if (hKey)
{
Pager *p = sqlite3BtreePager(db->aDb[nDb].pBt);
LPCRYPTBLOCK pBlock = CreateCryptBlock(hKey, p, -1, NULL);
if (!pBlock) return SQLITE_NOMEM;
sqlite3PagerSetCodec(p, sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);
- //db->aDb[nDb].pAux = pBlock;
- //db->aDb[nDb].xFreeAux = DestroyCryptBlock;
rc = SQLITE_OK;
}
return rc;
}
-// Once a password has been supplied and a key created, we don't keep the
-// original password for security purposes. Therefore return NULL.
+/* Once a password has been supplied and a key created, we don't keep the
+** original password for security purposes. Therefore return NULL.
+*/
void sqlite3CodecGetKey(sqlite3 *db, int nDb, void **ppKey, int *pnKeyLen)
{
Btree *pbt = db->aDb[0].pBt;
Pager *p = sqlite3BtreePager(pbt);
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
@@ -303,17 +302,17 @@
if (ppKey) *ppKey = 0;
if (pnKeyLen && pBlock) *pnKeyLen = 1;
}
-// We do not attach this key to the temp store, only the main database.
+/* We do not attach this key to the temp store, only the main database. */
SQLITE_API int sqlite3_key(sqlite3 *db, const unsigned char *pKey, int nKeySize)
{
return sqlite3CodecAttach(db, 0, pKey, nKeySize);
}
-// Changes the encryption key for an existing database.
+/* Changes the encryption key for an existing database. */
SQLITE_API int sqlite3_rekey(sqlite3 *db, const unsigned char *pKey, int nKeySize)
{
Btree *pbt = db->aDb[0].pBt;
Pager *p = sqlite3BtreePager(pbt);
LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
@@ -324,38 +323,37 @@
{
sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
return rc;
}
- if (!pBlock && !hKey) return SQLITE_OK; // Wasn't encrypted to begin with
+ if (!pBlock && !hKey) return SQLITE_OK; /* Wasn't encrypted to begin with */
- // To rekey a database, we change the writekey for the pager. The readkey remains
- // the same
- if (!pBlock) // Encrypt an unencrypted database
+ /* To rekey a database, we change the writekey for the pager. The readkey remains
+ ** the same
+ */
+ if (!pBlock) /* Encrypt an unencrypted database */
{
pBlock = CreateCryptBlock(hKey, p, -1, NULL);
if (!pBlock)
return SQLITE_NOMEM;
- pBlock->hReadKey = 0; // Original database is not encrypted
+ pBlock->hReadKey = 0; /* Original database is not encrypted */
sqlite3PagerSetCodec(sqlite3BtreePager(pbt), sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);
- //db->aDb[0].pAux = pBlock;
- //db->aDb[0].xFreeAux = DestroyCryptBlock;
}
- else // Change the writekey for an already-encrypted database
+ else /* Change the writekey for an already-encrypted database */
{
pBlock->hWriteKey = hKey;
}
sqlite3_mutex_enter(db->mutex);
- // Start a transaction
+ /* Start a transaction */
rc = sqlite3BtreeBeginTrans(pbt, 1);
if (!rc)
{
- // Rewrite all the pages in the database using the new encryption key
+ /* Rewrite all the pages in the database using the new encryption key */
Pgno nPage;
Pgno nSkip = PAGER_MJ_PGNO(p);
DbPage *pPage;
Pgno n;
int count;
@@ -373,45 +371,48 @@
sqlite3PagerUnref(pPage);
}
}
}
- // If we succeeded, try and commit the transaction
+ /* If we succeeded, try and commit the transaction */
if (!rc)
{
rc = sqlite3BtreeCommit(pbt);
}
- // If we failed, rollback
+ // If we failed, rollback */
if (rc)
{
sqlite3BtreeRollback(pbt, SQLITE_OK);
}
- // If we succeeded, destroy any previous read key this database used
- // and make the readkey equal to the writekey
+ /* If we succeeded, destroy any previous read key this database used
+ ** and make the readkey equal to the writekey
+ */
if (!rc)
{
if (pBlock->hReadKey)
{
CryptDestroyKey(pBlock->hReadKey);
}
pBlock->hReadKey = pBlock->hWriteKey;
}
- // We failed. Destroy the new writekey (if there was one) and revert it back to
- // the original readkey
+ /* We failed. Destroy the new writekey (if there was one) and revert it back to
+ ** the original readkey
+ */
else
{
if (pBlock->hWriteKey)
{
CryptDestroyKey(pBlock->hWriteKey);
}
pBlock->hWriteKey = pBlock->hReadKey;
}
- // If the readkey and writekey are both empty, there's no need for a codec on this
- // pager anymore. Destroy the crypt block and remove the codec from the pager.
+ /* If the readkey and writekey are both empty, there's no need for a codec on this
+ ** pager anymore. Destroy the crypt block and remove the codec from the pager.
+ */
if (!pBlock->hReadKey && !pBlock->hWriteKey)
{
sqlite3PagerSetCodec(p, NULL, NULL, NULL, NULL);
}
@@ -418,8 +419,7 @@
sqlite3_mutex_leave(db->mutex);
return rc;
}
-#endif // SQLITE_HAS_CODEC
-
-#endif // SQLITE_OMIT_DISKIO
+#endif /* SQLITE_HAS_CODEC */
+#endif /* SQLITE_OMIT_DISKIO */
Index: SQLite.Interop/src/win/interop.c
==================================================================
--- SQLite.Interop/src/win/interop.c
+++ SQLite.Interop/src/win/interop.c
@@ -12,19 +12,15 @@
#if defined(INTEROP_EXTENSION_FUNCTIONS)
#include "../contrib/extension-functions.c"
extern int RegisterExtensionFunctions(sqlite3 *db);
#endif
+#ifdef SQLITE_OS_WIN
#if defined(INTEROP_CODEC)
#include "crypt.c"
#endif
-#ifdef SQLITE_OS_WIN
-
-// Additional open flags, we use this one privately
-//#define SQLITE_OPEN_SHAREDCACHE 0x01000000
-
typedef void (*SQLITEUSERFUNC)(sqlite3_context *, int, sqlite3_value **);
typedef void (*SQLITEFUNCFINAL)(sqlite3_context *);
#if SQLITE_VERSION_NUMBER < 3007014
SQLITE_PRIVATE void * sqlite3DbMallocZero_interop(sqlite3 *db, int n)
@@ -85,11 +81,11 @@
return ret;
}
while (db->pVdbe)
{
- // Make a copy of the first prepared statement
+ /* Make a copy of the first prepared statement */
Vdbe *p = (Vdbe *)sqlite3DbMallocZero_interop(db, sizeof(Vdbe));
Vdbe *po = db->pVdbe;
if (!p)
{
@@ -97,23 +93,23 @@
break;
}
CopyMemory(p, po, sizeof(Vdbe));
- // Put it on the chain so we can free it
+ /* Put it on the chain so we can free it */
db->pVdbe = p;
- ret = sqlite3_finalize((sqlite3_stmt *)p); // This will also free the copy's memory
+ ret = sqlite3_finalize((sqlite3_stmt *)p); /* This will also free the copy's memory */
if (ret)
{
- // finalize failed -- so we must put back anything we munged
+ /* finalize failed -- so we must put back anything we munged */
CopyMemory(po, p, sizeof(Vdbe));
db->pVdbe = po;
- //
- // NOTE: Ok, we must free this block that *we* allocated (above) since
- // finalize did not do so.
- //
+ /*
+ ** NOTE: Ok, we must free this block that *we* allocated (above) since
+ ** finalize did not do so.
+ */
sqlite3DbFree_interop(db, p);
break;
}
else
{
@@ -129,16 +125,12 @@
}
SQLITE_API int WINAPI sqlite3_open_interop(const char*filename, int flags, sqlite3 **ppdb)
{
int ret;
- //int sharedcache = ((flags & SQLITE_OPEN_SHAREDCACHE) != 0);
- //flags &= ~SQLITE_OPEN_SHAREDCACHE;
- //sqlite3_enable_shared_cache(sharedcache);
ret = sqlite3_open_v2(filename, ppdb, flags, NULL);
- //sqlite3_enable_shared_cache(0);
#if defined(INTEROP_EXTENSION_FUNCTIONS)
if (ret == 0)
RegisterExtensionFunctions(*ppdb);
#endif
@@ -548,7 +540,57 @@
}
sqlite3_mutex_leave(db->mutex);
return ret;
}
+#endif /* SQLITE_OS_WIN */
+
+/*****************************************************************************/
+
+/*
+** The INTEROP_TEST_EXTENSION block must be at the end of this source file
+** because it includes the "sqlite3ext.h" file, which defines the sqlite3
+** public API function names to be macros and that would cause the code
+** above this point to malfunction.
+*/
+#if defined(INTEROP_TEST_EXTENSION)
+#include "../core/sqlite3ext.h"
+SQLITE_EXTENSION_INIT1
+
+/*
+** The interopTest() SQL function returns its first argument or raises an
+** error if there are not enough arguments.
+*/
+static void interopTestFunc(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ const unsigned char *z;
+ if( argc!=1 ){
+ sqlite3_result_error(context, "need exactly one argument", -1);
+ return;
+ }
+ z = sqlite3_value_text(argv[0]);
+ if( z ){
+ sqlite3_result_text(context, (char*)z, -1, SQLITE_STATIC);
+ }else{
+ sqlite3_result_null(context);
+ }
+}
-#endif // SQLITE_OS_WIN
+/* SQLite invokes this routine once when it loads the extension.
+** Create new functions, collating sequences, and virtual table
+** modules here. This is usually the only exported symbol in
+** the shared library.
+*/
+SQLITE_API int interop_test_extension_init(
+ sqlite3 *db,
+ char **pzErrMsg,
+ const sqlite3_api_routines *pApi
+){
+ SQLITE_EXTENSION_INIT2(pApi)
+ sqlite3_create_function(db, "interopTest", -1, SQLITE_ANY, 0,
+ interopTestFunc, 0, 0);
+ return 0;
+}
+#endif
Index: SQLite.NET.Settings.targets
==================================================================
--- SQLite.NET.Settings.targets
+++ SQLite.NET.Settings.targets
@@ -145,10 +145,26 @@
for the corresponding version(s) of Visual Studio.
-->
true
+
+ true
+ false
+
-
+
Component
-
+
Code
Index: System.Data.SQLite/System.Data.SQLite.Module.2008.csproj
==================================================================
--- System.Data.SQLite/System.Data.SQLite.Module.2008.csproj
+++ System.Data.SQLite/System.Data.SQLite.Module.2008.csproj
@@ -19,11 +19,11 @@
System.Data.SQLite
System.Data.SQLite
2.0
false
$(MSBuildProjectDirectory)\..
- true
+ true
2008
Module
false
false
Index: System.Data.SQLite/System.Data.SQLite.Module.2010.csproj
==================================================================
--- System.Data.SQLite/System.Data.SQLite.Module.2010.csproj
+++ System.Data.SQLite/System.Data.SQLite.Module.2010.csproj
@@ -20,10 +20,11 @@
System.Data.SQLite
3.5
Client
false
$(MSBuildProjectDirectory)\..
+ true
2010
Module
false
false
Index: System.Data.SQLite/System.Data.SQLite.Module.2012.csproj
==================================================================
--- System.Data.SQLite/System.Data.SQLite.Module.2012.csproj
+++ System.Data.SQLite/System.Data.SQLite.Module.2012.csproj
@@ -17,10 +17,11 @@
Properties
System.Data.SQLite
System.Data.SQLite
false
$(MSBuildProjectDirectory)\..
+ true
2012
v4.5
Module
false
false
Index: System.Data.SQLite/System.Data.SQLite.Properties.targets
==================================================================
--- System.Data.SQLite/System.Data.SQLite.Properties.targets
+++ System.Data.SQLite/System.Data.SQLite.Properties.targets
@@ -8,20 +8,40 @@
-->
-
+
$(DefineConstants);NET_20
+
+
+ $(DefineConstants);NET_35
+
+
+
+
+ $(DefineConstants);NET_40
+
+
$(DefineConstants);INTEROP_EXTENSION_FUNCTIONS
+
+
+ $(DefineConstants);INTEROP_TEST_EXTENSION
+
+
Index: System.Data.SQLite/UnsafeNativeMethods.cs
==================================================================
--- System.Data.SQLite/UnsafeNativeMethods.cs
+++ System.Data.SQLite/UnsafeNativeMethods.cs
@@ -579,14 +579,14 @@
[DllImport(SQLITE_DLL)]
internal static extern SQLiteErrorCode sqlite3_finalize_interop(IntPtr stmt);
[DllImport(SQLITE_DLL)]
- internal static extern SQLiteErrorCode sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db);
+ internal static extern SQLiteErrorCode sqlite3_open_interop(byte[] utf8Filename, SQLiteOpenFlagsEnum flags, out IntPtr db);
[DllImport(SQLITE_DLL)]
- internal static extern SQLiteErrorCode sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db);
+ internal static extern SQLiteErrorCode sqlite3_open16_interop(byte[] utf8Filename, SQLiteOpenFlagsEnum flags, out IntPtr db);
[DllImport(SQLITE_DLL)]
internal static extern SQLiteErrorCode sqlite3_reset_interop(IntPtr stmt);
#endif
@@ -625,24 +625,10 @@
#else
[DllImport(SQLITE_DLL)]
#endif
internal static extern SQLiteErrorCode sqlite3_finalize(IntPtr stmt);
-#if !PLATFORM_COMPACTFRAMEWORK
- [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
-#else
- [DllImport(SQLITE_DLL)]
-#endif
- internal static extern SQLiteErrorCode sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs);
-
-#if !PLATFORM_COMPACTFRAMEWORK
- [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
-#else
- [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
-#endif
- internal static extern SQLiteErrorCode sqlite3_open16(string fileName, out IntPtr db);
-
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport(SQLITE_DLL)]
#endif
@@ -809,10 +795,26 @@
#endregion
// Standard API calls global across versions. There are a few instances of interop calls
// scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared.
#region standard sqlite api calls
+#if !PLATFORM_COMPACTFRAMEWORK
+ [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
+#else
+ [DllImport(SQLITE_DLL)]
+#endif
+ internal static extern SQLiteErrorCode sqlite3_enable_load_extension(
+ IntPtr db, int enable);
+
+#if !PLATFORM_COMPACTFRAMEWORK
+ [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
+#else
+ [DllImport(SQLITE_DLL)]
+#endif
+ internal static extern SQLiteErrorCode sqlite3_load_extension(
+ IntPtr db, byte[] fileName, byte[] procName, ref IntPtr pError);
+
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
[DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
@@ -851,10 +853,24 @@
#else
[DllImport(SQLITE_DLL)]
#endif
internal static extern void sqlite3_free(IntPtr p);
+#if !PLATFORM_COMPACTFRAMEWORK
+ [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
+#else
+ [DllImport(SQLITE_DLL)]
+#endif
+ internal static extern SQLiteErrorCode sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, SQLiteOpenFlagsEnum flags, IntPtr vfs);
+
+#if !PLATFORM_COMPACTFRAMEWORK
+ [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
+#else
+ [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
+#endif
+ internal static extern SQLiteErrorCode sqlite3_open16(string fileName, out IntPtr db);
+
#if !PLATFORM_COMPACTFRAMEWORK
[DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
[DllImport(SQLITE_DLL)]
#endif
Index: Tests/basic.eagle
==================================================================
--- Tests/basic.eagle
+++ Tests/basic.eagle
@@ -1026,11 +1026,11 @@
0 \{True, Read Only=True\} 0 \{secret, Password=secret\} 0 \{4096, Page\
Size=4096\} 0 \{1024, Max Page Count=1024\} 0 \{8192, Cache Size=8192\} 0\
\{UnixEpoch, DateTimeFormat=UnixEpoch\} 0 \{Utc, DateTimeKind=Utc\} 0\
\{sqlite_schema, BaseSchemaName=sqlite_schema\} 0 \{Memory, Journal\
Mode=Memory\} 0 \{Serializable, Default IsolationLevel=Serializable\} 0\
-\{False, Foreign Keys=False\} 0 \{LogCallbackException,\
+\{False, Foreign Keys=False\} 0 \{(?:Default|LogCallbackException),\
Flags=(?:Default|LogCallbackException)\} 0 \{False, SetDefaults=False\} 0\
\{False, ToFullPath=False\}$}}
###############################################################################
@@ -1890,10 +1890,42 @@
unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 2 1}}
+
+###############################################################################
+
+runTest {test data-1.38 {NoExtensionFunctions connection flag} -setup {
+ setupDb [set fileName data-1.38.db]
+} -body {
+ set result [list]
+
+ lappend result [catch {sql execute -execute scalar $db \
+ "SELECT replicate('1234', 2);"} output] $output
+
+ cleanupDb $fileName
+ setupDb $fileName "" "" "" NoExtensionFunctions
+
+ lappend result [catch {sql execute -execute scalar $db \
+ "SELECT replicate('1234', 3);"} output] $output
+
+ cleanupDb $fileName
+ setupDb $fileName
+
+ lappend result [catch {sql execute -execute scalar $db \
+ "SELECT replicate('1234', 4);"} output] $output
+
+ set result
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain result db fileName
+} -constraints \
+{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
+regexp -result {^0 12341234 1 \{System\.Data\.SQLite\.SQLiteException\
+\(0x80004005\): SQL logic error or missing database.*?\} 0 1234123412341234$}}
###############################################################################
unset -nocomplain systemDataSQLiteDllFile systemDataSQLiteLinqDllFile \
testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile
Index: Tests/common.eagle
==================================================================
--- Tests/common.eagle
+++ Tests/common.eagle
@@ -495,10 +495,45 @@
}
}
return $result
}
+
+ proc catchAndReturn { script {stackTrace false} {strict true} } {
+ #
+ # NOTE: Evaluate the script provided by the caller in their context,
+ # capturing both the result and the return code.
+ #
+ set code [catch {uplevel 1 $script} result]
+
+ #
+ # NOTE: Did the script provided by the caller NOT raise an error?
+ #
+ if {$strict && $code == 0 || !$strict && $code != 1} then {
+ #
+ # NOTE: Success. Return a list with the return code and the result.
+ #
+ return [list $code $result]
+ } elseif {$stackTrace} then {
+ #
+ # NOTE: Failure. The caller wants a full stack trace (if applicable),
+ # return a list with the return code and the result verbatim.
+ #
+ return [list $code $result]
+ } else {
+ #
+ # NOTE: Failure. The caller does not want a full stack trace (if
+ # applicable), return a list with the return code, the error
+ # code for the interpreter, and the error message up to the
+ # point where the stack trace should start.
+ #
+ set index [string first " at " $result]; # HACK: Reliable?
+
+ return [list $code $::errorCode [expr {$index != -1 ? \
+ [string trim [string range $result 0 $index]] : $result}]]
+ }
+ }
proc compileCSharpWith {
text memory symbols strict resultsVarName errorsVarName fileNames
args } {
#
@@ -1031,10 +1066,13 @@
checkForSQLiteDefineConstant $::test_channel \
USE_INTEROP_DLL
checkForSQLiteDefineConstant $::test_channel \
INTEROP_EXTENSION_FUNCTIONS
+
+ checkForSQLiteDefineConstant $::test_channel \
+ INTEROP_TEST_EXTENSION
#
# NOTE: Report the resource usage prior to running any tests.
#
reportSQLiteResources $::test_channel
ADDED Tests/tkt-17045010df.eagle
Index: Tests/tkt-17045010df.eagle
==================================================================
--- /dev/null
+++ Tests/tkt-17045010df.eagle
@@ -0,0 +1,72 @@
+###############################################################################
+#
+# tkt-17045010df.eagle --
+#
+# Written by Joe Mistachkin.
+# Released to the public domain, use at your own risk!
+#
+###############################################################################
+
+package require Eagle
+package require Eagle.Library
+package require Eagle.Test
+
+runTestPrologue
+
+###############################################################################
+
+package require System.Data.SQLite.Test
+runSQLiteTestPrologue
+
+###############################################################################
+
+runTest {test tkt-17045010df-1.1 {EnableExtensions & LoadExtension} -setup {
+ setupDb [set fileName tkt-17045010df-1.1.db]
+} -body {
+ set connection [object invoke -flags +NonPublic -objectflags +NoDispose \
+ -alias Interpreter.GetActive.connections get_Item $db]
+
+ lappend result [catchAndReturn {$connection EnableExtensions false}]
+ lappend result [catchAndReturn {$connection LoadExtension [file join \
+ [getBinaryDirectory] SQLite.Interop.dll] interop_test_extension_init}]
+
+ lappend result [catchAndReturn {sql execute -execute scalar $db \
+ "SELECT interopTest('test1');"}]
+ lappend result [catchAndReturn {sql execute -execute scalar $db \
+ "SELECT interopTest('test1', '1234');"}]
+
+ lappend result [catchAndReturn {$connection EnableExtensions true}]
+ lappend result [catchAndReturn {$connection LoadExtension [file join \
+ [getBinaryDirectory] SQLite.Interop.dll] interop_test_extension_init}]
+
+ lappend result [catchAndReturn {sql execute -execute scalar $db \
+ "SELECT interopTest('test2');"}]
+ lappend result [catchAndReturn {sql execute -execute scalar $db \
+ "SELECT interopTest('test2', '5678');"}]
+
+ string map [list \r\n ", "] $result
+} -cleanup {
+ unset -nocomplain result connection
+
+ cleanupDb $fileName
+
+ unset -nocomplain db fileName
+} -constraints \
+{eagle monoBug28 defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
+command.sql compile.DATA SQLite System.Data.SQLite} -result {{0 {}} {1\
+{EXCEPTION System.Data.SQLite.SQLiteException}\
+{System.Reflection.TargetInvocationException: Exception has been thrown by the\
+target of an invocation. ---> System.Data.SQLite.SQLiteException: SQL logic\
+error or missing database, not authorized}} {1 {EXCEPTION\
+System.Data.SQLite.SQLiteException} {System.Data.SQLite.SQLiteException\
+(0x80004005): SQL logic error or missing database, no such function:\
+interopTest}} {1 {EXCEPTION System.Data.SQLite.SQLiteException}\
+{System.Data.SQLite.SQLiteException (0x80004005): SQL logic error or missing\
+database, no such function: interopTest}} {0 {}} {0 {}} {0 test2} {1 {EXCEPTION\
+System.Data.SQLite.SQLiteException} {System.Data.SQLite.SQLiteException\
+(0x80004005): SQL logic error or missing database, need exactly one argument}}}}
+
+###############################################################################
+
+runSQLiteTestEpilogue
+runTestEpilogue
Index: readme.htm
==================================================================
--- readme.htm
+++ readme.htm
@@ -191,10 +191,13 @@
- Updated to SQLite 3.7.15.
- Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.
- Add Visual Studio 2012 support to the redesigned designer support installer.
+ - Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.
+ - Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class.
+ - Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.
- Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.
- All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.
- Make sure the error code of the SQLiteException class gets serialized.
- Make the test project for the .NET Compact Framework more flexible.
- When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.
Index: test/test.2008.csproj
==================================================================
--- test/test.2008.csproj
+++ test/test.2008.csproj
@@ -18,11 +18,11 @@
Exe
test
test
2.0
$(MSBuildProjectDirectory)\..
- true
+ true
2008
$(BinaryOutputPath)
Index: test/test.2010.csproj
==================================================================
--- test/test.2010.csproj
+++ test/test.2010.csproj
@@ -19,10 +19,11 @@
test
test
3.5
Client
$(MSBuildProjectDirectory)\..
+ true
2010
$(BinaryOutputPath)
Index: test/test.2012.csproj
==================================================================
--- test/test.2012.csproj
+++ test/test.2012.csproj
@@ -16,10 +16,11 @@
Properties
Exe
test
test
$(MSBuildProjectDirectory)\..
+ true
2012
v4.5
Index: testce/testce.2008.csproj
==================================================================
--- testce/testce.2008.csproj
+++ testce/testce.2008.csproj
@@ -25,11 +25,11 @@
v3.5
2.0
Windows CE
$(MSBuildProjectDirectory)\..
- true
+ true
2008
Compact
testce
%25CSIDL_PROGRAM_FILES%25
Index: testlinq/Program.cs
==================================================================
--- testlinq/Program.cs
+++ testlinq/Program.cs
@@ -253,14 +253,14 @@
db.AddObject("Territories", territories);
}
try
{
-#if NET_20
- db.SaveChanges(false);
+#if NET_40
+ db.SaveChanges(SaveOptions.None);
#else
- db.SaveChanges(SaveOptions.None);
+ db.SaveChanges(false);
#endif
}
catch (Exception e)
{
Console.WriteLine(e);
@@ -276,11 +276,26 @@
else
{
using (northwindEFEntities db = new northwindEFEntities())
{
bool once = false;
-#if NET_20
+#if NET_40
+ var query = from t in db.Territories
+ where territoryIds.AsQueryable().Contains(t.TerritoryID)
+ orderby t.TerritoryID
+ select t;
+
+ foreach (Territories territories in query)
+ {
+ if (once)
+ Console.Write(' ');
+
+ Console.Write(territories.TerritoryID);
+
+ once = true;
+ }
+#else
//
// HACK: We cannot use the Contains extension method within a
// LINQ query with the .NET Framework 3.5.
//
var query = from t in db.Territories
@@ -290,25 +305,10 @@
foreach (Territories territories in query)
{
if (Array.IndexOf(territoryIds, territories.TerritoryID) == -1)
continue;
- if (once)
- Console.Write(' ');
-
- Console.Write(territories.TerritoryID);
-
- once = true;
- }
-#else
- var query = from t in db.Territories
- where territoryIds.AsQueryable().Contains(t.TerritoryID)
- orderby t.TerritoryID
- select t;
-
- foreach (Territories territories in query)
- {
if (once)
Console.Write(' ');
Console.Write(territories.TerritoryID);
Index: testlinq/testlinq.2008.csproj
==================================================================
--- testlinq/testlinq.2008.csproj
+++ testlinq/testlinq.2008.csproj
@@ -19,11 +19,11 @@
testlinq
testlinq
v3.5
2.0
$(MSBuildProjectDirectory)\..
- true
+ true
2008
$(BinaryOutputPath)
Index: testlinq/testlinq.2010.csproj
==================================================================
--- testlinq/testlinq.2010.csproj
+++ testlinq/testlinq.2010.csproj
@@ -19,10 +19,11 @@
testlinq
testlinq
3.5
Client
$(MSBuildProjectDirectory)\..
+ true
2010
$(BinaryOutputPath)
Index: testlinq/testlinq.2012.csproj
==================================================================
--- testlinq/testlinq.2012.csproj
+++ testlinq/testlinq.2012.csproj
@@ -15,10 +15,11 @@
Properties
Exe
testlinq
testlinq
$(MSBuildProjectDirectory)\..
+ true
2012
v4.5
Index: tools/install/Installer.2008.csproj
==================================================================
--- tools/install/Installer.2008.csproj
+++ tools/install/Installer.2008.csproj
@@ -19,11 +19,11 @@
Installer
Installer
true
2.0
$(MSBuildProjectDirectory)\..\..
- true
+ true
2008
Index: tools/install/Installer.2010.csproj
==================================================================
--- tools/install/Installer.2010.csproj
+++ tools/install/Installer.2010.csproj
@@ -20,10 +20,11 @@
Installer
true
3.5
Client
$(MSBuildProjectDirectory)\..\..
+ true
2010
Index: tools/install/Installer.2012.csproj
==================================================================
--- tools/install/Installer.2012.csproj
+++ tools/install/Installer.2012.csproj
@@ -16,10 +16,11 @@
Exe
Installer
Installer
true
$(MSBuildProjectDirectory)\..\..
+ true
2012
v4.5
Index: tools/install/Installer.cs
==================================================================
--- tools/install/Installer.cs
+++ tools/install/Installer.cs
@@ -17,11 +17,11 @@
using System.Runtime.InteropServices;
#endif
using System.Security;
-#if NET_20
+#if NET_20 || NET_35
using System.Security.Permissions;
#endif
using System.Threading;
using System.Windows.Forms;
@@ -148,11 +148,11 @@
#endregion
///////////////////////////////////////////////////////////////////////////
#region Installer Class
-#if !NET_20
+#if NET_40
[SecurityCritical()]
#else
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
#endif
internal static class Installer
Index: www/news.wiki
==================================================================
--- www/news.wiki
+++ www/news.wiki
@@ -7,10 +7,13 @@
- Updated to [http://www.sqlite.org/src/info/trunk|SQLite 3.7.15].
- Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.
- Add Visual Studio 2012 support to the redesigned designer support installer.
+ - Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.
+ - Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class.
+ - Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.
- Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.
- All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.
- Make sure the error code of the SQLiteException class gets serialized.
- Make the test project for the .NET Compact Framework more flexible.
- When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.