Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,8 @@ public static string SqlType (TableMapping.Column p, bool storeDateTimeAsTicks)
} else if (clrType == typeof(String)) {
int len = p.MaxStringLength;
return "varchar(" + len + ")";
} else if (clrType == typeof(TimeSpan)) {
return "bigint";
} else if (clrType == typeof(DateTime)) {
return storeDateTimeAsTicks ? "bigint" : "datetime";
#if !NETFX_CORE
Expand Down Expand Up @@ -2061,6 +2063,8 @@ internal static void BindParameter (Sqlite3Statement stmt, int index, object val
SQLite3.BindInt64 (stmt, index, Convert.ToInt64 (value));
} else if (value is Single || value is Double || value is Decimal) {
SQLite3.BindDouble (stmt, index, Convert.ToDouble (value));
} else if (value is TimeSpan) {
SQLite3.BindInt64(stmt, index, ((TimeSpan)value).Ticks);
} else if (value is DateTime) {
if (storeDateTimeAsTicks) {
SQLite3.BindInt64 (stmt, index, ((DateTime)value).Ticks);
Expand Down Expand Up @@ -2108,6 +2112,8 @@ object ReadCol (Sqlite3Statement stmt, int index, SQLite3.ColType type, Type clr
return SQLite3.ColumnDouble (stmt, index);
} else if (clrType == typeof(float)) {
return (float)SQLite3.ColumnDouble (stmt, index);
} else if (clrType == typeof(TimeSpan)) {
return new TimeSpan(SQLite3.ColumnInt64(stmt, index));
} else if (clrType == typeof(DateTime)) {
if (_conn.StoreDateTimeAsTicks) {
return new DateTime (SQLite3.ColumnInt64 (stmt, index));
Expand Down