Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add enumerated Flags property to the SQLiteConnection class to control extra behavioral options. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6a90082172d317c3ff1ea88e441574a9 |
User & Date: | mistachkin 2012-01-25 17:09:59.385 |
Context
2012-01-25
| ||
17:37 | Fix the default value of the connection flags for the setupDb unit test infrastructure script library procedure. check-in: 96c981c40b user: mistachkin tags: trunk | |
17:09 | Add enumerated Flags property to the SQLiteConnection class to control extra behavioral options. check-in: 6a90082172 user: mistachkin tags: trunk | |
09:27 | Update MSVC redists in Externals to the latest ones from Microsoft. check-in: bbec0d9d38 user: drh tags: trunk | |
Changes
Changes to System.Data.SQLite/SQLite3.cs.
︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | + + + + + + | strSql = strSql.Replace( String.Format("[{0}].", baseSchemaName), String.Empty); strSql = strSql.Replace( String.Format("{0}.", baseSchemaName), String.Empty); } } if ((cnn != null) && ((cnn.Flags & SQLiteConnectionFlags.LogPrepare) == SQLiteConnectionFlags.LogPrepare)) { LogMessage(0, String.Format("Preparing {{{0}}}...", strSql)); } IntPtr stmt = IntPtr.Zero; IntPtr ptr = IntPtr.Zero; int len = 0; int n = 17; int retries = 0; byte[] b = ToUTF8(strSql); |
︙ |
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | |||
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | + + + + + + + + + + + + + + + + + + + + + + | None = 0, ReadOnly = 0x01, ReadWrite = 0x02, Create = 0x04, SharedCache = 0x01000000, Default = 0x06, } /// <summary> /// The extra behavioral flags that can be applied to a connection. /// </summary> [Flags()] public enum SQLiteConnectionFlags { /// <summary> /// No extra flags. /// </summary> None = 0x0, /// <summary> /// Enable logging of all SQL statements to be prepared. /// </summary> LogPrepare = 0x1, /// <summary> /// The default extra flags for new connections. /// </summary> Default = None } // These are the options to the internal sqlite3_config call. internal enum SQLiteConfigOpsEnum { SQLITE_CONFIG_NONE = 0, // nil SQLITE_CONFIG_SINGLETHREAD = 1, // nil SQLITE_CONFIG_MULTITHREAD = 2, // nil |
︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | + + + + + + | /// </item> /// <item> /// <description>Foreign Keys</description> /// <description>Enable foreign key constraints</description> /// <description>N</description> /// <description>False</description> /// </item> /// <item> /// <description>Flags</description> /// <description>Extra behavioral flags for the connection. See the SQLiteConnectionFlags enumeration for possible values.</description> /// <description>N</description> /// <description>Default</description> /// </item> /// </list> /// </remarks> public sealed partial class SQLiteConnection : DbConnection, ICloneable { /// <summary> /// The default "stub" (i.e. placeholder) base schema name to use when /// returning column schema information. Used as the initial value of |
︙ | |||
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | + + + + + + | /// <summary> /// The "stub" (i.e. placeholder) base schema name to use when returning /// column schema information. /// </summary> internal string _baseSchemaName; /// <summary> /// The extra behavioral flags for this connection, if any. See the /// SQLiteConnectionFlags enumeration for a list of possible values. /// </summary> private SQLiteConnectionFlags _flags; /// <summary> /// Default command timeout /// </summary> private int _defaultTimeout = 30; internal bool _binaryGuid; |
︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | + | /// <param name="connectionString">The connection string to use on the connection</param> public SQLiteConnection(string connectionString) { #if !PLATFORM_COMPACTFRAMEWORK SQLiteLog.Initialize(); #endif _flags = SQLiteConnectionFlags.Default; _connectionState = ConnectionState.Closed; _connectionString = ""; //_commandList = new List<WeakReference>(); if (connectionString != null) ConnectionString = connectionString; } |
︙ | |||
827 828 829 830 831 832 833 834 835 836 837 838 839 840 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | + + + | { if (_connectionState != ConnectionState.Closed) throw new InvalidOperationException(); Close(); SortedList<string, string> opts = ParseConnectionString(_connectionString); _flags = (SQLiteConnectionFlags)Enum.Parse(typeof(SQLiteConnectionFlags), FindKey(opts, "Flags", "Default"), true); string fileName; if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3) throw new NotSupportedException("Only SQLite Version 3 is supported at this time"); fileName = FindKey(opts, "Data Source", ""); |
︙ | |||
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | + + + + + + + + + + | /// This can also be set in the ConnectionString with "Default Timeout" /// </summary> public int DefaultTimeout { get { return _defaultTimeout; } set { _defaultTimeout = value; } } /// <summary> /// Gets/sets the extra behavioral flags for this connection. See the /// SQLiteConnectionFlags enumeration for a list of possible values. /// </summary> public SQLiteConnectionFlags Flags { get { return _flags; } set { _flags = value; } } /// <summary> /// Returns the version of the underlying SQLite database engine /// </summary> #if !PLATFORM_COMPACTFRAMEWORK [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] #endif |
︙ |
Changes to System.Data.SQLite/SQLiteConnectionStringBuilder.cs.
︙ | |||
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | return SQLiteConvert.ToBoolean(value); } set { this["foreign keys"] = value; } } /// <summary> /// Gets/Sets the extra behavioral flags. /// </summary> [Browsable(true)] [DefaultValue(SQLiteConnectionFlags.Default)] public SQLiteConnectionFlags Flags { get { object value; if (TryGetValue("flags", out value)) { if (value is SQLiteConnectionFlags) return (SQLiteConnectionFlags)value; else if (value != null) return (SQLiteConnectionFlags)TypeDescriptor.GetConverter( typeof(SQLiteConnectionFlags)).ConvertFrom(value); } return SQLiteConnectionFlags.Default; } set { this["flags"] = value; } } /// <summary> /// Helper function for retrieving values from the connectionstring /// </summary> /// <param name="keyword">The keyword to retrieve settings for</param> /// <param name="value">The resulting parameter value</param> /// <returns>Returns true if the value was found and returned</returns> |
︙ |
Changes to Tests/basic.eagle.
︙ | |||
954 955 956 957 958 959 960 | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | - + + - + + - + + | if {$code eq "Ok"} then { set keys [list null Version Synchronous UseUTF16Encoding Pooling \ BinaryGUID "Data Source" Uri "Default Timeout" \ Enlist FailIfMissing "Legacy Format" "Read Only" \ Password "Page Size" "Max Page Count" "Cache Size" \ DateTimeFormat DateTimeKind BaseSchemaName \ |
︙ | |||
996 997 998 999 1000 1001 1002 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | - + + | Source=test\.db\} 0 \{test\.db, Uri=test\.db\} 0 \{60, Default Timeout=60\} 0\ \{False, Enlist=False\} 0 \{True, FailIfMissing=True\} 0 \{False, Legacy\ Format=False\} 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\ |
︙ |
Changes to Tests/common.eagle.
︙ | |||
435 436 437 438 439 440 441 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | - - + + | # NOTE: Evaluate the constructed [compileCSharp] command and return the # result. # eval $command } proc setupDb { |
︙ | |||
498 499 500 501 502 503 504 505 506 507 508 509 510 511 | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | + + + + + + + + | # # NOTE: If the caller specified a DateTimeKind, add the necessary portion # of the connection string now. # if {[string length $dateTimeKind] > 0} then { append connection {;DateTimeKind=${dateTimeKind}} } # # NOTE: If the caller specified a SQLiteConnectionFlags, add the necessary # portion of the connection string now. # if {[string length $flags] > 0} then { append connection {;Flags=${flags}} } # # NOTE: If the caller specified an extra payload to the connection string, # append it now. # if {[string length $extra] > 0} then { append connection \; $extra |
︙ |
Changes to Tests/tkt-448d663d11.eagle.
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + - + | ############################################################################### runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body { set fileName tkt-448d663d11-1.2.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] |
︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - + - + | ############################################################################### runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.5.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] |
︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + - + | ############################################################################### runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body { set fileName tkt-448d663d11-1.8.db file copy -force [file join $path wal.db] \ [file join [getDatabaseDirectory] $fileName] |
︙ | |||
206 207 208 209 210 211 212 | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + - + | ############################################################################### runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.15.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] |
︙ | |||
248 249 250 251 252 253 254 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - + - + | ############################################################################### runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body { set fileName tkt-448d663d11-1.18.db file copy -force [file join $path nonWal.db] \ [file join [getDatabaseDirectory] $fileName] |