diff --git a/SQLite.Net.Tests/DefaultAttributeTest.cs b/SQLite.Net.Tests/DefaultAttributeTest.cs
index 3088eab4..c3e001e0 100644
--- a/SQLite.Net.Tests/DefaultAttributeTest.cs
+++ b/SQLite.Net.Tests/DefaultAttributeTest.cs
@@ -96,23 +96,6 @@ public object GetValue(MemberInfo m, object obj)
};
}
- public bool TryBindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, object value)
- {
- return false;
- }
-
- public bool TryGetSqliteColumnType(Type type, out string sqliteType)
- {
- sqliteType = string.Empty;
- return false;
- }
-
- public bool TryReadCol(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, Type clrType, out object? value)
- {
- value = null;
- return false;
- }
-
public bool IsIgnored(MemberInfo p)
{
return false;
diff --git a/SQLite.Net.Tests/IgnoreTest.cs b/SQLite.Net.Tests/IgnoreTest.cs
index 04edb9b1..eadae217 100644
--- a/SQLite.Net.Tests/IgnoreTest.cs
+++ b/SQLite.Net.Tests/IgnoreTest.cs
@@ -54,23 +54,6 @@ public object GetValue(MemberInfo m, object obj)
};
}
- public bool TryBindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, object value)
- {
- return false;
- }
-
- public bool TryGetSqliteColumnType(Type type, out string sqliteType)
- {
- sqliteType = string.Empty;
- return false;
- }
-
- public bool TryReadCol(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, Type clrType, out object? value)
- {
- value = null;
- return false;
- }
-
public bool IsIgnored(MemberInfo p)
{
return p.IsDefined(typeof (TestIgnoreAttribute), true);
diff --git a/src/SQLite.Net/Interfaces/ISQLiteApi.cs b/src/SQLite.Net/Interfaces/ISQLiteApi.cs
index 08eb89e0..3d8f01e2 100644
--- a/src/SQLite.Net/Interfaces/ISQLiteApi.cs
+++ b/src/SQLite.Net/Interfaces/ISQLiteApi.cs
@@ -24,7 +24,11 @@
namespace SQLite.Net2
{
public interface IDbHandle { }
- public interface IDbStatement { }
+
+ public interface IDbStatement
+ {
+ object Handle { get; }
+ }
public interface IDbBackupHandle { }
public interface ISQLiteApi
diff --git a/src/SQLite.Net/Interop/SQLiteApi.cs b/src/SQLite.Net/Interop/SQLiteApi.cs
index 6810f891..9fe4feb3 100644
--- a/src/SQLite.Net/Interop/SQLiteApi.cs
+++ b/src/SQLite.Net/Interop/SQLiteApi.cs
@@ -395,6 +395,8 @@ public bool Equals(IDbHandle other)
private struct DbStatement : IDbStatement
{
+ public object Handle => StmtPtr;
+
public sqlite3_stmt StmtPtr { get; private set; }
public DbStatement(sqlite3_stmt stmtPtr)
diff --git a/src/SQLite.Net/Orm.cs b/src/SQLite.Net/Orm.cs
index 2f750813..b43e5b41 100644
--- a/src/SQLite.Net/Orm.cs
+++ b/src/SQLite.Net/Orm.cs
@@ -134,10 +134,6 @@ private static string SqlType(TableMapping.Column p, bool storeDateTimeAsTicks,
{
return "text";
}
- if (ColumnInformationProvider.TryGetSqliteColumnType(clrType, out var result))
- {
- return result;
- }
if (serializer != null && serializer.CanDeserialize(clrType))
{
return "blob";
diff --git a/src/SQLite.Net/SQLite.Net2.csproj b/src/SQLite.Net/SQLite.Net2.csproj
index 8f049a3b..cc45dbb7 100644
--- a/src/SQLite.Net/SQLite.Net2.csproj
+++ b/src/SQLite.Net/SQLite.Net2.csproj
@@ -32,7 +32,7 @@
sqlite-net2 light ORM for SQLite
sqlite-net2 allows applications to manage data in SQLite databases using Entity Framework like queries, but much lighter
$(AssemblyName) ($(TargetFramework))
- .10
+ .13
$(Version)$(VersionSuffix)
Benjamin Mayrargue
Benjamin Mayrargue
diff --git a/src/SQLite.Net/SQLiteCommand.cs b/src/SQLite.Net/SQLiteCommand.cs
index b9316f74..02304dd7 100644
--- a/src/SQLite.Net/SQLiteCommand.cs
+++ b/src/SQLite.Net/SQLiteCommand.cs
@@ -171,13 +171,17 @@ public IEnumerable ExecuteDeferredQuery(TableMapping map)
while (sqlite.Step(stmt) == Result.Row)
{
- var obj = isPrimitiveType ? null : _conn.Resolver.CreateObject(map.MappedType);
- if (_conn.ColumnInformationProvider.TryReadObject(obj, sqlite, stmt))
+ var obj = isPrimitiveType
+ ? null
+ : _conn.ColumnInformationProvider.TryReadObject(map, sqlite, stmt);
+
+ if (obj != null)
{
yield return (T)obj;
}
else
{
+ obj = isPrimitiveType ? null : _conn.Resolver.CreateObject(map.MappedType);
for (var i = 0; i < cols.Length; i++)
{
ColType colType;
@@ -443,10 +447,6 @@ internal static void BindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, in
isqLite3Api.BindText16(stmt, index, val, -1, NegativePointer);
}
}
- else if (Orm.ColumnInformationProvider.TryBindParameter(isqLite3Api, stmt, index, value))
- {
- return;
- }
else if (value.GetType().GetTypeInfo().IsEnum)
{
isqLite3Api.BindInt(stmt, index, Convert.ToInt32(value));
@@ -634,10 +634,6 @@ private object ReadCol(IDbStatement stmt, int index, ColType type, Type clrType)
var value = (sbyte) sqlite.ColumnInt(stmt, index);
return _conn.Resolver.CreateObject(clrType, new object[] {value});
}
- if (_conn.ColumnInformationProvider.TryReadCol(sqlite, stmt, index, clrType, out var obj))
- {
- return obj!;
- }
if (clrType == typeof (byte[]))
{
return sqlite.ColumnByteArray(stmt, index).ToArray();
diff --git a/src/SQLite.Net/Tools/DefaultColumnInformationProvider.cs b/src/SQLite.Net/Tools/DefaultColumnInformationProvider.cs
index 6e566c20..9a27dab4 100644
--- a/src/SQLite.Net/Tools/DefaultColumnInformationProvider.cs
+++ b/src/SQLite.Net/Tools/DefaultColumnInformationProvider.cs
@@ -132,23 +132,6 @@ public object GetValue(MemberInfo m, object obj)
_ => throw new NotSupportedException($"{m.GetType()} is not supported.")
};
}
-
- public virtual bool TryBindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, object value)
- {
- return false;
- }
-
- public virtual bool TryGetSqliteColumnType(Type type, out string sqliteType)
- {
- sqliteType = string.Empty;
- return false;
- }
-
- public virtual bool TryReadCol(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, Type clrType, out object? value)
- {
- value = null;
- return false;
- }
#endregion
}
}
diff --git a/src/SQLite.Net/Tools/IColumnInformationProvider.cs b/src/SQLite.Net/Tools/IColumnInformationProvider.cs
index 70390e95..59d2819a 100644
--- a/src/SQLite.Net/Tools/IColumnInformationProvider.cs
+++ b/src/SQLite.Net/Tools/IColumnInformationProvider.cs
@@ -17,13 +17,15 @@ public interface IColumnInformationProvider
string GetColumnName(Type containedType, MemberInfo p, int tupleElementIndex);
Type GetMemberType(MemberInfo m);
object GetValue(MemberInfo m, object obj);
+
///
- /// Attempts to read an object from . Returns true if successful.
+ /// Attempts to read an object from . Returns non-null if the object is supported.
///
- bool TryReadObject(object obj, ISQLiteApi sqLiteApi, IDbStatement stmt) => false;
- bool TryBindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, object value);
- bool TryGetSqliteColumnType(Type type, out string sqliteType);
- bool TryReadCol(ISQLiteApi isqLite3Api, IDbStatement stmt, int index, Type clrType, out object? value);
+ /// Table mapping for the type to return
+ /// SQLite API
+ /// Statement row to read from.
+ /// An object or null if the table/type is not supported.
+ object? TryReadObject(TableMapping mapping, ISQLiteApi sqLiteApi, IDbStatement stmt) => null;
}
}