Skip to content

Commit

Permalink
Merge pull request #1098 from Pythonic-Rainbow/master
Browse files Browse the repository at this point in the history
Add support for ulong
  • Loading branch information
praeclarum authored Mar 27, 2024
2 parents 2075426 + f37574f commit 937a7c6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2884,7 +2884,7 @@ public static string SqlDecl (TableMapping.Column p, bool storeDateTimeAsTicks,
public static string SqlType (TableMapping.Column p, bool storeDateTimeAsTicks, bool storeTimeSpanAsTicks)
{
var clrType = p.ColumnType;
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)) {
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)) {
return "integer";
}
else if (clrType == typeof (Single) || clrType == typeof (Double) || clrType == typeof (Decimal)) {
Expand Down Expand Up @@ -3283,7 +3283,7 @@ internal static void BindParameter (Sqlite3Statement stmt, int index, object val
else if (value is Boolean) {
SQLite3.BindInt (stmt, index, (bool)value ? 1 : 0);
}
else if (value is UInt32 || value is Int64) {
else if (value is UInt32 || value is Int64 || value is UInt64) {
SQLite3.BindInt64 (stmt, index, Convert.ToInt64 (value));
}
else if (value is Single || value is Double || value is Decimal) {
Expand Down Expand Up @@ -3417,6 +3417,9 @@ object ReadCol (Sqlite3Statement stmt, int index, SQLite3.ColType type, Type clr
else if (clrType == typeof (Int64)) {
return SQLite3.ColumnInt64 (stmt, index);
}
else if (clrType == typeof (UInt64)) {
return (ulong)SQLite3.ColumnInt64 (stmt, index);
}
else if (clrType == typeof (UInt32)) {
return (uint)SQLite3.ColumnInt64 (stmt, index);
}
Expand Down Expand Up @@ -3561,6 +3564,12 @@ internal static Action<object, Sqlite3Statement, int> GetFastSetter<T> (SQLiteCo
return SQLite3.ColumnInt64 (stmt, index);
});
}
else if (clrType == typeof(UInt64))
{
fastSetter = CreateNullableTypedSetterDelegate<T, UInt64>(column, (stmt, index) => {
return (ulong)SQLite3.ColumnInt64(stmt, index);
});
}
else if (clrType == typeof (UInt32)) {
fastSetter = CreateNullableTypedSetterDelegate<T, UInt32> (column, (stmt, index) => {
return (uint)SQLite3.ColumnInt64 (stmt, index);
Expand Down

0 comments on commit 937a7c6

Please sign in to comment.