Skip to content

Commit e342123

Browse files
Fix the unit tests & wrong nesting of new logic
1 parent 29840fe commit e342123

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/SQLite.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,24 +2425,24 @@ internal static void BindParameter (Sqlite3Statement stmt, int index, object val
24252425
}
24262426
} else if (value is DateTimeOffset) {
24272427
SQLite3.BindInt64 (stmt, index, ((DateTimeOffset)value).UtcTicks);
2428-
}
2429-
2430-
// Now we could possibly get an enum, retrieve cached info
2431-
var valueType = value.GetType();
2432-
var enumInfo = EnumCache.GetInfo(valueType);
2433-
if (enumInfo.IsEnum) {
2434-
var enumIntValue = Convert.ToInt32(value);
2435-
if (enumInfo.StoreAsText)
2436-
SQLite3.BindText(stmt, index, enumInfo.EnumValues[enumIntValue], -1, NegativePointer);
2437-
else
2438-
SQLite3.BindInt(stmt, index, enumIntValue);
2439-
} else if (value is byte[]){
2440-
SQLite3.BindBlob(stmt, index, (byte[]) value, ((byte[]) value).Length, NegativePointer);
2441-
} else if (value is Guid) {
2442-
SQLite3.BindText(stmt, index, ((Guid)value).ToString(), 72, NegativePointer);
24432428
} else {
2444-
throw new NotSupportedException("Cannot store type: " + value.GetType());
2445-
}
2429+
// Now we could possibly get an enum, retrieve cached info
2430+
var valueType = value.GetType();
2431+
var enumInfo = EnumCache.GetInfo(valueType);
2432+
if (enumInfo.IsEnum) {
2433+
var enumIntValue = Convert.ToInt32(value);
2434+
if (enumInfo.StoreAsText)
2435+
SQLite3.BindText(stmt, index, enumInfo.EnumValues[enumIntValue], -1, NegativePointer);
2436+
else
2437+
SQLite3.BindInt(stmt, index, enumIntValue);
2438+
} else if (value is byte[]){
2439+
SQLite3.BindBlob(stmt, index, (byte[]) value, ((byte[]) value).Length, NegativePointer);
2440+
} else if (value is Guid) {
2441+
SQLite3.BindText(stmt, index, ((Guid)value).ToString(), 72, NegativePointer);
2442+
} else {
2443+
throw new NotSupportedException("Cannot store type: " + value.GetType());
2444+
}
2445+
}
24462446
}
24472447
}
24482448

0 commit comments

Comments
 (0)