System.Data.SQLite
Check-in [114024ffe7]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:DateTime conversion functions that can be static, should be static, see ticket [4bbf851fa5].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 114024ffe7d266816cc95a6ee955a90520b320a9
User & Date: mistachkin 2012-01-15 01:27:39
References
2012-02-29
14:54 Closed ticket [4bbf851fa5]: DBConcurrencyException plus 1 other change artifact: 774e22236e user: mistachkin
2012-02-19
12:35 Ticket [4bbf851fa5]: 1 change artifact: d4963672c0 user: mistachkin
12:35 Ticket [4bbf851fa5]: 1 change artifact: f4db9f273a user: mistachkin
2012-01-16
01:05 Ticket [4bbf851fa5]: 1 change artifact: fdf59cd932 user: mistachkin
01:00 Ticket [4bbf851fa5]: 1 change artifact: 6646195e03 user: mistachkin
2012-01-15
01:28 Ticket [4bbf851fa5]: 1 change artifact: 2cdfad7a72 user: mistachkin
Context
2012-01-17
12:42
Update core SQLite to 3.7.10 release. check-in: 4ec265e1b4 user: mistachkin tags: trunk
2012-01-15
01:27
DateTime conversion functions that can be static, should be static, see ticket [4bbf851fa5]. check-in: 114024ffe7 user: mistachkin tags: trunk
2012-01-14
03:39
Update SQLite core to the latest trunk (pre-release) code. check-in: 9a132f6c2f user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteConvert.cs.

   258    258       /// <param name="dateText">The string containing either a long integer number of 100-nanosecond units since
   259    259       /// System.DateTime.MinValue, a Julian day double, an integer number of seconds since the Unix epoch, a
   260    260       /// culture-independent formatted date and time string, a formatted date and time string in the current
   261    261       /// culture, or an ISO8601-format string.</param>
   262    262       /// <param name="format">The SQLiteDateFormats to use.</param>
   263    263       /// <param name="kind">The DateTimeKind to use.</param>
   264    264       /// <returns>A DateTime value</returns>
   265         -    public DateTime ToDateTime(string dateText, SQLiteDateFormats format, DateTimeKind kind)
          265  +    public static DateTime ToDateTime(string dateText, SQLiteDateFormats format, DateTimeKind kind)
   266    266       {
   267    267           switch (format)
   268    268           {
   269    269               case SQLiteDateFormats.Ticks:
   270    270                   {
   271    271                       return new DateTime(Convert.ToInt64(
   272    272                           dateText, CultureInfo.InvariantCulture), kind);
................................................................................
   325    325   
   326    326       /// <summary>
   327    327       /// Converts a julianday value into a DateTime
   328    328       /// </summary>
   329    329       /// <param name="julianDay">The value to convert</param>
   330    330       /// <param name="kind">The DateTimeKind to use.</param>
   331    331       /// <returns>A .NET DateTime</returns>
   332         -    public DateTime ToDateTime(double julianDay, DateTimeKind kind)
          332  +    public static DateTime ToDateTime(double julianDay, DateTimeKind kind)
   333    333       {
   334    334           return DateTime.SpecifyKind(
   335    335               DateTime.FromOADate(julianDay - OleAutomationEpochAsJulianDay), kind);
   336    336       }
   337    337   
   338    338       /// <summary>
   339    339       /// Converts a DateTime struct to a JulianDay double
   340    340       /// </summary>
   341    341       /// <param name="value">The DateTime to convert</param>
   342    342       /// <returns>The JulianDay value the Datetime represents</returns>
   343         -    public double ToJulianDay(DateTime value)
          343  +    public static double ToJulianDay(DateTime value)
   344    344       {
   345    345         return value.ToOADate() + OleAutomationEpochAsJulianDay;
   346    346       }
   347    347   
   348    348       /// <summary>
   349    349       /// Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
   350    350       /// </summary>

Changes to Tests/basic.eagle.

   997    997   \{False, Enlist=False\} 0 \{True, FailIfMissing=True\} 0 \{False, Legacy\
   998    998   Format=False\} 0 \{True, Read Only=True\} 0 \{secret, Password=secret\} 0\
   999    999   \{4096, Page Size=4096\} 0 \{1024, Max Page Count=1024\} 0 \{8192, Cache\
  1000   1000   Size=8192\} 0 \{UnixEpoch, DateTimeFormat=UnixEpoch\} 0 \{Utc,\
  1001   1001   DateTimeKind=Utc\} 0 \{sqlite_schema, BaseSchemaName=sqlite_schema\} 0\
  1002   1002   \{Memory, Journal Mode=Memory\} 0 \{Serializable, Default\
  1003   1003   IsolationLevel=Serializable\} 0 \{False, Foreign Keys=False\}$}}
         1004  +
         1005  +###############################################################################
         1006  +
         1007  +runTest {test data-1.17 {SQLiteConvert ToDateTime (Julian Day)} -body {
         1008  +  set dateTime [object invoke System.Data.SQLite.SQLiteConvert ToDateTime \
         1009  +      2455928.0 Utc]
         1010  +
         1011  +  object invoke $dateTime ToString [getDateTimeFormat]
         1012  +} -cleanup {
         1013  +  unset -nocomplain dateTime
         1014  +} -constraints {eagle System.Data.SQLite} -result {2012-01-01 12:00:00Z}}
         1015  +
         1016  +###############################################################################
         1017  +
         1018  +runTest {test data-1.18 {SQLiteConvert ToJulianDay} -body {
         1019  +  expr {round([object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \
         1020  +      "2012-01-01 12:00:00Z"])}
         1021  +} -constraints {eagle System.Data.SQLite} -result {2455928}}
  1004   1022   
  1005   1023   ###############################################################################
  1006   1024   
  1007   1025   unset -nocomplain testExeFile testLinqExeFile northwindEfDbFile testLinqOutFile
  1008   1026   
  1009   1027   ###############################################################################
  1010   1028   
  1011   1029   runSQLiteTestEpilogue
  1012   1030   runTestEpilogue