Index: System.Data.SQLite/SQLiteConnection.cs
==================================================================
--- System.Data.SQLite/SQLiteConnection.cs
+++ System.Data.SQLite/SQLiteConnection.cs
@@ -1621,11 +1621,11 @@
// First split into semi-colon delimited values.
string error = null;
string[] arParts;
- if (UnsafeNativeMethods.GetSettingValue("No_SQLiteConnectionNewParser") != null)
+ if (UnsafeNativeMethods.GetSettingValue("No_SQLiteConnectionNewParser", null) != null)
arParts = SQLiteConvert.Split(s, ';');
else
arParts = SQLiteConvert.NewSplit(s, ';', true, ref error);
if (arParts == null)
Index: System.Data.SQLite/SQLiteFunction.cs
==================================================================
--- System.Data.SQLite/SQLiteFunction.cs
+++ System.Data.SQLite/SQLiteFunction.cs
@@ -655,11 +655,11 @@
#if !PLATFORM_COMPACTFRAMEWORK
//
// NOTE: If the "No_SQLiteFunctions" environment variable is set,
// skip all our special code and simply return.
//
- if (UnsafeNativeMethods.GetSettingValue("No_SQLiteFunctions") != null)
+ if (UnsafeNativeMethods.GetSettingValue("No_SQLiteFunctions", null) != null)
return;
SQLiteFunctionAttribute at;
System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
int w = arAssemblies.Length;
Index: System.Data.SQLite/SQLiteLog.cs
==================================================================
--- System.Data.SQLite/SQLiteLog.cs
+++ System.Data.SQLite/SQLiteLog.cs
@@ -150,11 +150,11 @@
// prevent all non-default AppDomains from registering a
// log handler unless the "Force_SQLiteLog" environment
// variable is used to manually override this safety check.
//
if (!AppDomain.CurrentDomain.IsDefaultAppDomain() &&
- UnsafeNativeMethods.GetSettingValue("Force_SQLiteLog") == null)
+ UnsafeNativeMethods.GetSettingValue("Force_SQLiteLog", null) == null)
{
return;
}
#endif
Index: System.Data.SQLite/UnsafeNativeMethods.cs
==================================================================
--- System.Data.SQLite/UnsafeNativeMethods.cs
+++ System.Data.SQLite/UnsafeNativeMethods.cs
@@ -109,25 +109,31 @@
/// available.
///
///
/// The name of the configuration variable.
///
+ ///
+ /// The value to be returned if the configuration variable has not been
+ /// set explicitly or cannot be determined.
+ ///
///
- /// The value of the configuration variable -OR- null if it cannot be
- /// determined. By default, references to existing environment will
- /// be expanded within the returned value unless either the "No_Expand"
- /// or "No_Expand_" environment variables are
- /// set.
+ /// The value of the configuration variable -OR- the default value
+ /// specified by if it has not been set
+ /// explicitly or cannot be determined. By default, all references to
+ /// existing environment will be expanded within the value to be returned
+ /// unless either the "No_Expand" or "No_Expand_"
+ /// environment variables are set [to anything].
///
internal static string GetSettingValue(
- string name
+ string name,
+ string @default
)
{
- string value = null;
-
if (name == null)
- return value;
+ return @default;
+
+ string value = null;
#if !PLATFORM_COMPACTFRAMEWORK
bool expand = true;
if (Environment.GetEnvironmentVariable("No_Expand") != null)
@@ -152,18 +158,19 @@
try
{
string fileName = GetXmlConfigFileName();
if (fileName == null)
- return value;
+ return @default;
XmlDocument document = new XmlDocument();
document.Load(fileName);
XmlElement element = document.SelectSingleNode(String.Format(
- "/configuration/appSettings/add[@key='{0}']")) as XmlElement;
+ "/configuration/appSettings/add[@key='{0}']", name)) as
+ XmlElement;
if (element != null)
{
if (element.HasAttribute("value"))
value = element.GetAttribute("value");
@@ -170,10 +177,13 @@
#if !PLATFORM_COMPACTFRAMEWORK
if (expand && !String.IsNullOrEmpty(value))
value = Environment.ExpandEnvironmentVariables(value);
#endif
+
+ if (value != null)
+ return value;
}
}
#if !NET_COMPACT_20 && TRACE_SHARED
catch (Exception e)
#else
@@ -193,11 +203,11 @@
// do nothing.
}
#endif
}
- return value;
+ return @default;
}
/////////////////////////////////////////////////////////////////////////
///
/// Queries and returns the directory for the assembly currently being
@@ -409,11 +419,11 @@
{
//
// NOTE: If the "No_PreLoadSQLite" environment variable is set (to
// anything), skip all our special code and simply return.
//
- if (GetSettingValue("No_PreLoadSQLite") != null)
+ if (GetSettingValue("No_PreLoadSQLite", null) != null)
return;
lock (staticSyncRoot)
{
//
@@ -463,11 +473,11 @@
{
//
// NOTE: If the "PreLoadSQLite_BaseDirectory" environment variable
// is set, use it verbatim for the base directory.
//
- string directory = GetSettingValue("PreLoadSQLite_BaseDirectory");
+ string directory = GetSettingValue("PreLoadSQLite_BaseDirectory", null);
if (directory != null)
return directory;
#if !PLATFORM_COMPACTFRAMEWORK
@@ -476,11 +486,11 @@
// variable is set (to anything), attempt to use the directory
// containing the currently executing assembly (i.e.
// System.Data.SQLite) intsead of the application domain base
// directory.
//
- if (GetSettingValue("PreLoadSQLite_UseAssemblyDirectory") != null)
+ if (GetSettingValue("PreLoadSQLite_UseAssemblyDirectory", null) != null)
{
directory = GetAssemblyDirectory();
if (directory != null)
return directory;
@@ -551,19 +561,19 @@
// NOTE: If the "PreLoadSQLite_ProcessorArchitecture" environment
// variable is set, use it verbatim for the current processor
// architecture.
//
string processorArchitecture = GetSettingValue(
- "PreLoadSQLite_ProcessorArchitecture");
+ "PreLoadSQLite_ProcessorArchitecture", null);
if (processorArchitecture != null)
return processorArchitecture;
//
// BUGBUG: Will this always be reliable?
//
- processorArchitecture = GetSettingValue(PROCESSOR_ARCHITECTURE);
+ processorArchitecture = GetSettingValue(PROCESSOR_ARCHITECTURE, null);
/////////////////////////////////////////////////////////////////////
#if !PLATFORM_COMPACTFRAMEWORK
//