mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update Core
This commit is contained in:
parent
185e5349fc
commit
c7a04e43cb
@ -322,6 +322,10 @@ namespace SqlSugar
|
||||
properyTypeName = this.Context.Ado.DbBind.GetDbTypeName(propertyType.Name);
|
||||
}
|
||||
var dataType = dc.DataType;
|
||||
if (properyTypeName == "boolean" && dataType == "bool")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return properyTypeName != dataType;
|
||||
}
|
||||
#endregion
|
||||
|
@ -64,6 +64,7 @@ namespace SqlSugar
|
||||
private static readonly MethodInfo getOtherNull = typeof(IDataRecordExtensions).GetMethod("GetOtherNull");
|
||||
private static readonly MethodInfo getOther = typeof(IDataRecordExtensions).GetMethod("GetOther");
|
||||
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 delegate T Load(IDataRecord dataRecord);
|
||||
@ -153,6 +154,22 @@ namespace SqlSugar
|
||||
generator.Emit(OpCodes.Callvirt, columnInfo.PropertyInfo.GetSetMethod(true));
|
||||
generator.MarkLabel(endIfLabel);
|
||||
}
|
||||
if (columnInfo.IsArray)
|
||||
{
|
||||
MethodInfo arrayMehtod = getArray.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType);
|
||||
int i = DataRecord.GetOrdinal(fieldName);
|
||||
Label endIfLabel = generator.DefineLabel();
|
||||
generator.Emit(OpCodes.Ldarg_0);
|
||||
generator.Emit(OpCodes.Ldc_I4, i);
|
||||
generator.Emit(OpCodes.Callvirt, isDBNullMethod);
|
||||
generator.Emit(OpCodes.Brtrue, endIfLabel);
|
||||
generator.Emit(OpCodes.Ldloc, result);
|
||||
generator.Emit(OpCodes.Ldarg_0);
|
||||
generator.Emit(OpCodes.Ldc_I4, i);
|
||||
generator.Emit(OpCodes.Call, arrayMehtod);
|
||||
generator.Emit(OpCodes.Callvirt, columnInfo.PropertyInfo.GetSetMethod(true));
|
||||
generator.MarkLabel(endIfLabel);
|
||||
}
|
||||
}
|
||||
private void BindField(ILGenerator generator, LocalBuilder result, EntityColumnInfo columnInfo, string fieldName)
|
||||
{
|
||||
|
@ -248,6 +248,14 @@ namespace SqlSugar
|
||||
var value = obj.ObjToString();
|
||||
return new SerializeService().DeserializeObject<T>(value);
|
||||
}
|
||||
public static T GetArray<T>(this IDataReader dr, int i)
|
||||
{
|
||||
//pgsql
|
||||
var obj = dr.GetValue(i);
|
||||
if (obj == null)
|
||||
return default(T);
|
||||
return (T)obj;
|
||||
}
|
||||
|
||||
public static Nullable<T> GetConvertEnum_Null<T>(this IDataReader dr, int i) where T : struct
|
||||
{
|
||||
|
@ -194,6 +194,7 @@ namespace SqlSugar
|
||||
column.DefaultValue = sugarColumn.DefaultValue;
|
||||
column.IndexGroupNameList = sugarColumn.IndexGroupNameList;
|
||||
column.IsOnlyIgnoreUpdate = sugarColumn.IsOnlyIgnoreUpdate;
|
||||
column.IsArray = sugarColumn.IsArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -343,6 +343,10 @@ namespace SqlSugar
|
||||
{
|
||||
paramters.IsJson = true;
|
||||
}
|
||||
if (item.IsArray)
|
||||
{
|
||||
paramters.IsArray = true;
|
||||
}
|
||||
this.InsertBuilder.Parameters.Add(paramters);
|
||||
}
|
||||
}
|
||||
@ -407,6 +411,10 @@ namespace SqlSugar
|
||||
{
|
||||
columnInfo.IsJson = true;
|
||||
}
|
||||
if (column.IsArray)
|
||||
{
|
||||
columnInfo.IsArray = true;
|
||||
}
|
||||
if (columnInfo.PropertyType.IsEnum())
|
||||
{
|
||||
columnInfo.Value = Convert.ToInt64(columnInfo.Value);
|
||||
|
@ -1470,7 +1470,7 @@ namespace SqlSugar
|
||||
{
|
||||
new ConditionalModel()
|
||||
{
|
||||
FieldName=whereCol.DbColumnName,
|
||||
FieldName=this.SqlBuilder.GetTranslationColumnName(whereCol.DbColumnName),
|
||||
ConditionalType= ConditionalType.In,
|
||||
FieldValue=string.Join(",",inValues.Distinct())
|
||||
}
|
||||
|
@ -131,6 +131,14 @@ namespace SqlSugar
|
||||
{
|
||||
parameterName = parameterName.Replace(".", "_");
|
||||
}
|
||||
if (parameterName.Contains("["))
|
||||
{
|
||||
parameterName = parameterName.Replace("[", "_");
|
||||
}
|
||||
if (parameterName.Contains("]"))
|
||||
{
|
||||
parameterName = parameterName.Replace("]", "_");
|
||||
}
|
||||
switch (item.ConditionalType)
|
||||
{
|
||||
case ConditionalType.Equal:
|
||||
|
@ -15,7 +15,7 @@ namespace SqlSugar
|
||||
/// ** date:2017/1/2
|
||||
/// ** email:610262374@qq.com
|
||||
/// </summary>
|
||||
public partial class SqlSugarProvider: ISqlSugarClient
|
||||
public partial class SqlSugarProvider : ISqlSugarClient
|
||||
{
|
||||
|
||||
#region Constructor
|
||||
@ -139,7 +139,7 @@ namespace SqlSugar
|
||||
this.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3,JoinQueryInfos>> joinExpression)
|
||||
public virtual ISugarQueryable<T, T2, T3> Queryable<T, T2, T3>(Expression<Func<T, T2, T3, JoinQueryInfos>> joinExpression)
|
||||
{
|
||||
InitMappingInfo<T, T2, T3>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3) };
|
||||
@ -155,7 +155,7 @@ namespace SqlSugar
|
||||
this.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4,JoinQueryInfos>> joinExpression)
|
||||
public virtual ISugarQueryable<T, T2, T3, T4> Queryable<T, T2, T3, T4>(Expression<Func<T, T2, T3, T4, JoinQueryInfos>> joinExpression)
|
||||
{
|
||||
InitMappingInfo<T, T2, T3, T4>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4) };
|
||||
@ -171,7 +171,7 @@ namespace SqlSugar
|
||||
this.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5,JoinQueryInfos>> joinExpression)
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5> Queryable<T, T2, T3, T4, T5>(Expression<Func<T, T2, T3, T4, T5, JoinQueryInfos>> joinExpression)
|
||||
{
|
||||
InitMappingInfo<T, T2, T3, T4, T5>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5) };
|
||||
@ -268,7 +268,7 @@ namespace SqlSugar
|
||||
this.CreateQueryJoin(joinExpression, types, queryable);
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,JoinQueryInfos>> joinExpression)
|
||||
public virtual ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, JoinQueryInfos>> joinExpression)
|
||||
{
|
||||
InitMappingInfo<T, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>();
|
||||
var types = new Type[] { typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8), typeof(T9), typeof(T10), typeof(T11) };
|
||||
@ -535,7 +535,7 @@ namespace SqlSugar
|
||||
}
|
||||
public virtual IInsertable<T> Insertable<T>(List<T> insertObjs) where T : class, new()
|
||||
{
|
||||
if (insertObjs == null|| insertObjs.IsNullOrEmpty())
|
||||
if (insertObjs == null || insertObjs.IsNullOrEmpty())
|
||||
{
|
||||
insertObjs = new List<T>();
|
||||
insertObjs.Add(default(T));
|
||||
@ -644,7 +644,7 @@ namespace SqlSugar
|
||||
result.UpdateParameterIsNull = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
|
||||
{
|
||||
@ -810,7 +810,7 @@ namespace SqlSugar
|
||||
|
||||
public async Task<int> SaveQueuesAsync(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.ExecuteCommandAsync(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.ExecuteCommandAsync(sql, parameters); });
|
||||
}
|
||||
public List<T> SaveQueues<T>(bool isTran = true)
|
||||
{
|
||||
@ -818,7 +818,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<List<T>> SaveQueuesAsync<T>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>> SaveQueues<T, T2>(bool isTran = true)
|
||||
{
|
||||
@ -826,7 +826,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>>> SaveQueuesAsync<T, T2>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>, List<T3>> SaveQueues<T, T2, T3>(bool isTran = true)
|
||||
{
|
||||
@ -834,7 +834,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>, List<T3>>> SaveQueuesAsync<T, T2, T3>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>, List<T3>, List<T4>> SaveQueues<T, T2, T3, T4>(bool isTran = true)
|
||||
{
|
||||
@ -842,7 +842,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>>> SaveQueuesAsync<T, T2, T3, T4>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>> SaveQueues<T, T2, T3, T4, T5>(bool isTran = true)
|
||||
{
|
||||
@ -850,7 +850,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>>> SaveQueuesAsync<T, T2, T3, T4, T5>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>> SaveQueues<T, T2, T3, T4, T5, T6>(bool isTran = true)
|
||||
{
|
||||
@ -858,7 +858,7 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>>> SaveQueuesAsync<T, T2, T3, T4, T5, T6>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5, T6>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5, T6>(sql, parameters); });
|
||||
}
|
||||
public Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>> SaveQueues<T, T2, T3, T4, T5, T6, T7>(bool isTran = true)
|
||||
{
|
||||
@ -866,17 +866,17 @@ namespace SqlSugar
|
||||
}
|
||||
public async Task<Tuple<List<T>, List<T2>, List<T3>, List<T4>, List<T5>, List<T6>, List<T7>>> SaveQueuesAsync<T, T2, T3, T4, T5, T6, T7>(bool isTran = true)
|
||||
{
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5, T6, T7>(sql, parameters); });
|
||||
return await SaveQueuesProviderAsync(isTran, (sql, parameters) => { return this.Ado.SqlQueryAsync<T, T2, T3, T4, T5, T6, T7>(sql, parameters); });
|
||||
}
|
||||
public void AddQueue(string sql, object parsmeters=null)
|
||||
public void AddQueue(string sql, object parsmeters = null)
|
||||
{
|
||||
if (Queues == null)
|
||||
{
|
||||
Queues = new QueueList();
|
||||
}
|
||||
this.Queues.Add(sql,this.Context.Ado.GetParameters(parsmeters));
|
||||
this.Queues.Add(sql, this.Context.Ado.GetParameters(parsmeters));
|
||||
}
|
||||
public void AddQueue(string sql, SugarParameter parsmeter)
|
||||
public void AddQueue(string sql, SugarParameter parsmeter)
|
||||
{
|
||||
if (Queues == null)
|
||||
{
|
||||
@ -892,7 +892,7 @@ namespace SqlSugar
|
||||
}
|
||||
this.Queues.Add(sql, parsmeters);
|
||||
}
|
||||
public QueueList Queues { get { if (_Queues == null) { _Queues = new QueueList(); } return _Queues; } set { _Queues = value; } }
|
||||
public QueueList Queues { get { if (_Queues == null) { _Queues = new QueueList(); } return _Queues; } set { _Queues = value; } }
|
||||
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
this.Queues.Clear();
|
||||
var result =await func(sqlBuilder.ToString(), parsmeters);
|
||||
var result = await func(sqlBuilder.ToString(), parsmeters);
|
||||
if (isTran) this.Ado.CommitTran();
|
||||
return result;
|
||||
}
|
||||
@ -950,7 +950,8 @@ namespace SqlSugar
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.CurrentConnectionConfig.DbType == DbType.Oracle) {
|
||||
if (this.CurrentConnectionConfig.DbType == DbType.Oracle)
|
||||
{
|
||||
throw new Exception("Oracle no support SaveQueues");
|
||||
}
|
||||
if (this.Queues == null || this.Queues.Count == 0) return default(T);
|
||||
@ -984,7 +985,7 @@ namespace SqlSugar
|
||||
.TrimEnd('\n')
|
||||
.TrimEnd('\r')
|
||||
.TrimEnd('\n')
|
||||
.TrimEnd(';')+";";
|
||||
.TrimEnd(';') + ";";
|
||||
sqlBuilder.AppendLine(itemSql);
|
||||
index++;
|
||||
}
|
||||
|
@ -448,6 +448,10 @@ namespace SqlSugar
|
||||
{
|
||||
Check.Exception(true, ErrorMessage.GetThrowMessage("UpdateColumns no support IsJson", "SetColumns方式更新不支持IsJson,你可以使用db.Updateable(实体)的方式更新"));
|
||||
}
|
||||
if (this.EntityInfo.Columns.Any(it => it.IsArray))
|
||||
{
|
||||
Check.Exception(true, ErrorMessage.GetThrowMessage("UpdateColumns no support IsArray", "SetColumns方式更新不支持IsArray,你可以使用db.Updateable(实体)的方式更新"));
|
||||
}
|
||||
}
|
||||
private void SetUpdateItemByDic(int i, T item, List<DbColumnInfo> updateItem)
|
||||
{
|
||||
@ -488,8 +492,13 @@ namespace SqlSugar
|
||||
}
|
||||
if (column.IsJson)
|
||||
{
|
||||
columnInfo.IsJson = true;
|
||||
columnInfo.Value = this.Context.Utilities.SerializeObject(columnInfo.Value);
|
||||
}
|
||||
if (column.IsArray)
|
||||
{
|
||||
columnInfo.IsArray = true;
|
||||
}
|
||||
var tranColumn = EntityInfo.Columns.FirstOrDefault(it => it.IsTranscoding && it.DbColumnName.Equals(column.DbColumnName, StringComparison.CurrentCultureIgnoreCase));
|
||||
if (tranColumn != null && columnInfo.Value.HasValue())
|
||||
{
|
||||
@ -530,7 +539,16 @@ namespace SqlSugar
|
||||
{
|
||||
continue;
|
||||
}
|
||||
this.UpdateBuilder.Parameters.Add(new SugarParameter(this.SqlBuilder.SqlParameterKeyWord + item.DbColumnName, item.Value, item.PropertyType));
|
||||
var parameter = new SugarParameter(this.SqlBuilder.SqlParameterKeyWord + item.DbColumnName, item.Value, item.PropertyType);
|
||||
if (item.IsJson)
|
||||
{
|
||||
parameter.IsJson = true;
|
||||
}
|
||||
if (item.IsArray)
|
||||
{
|
||||
parameter.IsArray = true;
|
||||
}
|
||||
this.UpdateBuilder.Parameters.Add(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ namespace SqlSugar
|
||||
public object Value { get; set; }
|
||||
public int DecimalDigits { get; set; }
|
||||
public int Scale { get; set; }
|
||||
public bool IsArray { get; set; }
|
||||
internal bool IsJson { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -33,5 +33,6 @@ namespace SqlSugar
|
||||
public bool IsJson { get; set; }
|
||||
public bool NoSerialize { get; set; }
|
||||
public string[] IndexGroupNameList { get; set; }
|
||||
public bool IsArray { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +171,13 @@ namespace SqlSugar
|
||||
set { _IndexGroupNameList = value; }
|
||||
}
|
||||
|
||||
private bool _IsArray;
|
||||
public bool IsArray
|
||||
{
|
||||
get { return _IsArray; }
|
||||
set { _IsArray = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -234,5 +234,6 @@ namespace SqlSugar
|
||||
|
||||
public string TypeName { get; set; }
|
||||
public bool IsJson { get; set; }
|
||||
public bool IsArray { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
namespace SqlSugar
|
||||
{
|
||||
@ -277,7 +278,19 @@ namespace SqlSugar
|
||||
var typeName = tType.Name;
|
||||
if (item.PropertyType.IsClass())
|
||||
{
|
||||
result.Add(name, DataReaderToDynamicList_Part(readerValues, item, reval));
|
||||
if (readerValues != null &&
|
||||
readerValues.Count == 1 &&
|
||||
readerValues.First().Key == name &&
|
||||
readerValues.First().Value!=null&&
|
||||
readerValues.First().Value.GetType()==UtilConstants.StringType&&
|
||||
Regex.IsMatch(readerValues.First().Value.ObjToString(), @"^\{.+\}$"))
|
||||
{
|
||||
result.Add(name, DeserializeObject<Dictionary<string,object>>(readerValues.First().Value.ObjToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(name, DataReaderToDynamicList_Part(readerValues, item, reval));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -99,6 +99,19 @@ namespace SqlSugar
|
||||
{
|
||||
sqlParameter.NpgsqlDbType = NpgsqlDbType.Json;
|
||||
}
|
||||
if (parameter.IsArray)
|
||||
{
|
||||
// sqlParameter.Value = this.Context.Utilities.SerializeObject(sqlParameter.Value);
|
||||
var type = sqlParameter.Value.GetType();
|
||||
if (ArrayMapping.ContainsKey(type))
|
||||
{
|
||||
sqlParameter.NpgsqlDbType = ArrayMapping[type] | NpgsqlDbType.Array;
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Exception(true, sqlParameter.Value.GetType().Name + " No Support");
|
||||
}
|
||||
}
|
||||
if (sqlParameter.Direction == 0)
|
||||
{
|
||||
sqlParameter.Direction = ParameterDirection.Input;
|
||||
@ -114,5 +127,31 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static readonly Dictionary<Type, NpgsqlDbType> ArrayMapping = new Dictionary<Type, NpgsqlDbType>()
|
||||
{
|
||||
{ typeof(int[]),NpgsqlDbType.Integer},
|
||||
{ typeof(short[]),NpgsqlDbType.Smallint},
|
||||
{ typeof(long[]),NpgsqlDbType.Bigint},
|
||||
{ typeof(decimal[]),NpgsqlDbType.Numeric},
|
||||
{ typeof(char[]),NpgsqlDbType.Text},
|
||||
{ typeof(byte[]),NpgsqlDbType.Bytea},
|
||||
{ typeof(bool[]),NpgsqlDbType.Boolean},
|
||||
{typeof(DateTime[]),NpgsqlDbType.Date},
|
||||
|
||||
|
||||
{ typeof(int?[]),NpgsqlDbType.Integer},
|
||||
{ typeof(short?[]),NpgsqlDbType.Smallint},
|
||||
{ typeof(long?[]),NpgsqlDbType.Bigint},
|
||||
{ typeof(decimal?[]),NpgsqlDbType.Numeric},
|
||||
{ typeof(char?[]),NpgsqlDbType.Text},
|
||||
{ typeof(byte?[]),NpgsqlDbType.Bytea},
|
||||
{ typeof(bool?[]),NpgsqlDbType.Boolean},
|
||||
{typeof(DateTime?[]),NpgsqlDbType.Date},
|
||||
|
||||
|
||||
{ typeof(string[]), NpgsqlDbType.Text},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -253,5 +253,10 @@ namespace SqlSugar
|
||||
{
|
||||
return "RANDOM()";
|
||||
}
|
||||
|
||||
public override string EqualTrue(string fieldName)
|
||||
{
|
||||
return "( " + fieldName + "=true )";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
@ -56,7 +56,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
Loading…
Reference in New Issue
Block a user