Browse Source

Update pgsql array type

pull/31/head
sunkaixuan 2 years ago
parent
commit
08535786f1
  1. 16
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs
  2. 4
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs

16
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableHelper.cs

@ -402,6 +402,22 @@ namespace SqlSugar
if (item.IsArray)
{
parameter.IsArray = true;
if (item.PropertyType.IsIn(typeof(Guid[]), typeof(Guid?[])))
{
parameter.DbType = System.Data.DbType.Guid;
}
else if (item.PropertyType.IsIn(typeof(int[]), typeof(int?[])))
{
parameter.DbType = System.Data.DbType.Int32;
}
else if (item.PropertyType.IsIn(typeof(long[]), typeof(long?[])))
{
parameter.DbType = System.Data.DbType.Int64;
}
else if (item.PropertyType.IsIn(typeof(short[]), typeof(short?[])))
{
parameter.DbType = System.Data.DbType.Int16;
}
}
if (item.Value == null && isDic)
{

4
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs

@ -177,6 +177,10 @@ namespace SqlSugar
{
sqlParameter.NpgsqlDbType = NpgsqlDbType.Bigint | NpgsqlDbType.Array;
}
else if (parameter.DbType.IsIn(System.Data.DbType.Guid))
{
sqlParameter.NpgsqlDbType = NpgsqlDbType.Uuid | NpgsqlDbType.Array;
}
else
{
sqlParameter.NpgsqlDbType = NpgsqlDbType.Text | NpgsqlDbType.Array;

Loading…
Cancel
Save