1.解决保存新列数据存在的问题

This commit is contained in:
HCL 2023-07-24 11:18:29 +08:00
parent 3e09d7c4d6
commit 670a5004c1
2 changed files with 9 additions and 7 deletions

View File

@ -108,12 +108,14 @@ namespace Aitex.Core.RT.DBCore
if (!string.IsNullOrEmpty(primaryKey) && primaryKeyType != null && !columns.Keys.Contains(primaryKey))
{
sql += _dataBase.GetSqlByNameType(primaryKey, primaryKeyType);
sql += ',';
}
//列名
foreach (KeyValuePair<string, Type> column in columns)
{
sql += _dataBase.GetSqlByNameType(column.Key, column.Value);
sql += ',';
}
if (string.IsNullOrEmpty(sql))

View File

@ -34,31 +34,31 @@ namespace Aitex.Core.RT.DBCore
if (type == typeof(int) || type == typeof(ushort) || type == typeof(short))
{
sql = $"\"{name}\" integer,";
sql = $"\"{name}\" integer";
}
else if (type == typeof(double) || type == typeof(float))
{
sql = $"\"{name}\" real,";
sql = $"\"{name}\" real";
}
else if (type == typeof(string))
{
sql = $"\"{name}\" text,";
sql = $"\"{name}\" text";
}
else if (type == typeof(DateTime))
{
sql = $"\"{name}\" timestamp without time zone,";
sql = $"\"{name}\" timestamp without time zone";
}
else if (type == typeof(bool))
{
sql = $"\"{name}\" boolean,";
sql = $"\"{name}\" boolean";
}
else if (type == typeof(byte[]))
{
sql = $"\"{name}\" bytea,";
sql = $"\"{name}\" bytea";
}
else if (type == typeof(Int64))
{
sql = $"\"{name}\" bigint,";
sql = $"\"{name}\" bigint";
}
return sql;