Skip to content

Commit 937a7c6

Browse files
authored
Merge pull request #1098 from Pythonic-Rainbow/master
Add support for ulong
2 parents 2075426 + f37574f commit 937a7c6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/SQLite.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,7 @@ public static string SqlDecl (TableMapping.Column p, bool storeDateTimeAsTicks,
28842884
public static string SqlType (TableMapping.Column p, bool storeDateTimeAsTicks, bool storeTimeSpanAsTicks)
28852885
{
28862886
var clrType = p.ColumnType;
2887-
if (clrType == typeof (Boolean) || clrType == typeof (Byte) || clrType == typeof (UInt16) || clrType == typeof (SByte) || clrType == typeof (Int16) || clrType == typeof (Int32) || clrType == typeof (UInt32) || clrType == typeof (Int64)) {
2887+
if (clrType == typeof (Boolean) || clrType == typeof (Byte) || clrType == typeof (UInt16) || clrType == typeof (SByte) || clrType == typeof (Int16) || clrType == typeof (Int32) || clrType == typeof (UInt32) || clrType == typeof (Int64) || clrType == typeof (UInt64)) {
28882888
return "integer";
28892889
}
28902890
else if (clrType == typeof (Single) || clrType == typeof (Double) || clrType == typeof (Decimal)) {
@@ -3283,7 +3283,7 @@ internal static void BindParameter (Sqlite3Statement stmt, int index, object val
32833283
else if (value is Boolean) {
32843284
SQLite3.BindInt (stmt, index, (bool)value ? 1 : 0);
32853285
}
3286-
else if (value is UInt32 || value is Int64) {
3286+
else if (value is UInt32 || value is Int64 || value is UInt64) {
32873287
SQLite3.BindInt64 (stmt, index, Convert.ToInt64 (value));
32883288
}
32893289
else if (value is Single || value is Double || value is Decimal) {
@@ -3417,6 +3417,9 @@ object ReadCol (Sqlite3Statement stmt, int index, SQLite3.ColType type, Type clr
34173417
else if (clrType == typeof (Int64)) {
34183418
return SQLite3.ColumnInt64 (stmt, index);
34193419
}
3420+
else if (clrType == typeof (UInt64)) {
3421+
return (ulong)SQLite3.ColumnInt64 (stmt, index);
3422+
}
34203423
else if (clrType == typeof (UInt32)) {
34213424
return (uint)SQLite3.ColumnInt64 (stmt, index);
34223425
}
@@ -3561,6 +3564,12 @@ internal static Action<object, Sqlite3Statement, int> GetFastSetter<T> (SQLiteCo
35613564
return SQLite3.ColumnInt64 (stmt, index);
35623565
});
35633566
}
3567+
else if (clrType == typeof(UInt64))
3568+
{
3569+
fastSetter = CreateNullableTypedSetterDelegate<T, UInt64>(column, (stmt, index) => {
3570+
return (ulong)SQLite3.ColumnInt64(stmt, index);
3571+
});
3572+
}
35643573
else if (clrType == typeof (UInt32)) {
35653574
fastSetter = CreateNullableTypedSetterDelegate<T, UInt32> (column, (stmt, index) => {
35663575
return (uint)SQLite3.ColumnInt64 (stmt, index);

0 commit comments

Comments
 (0)