Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Start of work to resolve ticket [343d392b51]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | tkt-343d392b51 |
Files: | files | file ages | folders |
SHA1: |
030e4040349e8c04955aebc93ec2c1aa |
User & Date: | mistachkin 2011-10-07 00:30:18.140 |
Context
2011-10-08
| ||
11:01 | When returning schema information that may be used by the .NET Framework to construct dynamic SQL, use a fake schema name (instead of null) so that the table names will be properly qualified with the catalog name (i.e. the attached database name). Refactor handling of arguments for the setupDb unit test infrastructure procedure. Allow the build and binary directories used by the unit testing infrastructure to be overridden. Add more tests related to ticket [343d392b51]. check-in: 2d2ef4ffcc user: mistachkin tags: tkt-343d392b51 | |
2011-10-07
| ||
00:30 | Start of work to resolve ticket [343d392b51]. check-in: 030e404034 user: mistachkin tags: tkt-343d392b51 | |
2011-10-06
| ||
10:54 | Update test case for ticket [343d392b51] as it now reproduces the issue. check-in: 41413183d3 user: mistachkin tags: tkt-343d392b51 | |
Changes
Changes to System.Data.SQLite/SQLite3.cs.
︙ | ︙ | |||
404 405 406 407 408 409 410 | 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) { | > > > > > > > > > > > > > > > > > > > > > > | | | > > > | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | 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: { byte[] b = ToUTF8(dt); int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); break; } } } internal override void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData) { int n = UnsafeNativeMethods.sqlite3_bind_blob(stmt._sqlite_stmt, index, blobData, blobData.Length, (IntPtr)(-1)); if (n > 0) throw new SQLiteException(n, SQLiteLastError()); } |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | ︙ | |||
17 18 19 20 21 22 23 | /// 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> | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /// 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> protected static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); /// <summary> /// The format string for DateTime values when using the InvariantCulture or CurrentCulture formats. /// </summary> private const string FullFormat = "yyyy-MM-ddTHH:mm:ss.fffffffK"; |
︙ | ︙ |
Changes to Tests/tkt-343d392b51.eagle.
︙ | ︙ | |||
17 18 19 20 21 22 23 | package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### runTest {test tkt-343d392b51-1.1 {SQLiteDataAdapter batch updates} -setup { | | | | | 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 | package require System.Data.SQLite.Test runSQLiteTestPrologue ############################################################################### runTest {test tkt-343d392b51-1.1 {SQLiteDataAdapter batch updates} -setup { setupDb [set fileName tkt-343d392b51-1.1.db] "" "" "DateTimeFormat=JulianDay;" set otherFileName tkt-343d392b51-1.1-otherDb.db } -body { set id [object invoke Interpreter.GetActive NextId] set dataSource [file join [getTemporaryPath] $fileName] set otherDataSource [file join [getTemporaryPath] $otherFileName] set otherDbName otherDb set table [appendArgs $otherDbName .t1] set sql(inserts) "" set sql(1) [subst { \ ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \ CREATE TABLE ${table}(x INTEGER PRIMARY KEY, y DATETIME); \ [for {set i 1} {$i < 2} {incr i} { append sql(inserts) [appendArgs \ "INSERT INTO " ${table} " (x, y) VALUES(" $i ", JULIANDAY('" \ [clock format $i -format {yyyy-MM-ddTHH:mm:ss}] "')); "] }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \ }] set sql(2) [subst { \ SELECT x, y FROM ${table} ORDER BY x; \ }] |
︙ | ︙ | |||
55 56 57 58 59 60 61 | namespace _Dynamic${id} { public class Test${id} { public static void Main() { using (SQLiteConnection connection = new SQLiteConnection( | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | namespace _Dynamic${id} { public class Test${id} { public static void Main() { using (SQLiteConnection connection = new SQLiteConnection( "Data Source=${dataSource};DateTimeFormat=JulianDay;")) { connection.Open(); using (SQLiteCommand command = connection.CreateCommand()) { command.CommandText = "${sql(1)}"; command.ExecuteNonQuery(); |
︙ | ︙ |