Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tkt-343d392b51 Excluding Merge-Ins
This is equivalent to a diff from b55caba05c to 250dac131a
2011-10-11
| ||
07:21 | Merge all fixes, enhancements, and tests related to ticket [343d392b51] into trunk. check-in: fc49363310 user: mistachkin tags: trunk | |
04:05 | Modify the test projects to use the same version as the core projects. check-in: b11be4b707 user: mistachkin tags: trunk | |
03:50 | Merge updates from trunk. Closed-Leaf check-in: 250dac131a user: mistachkin tags: tkt-343d392b51 | |
03:48 | Fix leaked variable 'version' in test. Cleanup comments. check-in: b55caba05c user: mistachkin tags: trunk | |
03:35 | Add tests to verify correct version information for all source and binary files. Also, update Eagle script library to latest trunk. Fix and verify ticket [737ca4ff74]. check-in: 4208cffdbb user: mistachkin tags: trunk | |
2011-10-09
| ||
04:13 | Add comments to the getDateTimeFormat unit testing infrastructure procedure to clarify how the default format was chosen. check-in: 1b25ba72a3 user: mistachkin tags: tkt-343d392b51 | |
Changes to System.Data.SQLite/SQLite3.cs.
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | - - + + | private bool _buildingSchema; #endif /// <summary> /// The user-defined functions registered on this connection /// </summary> protected SQLiteFunction[] _functionsArray; |
︙ | |||
260 261 262 263 264 265 266 267 268 269 270 271 272 273 | 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | + + + + + + + + + + + + + + + + + + + + | internal override string SQLiteLastError() { return SQLiteBase.SQLiteLastError(_sql); } internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain) { if (!String.IsNullOrEmpty(strSql)) { // // NOTE: SQLite does not support the concept of separate schemas // in one database; therefore, remove the base schema name // used to smooth integration with the base .NET Framework // data classes. // string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null; if (!String.IsNullOrEmpty(baseSchemaName)) { strSql = strSql.Replace( String.Format("[{0}].", baseSchemaName), String.Empty); strSql = strSql.Replace( String.Format("{0}.", baseSchemaName), String.Empty); } } IntPtr stmt = IntPtr.Zero; IntPtr ptr = IntPtr.Zero; int len = 0; int n = 17; int retries = 0; byte[] b = ToUTF8(strSql); string typedefs = null; |
︙ | |||
404 405 406 407 408 409 410 | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + | byte[] b = ToUTF8(value); int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); } internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt) { switch (_datetimeFormat) { case SQLiteDateFormats.Ticks: { int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, dt.Ticks); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } case SQLiteDateFormats.JulianDay: { int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, ToJulianDay(dt)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } case SQLiteDateFormats.UnixEpoch: { int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, Convert.ToInt64(dt.Subtract(UnixEpoch).TotalSeconds)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } default: { |
︙ |
Changes to System.Data.SQLite/SQLite3_UTF16.cs.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - - + + | using System.Runtime.InteropServices; /// <summary> /// Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode) /// </summary> internal class SQLite3_UTF16 : SQLite3 { |
︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 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 104 105 106 107 108 | + + + + + + + + + + + + + + + + + + + + + + - + + + + | _sql = db; } _functionsArray = SQLiteFunction.BindFunctions(this); } internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt) { switch (_datetimeFormat) { case SQLiteDateFormats.Ticks: { int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, dt.Ticks); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } case SQLiteDateFormats.JulianDay: { int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, ToJulianDay(dt)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } case SQLiteDateFormats.UnixEpoch: { int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, Convert.ToInt64(dt.Subtract(UnixEpoch).TotalSeconds)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } default: { |
︙ |
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - - + + | /// <summary> /// This internal class provides the foundation of SQLite support. It defines all the abstract members needed to implement /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite. /// </summary> internal abstract class SQLiteBase : SQLiteConvert, IDisposable { |
︙ |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | + + + + + + + + + + + + + + + | /// </item> /// <item> /// <description>DateTimeFormat</description> /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description> /// <description>N</description> /// <description>ISO8601</description> /// </item> /// <item> /// <description>DateTimeKind</description> /// <description><b>Unspecified</b> - Not specified as either UTC or local time.<br/><b>Utc</b> - The time represented is UTC.<br/><b>Local</b> - The time represented is local time.</description> /// <description>N</description> /// <description>Unspecified</description> /// </item> /// <item> /// <description>BaseSchemaName</description> /// <description>Some base data classes in the framework (e.g. those that build SQL queries dynamically) /// assume that an ADO.NET provider cannot support an alternate catalog (i.e. database) without supporting /// alternate schemas as well; however, SQLite does not fit into this model. Therefore, this value is used /// as a placeholder and removed prior to preparing any SQL statements that may contain it.</description> /// <description>N</description> /// <description>sqlite_default_schema</description> /// </item> /// <item> /// <description>BinaryGUID</description> /// <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description> /// <description>N</description> /// <description>True</description> /// </item> /// <item> |
︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | + + + + + + + + + | /// <description>N</description> /// <description>False</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 /// the BaseSchemaName property. This should start with "sqlite_*" /// because those names are reserved for use by SQLite (i.e. they cannot /// be confused with the names of user objects). /// </summary> private const string DefaultBaseSchemaName = "sqlite_default_schema"; private const int SQLITE_FCNTL_WIN32_AV_RETRY = 9; private const string _dataDirectory = "|DataDirectory|"; private const string _masterdb = "sqlite_master"; private const string _tempmasterdb = "sqlite_temp_master"; /// <summary> |
︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | + + + + + + | /// </summary> private string _dataSource; /// <summary> /// Temporary password storage, emptied after the database has been opened /// </summary> private byte[] _password; /// <summary> /// The "stub" (i.e. placeholder) base schema name to use when returning /// column schema information. /// </summary> internal string _baseSchemaName; /// <summary> /// Default command timeout /// </summary> private int _defaultTimeout = 30; internal bool _binaryGuid; |
︙ | |||
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | + + + + + - + - + | _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture); _defaultIsolation = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", "Serializable"), true); if (_defaultIsolation != IsolationLevel.Serializable && _defaultIsolation != IsolationLevel.ReadCommitted) throw new NotSupportedException("Invalid Default IsolationLevel specified"); _baseSchemaName = FindKey(opts, "BaseSchemaName", DefaultBaseSchemaName); //string temp = FindKey(opts, "DateTimeFormat", "ISO8601"); //if (String.Compare(temp, "ticks", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.Ticks; //else if (String.Compare(temp, "julianday", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.JulianDay; if (_sql == null) { bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true); SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat", "ISO8601"), true); DateTimeKind kind = (DateTimeKind)Enum.Parse(typeof(DateTimeKind), FindKey(opts, "DateTimeKind", "Unspecified"), true); if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16() |
︙ | |||
1033 1034 1035 1036 1037 1038 1039 1040 1041 | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | + + + - + - + | { SortedList<string, string> opts = ParseConnectionString(_connectionString); bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true); SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat", "ISO8601"), true); DateTimeKind kind = (DateTimeKind)Enum.Parse(typeof(DateTimeKind), FindKey(opts, "DateTimeKind", "Unspecified"), true); if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16() |
︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 62 63 64 65 66 67 68 69 70 71 72 73 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 | - + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + + - + + | /// This base class provides datatype conversion services for the SQLite provider. /// </summary> public abstract class SQLiteConvert { /// <summary> /// The value for the Unix epoch (e.g. January 1, 1970 at midnight, in UTC). /// </summary> |
︙ | |||
141 142 143 144 145 146 147 | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 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 236 237 238 239 240 241 242 243 244 245 246 247 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 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | + + + + + + - - - - - - + + + + + + + + + + + - + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + | #region DateTime Conversion Functions /// <summary> /// Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened. /// </summary> /// <remarks> /// Acceptable ISO8601 DateTime formats are: /// THHmmssK /// THHmmK /// HH:mm:ss.FFFFFFFK /// HH:mm:ssK /// HH:mmK /// yyyy-MM-dd HH:mm:ss.FFFFFFFK |
︙ | |||
216 217 218 219 220 221 222 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | + + - + | case SQLiteDateFormats.UnixEpoch: return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString(); case SQLiteDateFormats.InvariantCulture: return dateValue.ToString(FullFormat, CultureInfo.InvariantCulture); case SQLiteDateFormats.CurrentCulture: return dateValue.ToString(FullFormat, CultureInfo.CurrentCulture); default: return (dateValue.Kind == DateTimeKind.Utc) ? dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture) : // include "Z" |
︙ |
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 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 104 105 106 107 | + + + - + + + + + + + + + | internal bool _disposing; /// <summary> /// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified /// </summary> private SQLiteKeyReader _keyInfo; /// <summary> /// Matches the version of the connection. /// </summary> |
︙ | |||
636 637 638 639 640 641 642 643 644 645 646 647 648 649 | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | + | row[SchemaTableOptionalColumn.IsReadOnly] = false; row[SchemaTableOptionalColumn.IsRowVersion] = false; row[SchemaTableColumn.IsUnique] = false; row[SchemaTableColumn.IsKey] = false; row[SchemaTableOptionalColumn.IsAutoIncrement] = false; row[SchemaTableColumn.DataType] = GetFieldType(n); row[SchemaTableOptionalColumn.IsHidden] = false; row[SchemaTableColumn.BaseSchemaName] = _baseSchemaName; strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n); if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn; row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn); row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, StringComparison.OrdinalIgnoreCase) != 0); |
︙ |
Changes to System.Data.SQLite/SQLiteLog.cs.
︙ | |||
144 145 146 147 148 149 150 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - + + | AppDomain.CurrentDomain.DomainUnload += _domainUnload; } // // NOTE: Create an instance of the SQLite wrapper class. // if (_sql == null) |
︙ |
Changes to Tests/basic.eagle.
︙ | |||
647 648 649 650 651 652 653 | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | - + | {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ -result {0 1 2 2 1 2 2 2 {1 {{x 1} {y foobar} {z 1234}}} {2 {{x 2} {y foobar}\ {z 5678}}} 2 {1 {{x 1} {y foobar} {z 1234}}} {2 {{x 2} {y foobar} {z 5678}}}}} ############################################################################### runTest {test basic-1.12 {DateTime using Unix epoch} -setup { |
︙ | |||
674 675 676 677 678 679 680 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | - + - - - - - + + + + + - + | sql execute -verbatim $db "INSERT INTO t1 (x, y) VALUES(8, ?);" \ [list param1 DateTime 1334448000] sql execute -verbatim $db "INSERT INTO t1 (x, y) VALUES(9, ?);" \ [list param1 DateTime 1365984000] |
︙ | |||
737 738 739 740 741 742 743 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | - + | sql execute $db "INSERT INTO t1 (x, y) VALUES(11, ?);" \ [list param1 DateTime 12:00] sql execute $db "INSERT INTO t1 (x, y) VALUES(12, ?);" \ [list param1 DateTime "12/16/2009 12:00"] |
︙ | |||
762 763 764 765 766 767 768 | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | - + | ${date}T12:00:00.0000000Z}}} {9 {{x 9} {y2 2009-12-16T12:00:00.0000000Z}}}\ {10 {{x 10} {y2 2009-12-16T00:00:00.0000000Z}}} {11 {{x 11} {y2\ ${date}T12:00:00.0000000Z}}} {12 {{x 12} {y2 2009-12-16T12:00:00.0000000Z}}}}]} ############################################################################### runTest {test basic-1.14 {DateTime using current culture} -setup { |
︙ | |||
798 799 800 801 802 803 804 | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | - + | sql execute $db "INSERT INTO t1 (x, y) VALUES(11, ?);" \ [list param1 DateTime 12:00] sql execute $db "INSERT INTO t1 (x, y) VALUES(12, ?);" \ [list param1 DateTime "12/16/2009 12:00"] |
︙ |
Changes to Tests/common.eagle.
︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 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 146 147 148 149 150 151 152 153 154 155 156 157 | + + + + + + + - - - - - - - + + + + + + + + + + + + + + + - + + | # release of Eagle, the following command must be used instead # (also all on one line): # # EagleShell.exe -initialize -postInitialize # "object invoke Interpreter.GetActive AddRuntimeOption native" # -file .\path\to\all.eagle # if {[info exists ::build_directory] && \ [string length $::build_directory] > 0} then { # # NOTE: The location of the build directory has been overridden. # return $::build_directory } else { |
︙ | |||
245 246 247 248 249 250 251 252 253 254 255 256 257 258 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | + + + + + + + + + + + + + + + + + + + + + + | addConstraint SQLite tputs $channel [appendArgs "yes (" $version ")\n"] } else { tputs $channel no\n } } proc getDateTimeFormat {} { # # NOTE: This procedure simply returns the "default" DateTime format used # by the test suite. # if {[info exists ::datetime_format] && \ [string length $::datetime_format] > 0} then { # # NOTE: Return the manually overridden value for the DateTime format. # return $::datetime_format } else { # # NOTE: Return an ISO8601 DateTime format compatible with SQLite, # System.Data.SQLite, and suitable for round-tripping with the # DateTime class of the framework. If this value is changed, # various tests may fail. # return "yyyy-MM-dd HH:mm:ss.FFFFFFFK" } } proc enumerableToList { enumerable } { set result [list] if {[string length $enumerable] == 0 || $enumerable eq "null"} then { return $result } |
︙ | |||
299 300 301 302 303 304 305 | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | - + + + - + | # # NOTE: Evaluate the constructed [compileCSharp] command and return the # result. # eval $command } |
︙ | |||
334 335 336 337 338 339 340 341 342 343 344 345 346 347 | 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 400 401 402 403 | + + + + + + + + + + + + + + + + | # # NOTE: If the caller specified a journal mode, add the necessary portion # of the connection string now. # if {[string length $mode] > 0} then { append connection {;Journal Mode=${mode}} } # # NOTE: If the caller specified a DateTime format, add the necessary # portion of the connection string now. # if {[string length $dateTimeFormat] > 0} then { append connection {;DateTimeFormat=${dateTimeFormat}} } # # 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 an extra payload to the connection string, # append it now. # if {[string length $extra] > 0} then { append connection \; $extra |
︙ |
Added Tests/tkt-343d392b51.eagle.