Index: System.Data.SQLite/SQLiteConnection.cs
==================================================================
--- System.Data.SQLite/SQLiteConnection.cs
+++ System.Data.SQLite/SQLiteConnection.cs
@@ -3721,11 +3721,11 @@
bool uri = false;
#endif
bool fullUri = false;
string fileName;
- if (Convert.ToInt32(FindKey(opts, "Version", DefaultVersion.ToString()), CultureInfo.InvariantCulture) != DefaultVersion)
+ if (Convert.ToInt32(FindKey(opts, "Version", SQLiteConvert.ToString(DefaultVersion)), CultureInfo.InvariantCulture) != DefaultVersion)
throw new NotSupportedException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion));
#if INTEROP_INCLUDE_ZIPVFS
bool useZipVfs = false;
string zipVfsVersion = FindKey(opts, "ZipVfsVersion", DefaultZipVfsVersion);
@@ -3812,16 +3812,16 @@
}
try
{
bool usePooling = SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", GetDefaultPooling().ToString()));
- int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", DefaultMaxPoolSize.ToString()), CultureInfo.InvariantCulture);
+ int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", SQLiteConvert.ToString(DefaultMaxPoolSize)), CultureInfo.InvariantCulture);
- _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", DefaultConnectionTimeout.ToString()), CultureInfo.InvariantCulture);
- _busyTimeout = Convert.ToInt32(FindKey(opts, "BusyTimeout", DefaultBusyTimeout.ToString()), CultureInfo.InvariantCulture);
- _prepareRetries = Convert.ToInt32(FindKey(opts, "PrepareRetries", DefaultPrepareRetries.ToString()), CultureInfo.InvariantCulture);
- _progressOps = Convert.ToInt32(FindKey(opts, "ProgressOps", DefaultProgressOps.ToString()), CultureInfo.InvariantCulture);
+ _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", SQLiteConvert.ToString(DefaultConnectionTimeout)), CultureInfo.InvariantCulture);
+ _busyTimeout = Convert.ToInt32(FindKey(opts, "BusyTimeout", SQLiteConvert.ToString(DefaultBusyTimeout)), CultureInfo.InvariantCulture);
+ _prepareRetries = Convert.ToInt32(FindKey(opts, "PrepareRetries", SQLiteConvert.ToString(DefaultPrepareRetries)), CultureInfo.InvariantCulture);
+ _progressOps = Convert.ToInt32(FindKey(opts, "ProgressOps", SQLiteConvert.ToString(DefaultProgressOps)), CultureInfo.InvariantCulture);
enumValue = TryParseEnum(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", DefaultIsolationLevel.ToString()), true);
_defaultIsolation = (enumValue is IsolationLevel) ? (IsolationLevel)enumValue : DefaultIsolationLevel;
_defaultIsolation = GetEffectiveIsolationLevel(_defaultIsolation);
@@ -3918,20 +3918,20 @@
int intValue;
if (!fullUri && !isMemory)
{
- strValue = FindKey(opts, "Page Size", DefaultPageSize.ToString());
+ strValue = FindKey(opts, "Page Size", SQLiteConvert.ToString(DefaultPageSize));
intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
if (intValue != DefaultPageSize)
{
cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", intValue);
cmd.ExecuteNonQuery();
}
}
- strValue = FindKey(opts, "Max Page Count", DefaultMaxPageCount.ToString());
+ strValue = FindKey(opts, "Max Page Count", SQLiteConvert.ToString(DefaultMaxPageCount));
intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
if (intValue != DefaultMaxPageCount)
{
cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", intValue);
cmd.ExecuteNonQuery();
@@ -3951,11 +3951,11 @@
{
cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", strValue);
cmd.ExecuteNonQuery();
}
- strValue = FindKey(opts, "Cache Size", DefaultCacheSize.ToString());
+ strValue = FindKey(opts, "Cache Size", SQLiteConvert.ToString(DefaultCacheSize));
intValue = Convert.ToInt32(strValue, CultureInfo.InvariantCulture);
if (intValue != DefaultCacheSize)
{
cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", intValue);
cmd.ExecuteNonQuery();
Index: System.Data.SQLite/SQLiteConvert.cs
==================================================================
--- System.Data.SQLite/SQLiteConvert.cs
+++ System.Data.SQLite/SQLiteConvert.cs
@@ -1169,10 +1169,30 @@
if (source is bool) return (bool)source;
return ToBoolean(ToStringWithProvider(
source, CultureInfo.InvariantCulture));
}
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ ///
+ /// Converts an integer to a string that can be round-tripped using the
+ /// invariant culture.
+ ///
+ ///
+ /// The integer value to return the string representation for.
+ ///
+ ///
+ /// The string representation of the specified integer value, using the
+ /// invariant culture.
+ ///
+ internal static string ToString(int value)
+ {
+ return value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
///
/// Attempts to convert a into a .
///
///
Index: Tests/basic.eagle
==================================================================
--- Tests/basic.eagle
+++ Tests/basic.eagle
@@ -4538,10 +4538,38 @@
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_SHA1_EXTENSION\
System.Data.SQLite SQLiteInterop} -result \
{5578139b470e35a3c231a499d06589215e46e8df\
a27f5e6f85a3872ed2e4e4018c8fd7dfaff052bc}}
+
+###############################################################################
+
+runTest {test data-1.86 {connection string integer parsing} -setup {
+ object import System.Globalization
+ object import System.Threading
+
+ set culture [object create -alias CultureInfo en-US]
+ $culture NumberFormat.NegativeSign /
+
+ set savedCulture [object invoke Thread.CurrentThread CurrentCulture]
+ object invoke Thread.CurrentThread CurrentCulture $culture
+} -body {
+ setupDb [set fileName data-1.86.db]
+} -cleanup {
+ cleanupDb $fileName
+
+ unset -nocomplain db fileName
+
+ catch {object invoke Thread.CurrentThread CurrentCulture $savedCulture}
+ unset -nocomplain savedCulture culture
+
+ object unimport -importpattern System.Threading
+ object unimport -importpattern System.Globalization
+} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
+defineConstant.System.Data.SQLite.INTEROP_SHA1_EXTENSION System.Data.SQLite\
+SQLiteInterop} -match regexp -result \
+{^System#Data#SQLite#SQLiteConnection#\d+$}}
###############################################################################
reportSQLiteResources $test_channel