odbc emit

This commit is contained in:
sunkaixuan 2024-05-08 18:17:49 +08:00
parent 8aca0f0f2b
commit d58de6b9c3
2 changed files with 26 additions and 0 deletions

View File

@ -68,6 +68,8 @@ namespace SqlSugar
private static readonly MethodInfo getJson = typeof(IDataRecordExtensions).GetMethod("GetJson");
private static readonly MethodInfo getArray = typeof(IDataRecordExtensions).GetMethod("GetArray");
private static readonly MethodInfo getEntity = typeof(IDataRecordExtensions).GetMethod("GetEntity", new Type[] { typeof(SqlSugarProvider) });
private static readonly MethodInfo getMyIntNull = typeof(IDataRecordExtensions).GetMethod("GetMyIntNull");
private static readonly MethodInfo getMyInt= typeof(IDataRecordExtensions).GetMethod("GetMyInt");
private delegate T Load(IDataRecord dataRecord);
private Load handler;
@ -359,6 +361,8 @@ namespace SqlSugar
method = isNullableType ? getConvertInt16 : getInt16;
if (bindProperyTypeName == "uint32"&&this.Context.CurrentConnectionConfig.DbType.IsIn(DbType.MySql,DbType.MySqlConnector))
method = null;
if (this.Context.CurrentConnectionConfig.DbType == DbType.OceanBaseForOracle)
method = isNullableType ? getMyIntNull : getMyInt;
break;
case CSharpDataType.@bool:
if (bindProperyTypeName == "bool" || bindProperyTypeName == "boolean")

View File

@ -133,6 +133,28 @@ namespace SqlSugar
var result = dr.GetInt16(i);
return result;
}
public static Int32? GetMyIntNull(this IDataRecord dr, int i)
{
if (dr.IsDBNull(i))
{
return null;
}
if (dr.GetDataTypeName(i) == "NUMBER")
{
return Convert.ToInt32(dr.GetDouble(i));
}
var result = dr.GetInt32(i);
return result;
}
public static Int32 GetMyInt(this IDataRecord dr, int i)
{
if (dr.GetDataTypeName(i) == "NUMBER")
{
return Convert.ToInt32(dr.GetDouble(i));
}
var result = dr.GetInt32(i);
return result;
}
public static Int32? GetConvertInt32(this IDataRecord dr, int i)
{