1.解决保存新列数据存在的问题
This commit is contained in:
parent
3e09d7c4d6
commit
670a5004c1
|
@ -108,12 +108,14 @@ namespace Aitex.Core.RT.DBCore
|
||||||
if (!string.IsNullOrEmpty(primaryKey) && primaryKeyType != null && !columns.Keys.Contains(primaryKey))
|
if (!string.IsNullOrEmpty(primaryKey) && primaryKeyType != null && !columns.Keys.Contains(primaryKey))
|
||||||
{
|
{
|
||||||
sql += _dataBase.GetSqlByNameType(primaryKey, primaryKeyType);
|
sql += _dataBase.GetSqlByNameType(primaryKey, primaryKeyType);
|
||||||
|
sql += ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
//列名
|
//列名
|
||||||
foreach (KeyValuePair<string, Type> column in columns)
|
foreach (KeyValuePair<string, Type> column in columns)
|
||||||
{
|
{
|
||||||
sql += _dataBase.GetSqlByNameType(column.Key, column.Value);
|
sql += _dataBase.GetSqlByNameType(column.Key, column.Value);
|
||||||
|
sql += ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(sql))
|
if (string.IsNullOrEmpty(sql))
|
||||||
|
|
|
@ -34,31 +34,31 @@ namespace Aitex.Core.RT.DBCore
|
||||||
|
|
||||||
if (type == typeof(int) || type == typeof(ushort) || type == typeof(short))
|
if (type == typeof(int) || type == typeof(ushort) || type == typeof(short))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" integer,";
|
sql = $"\"{name}\" integer";
|
||||||
}
|
}
|
||||||
else if (type == typeof(double) || type == typeof(float))
|
else if (type == typeof(double) || type == typeof(float))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" real,";
|
sql = $"\"{name}\" real";
|
||||||
}
|
}
|
||||||
else if (type == typeof(string))
|
else if (type == typeof(string))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" text,";
|
sql = $"\"{name}\" text";
|
||||||
}
|
}
|
||||||
else if (type == typeof(DateTime))
|
else if (type == typeof(DateTime))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" timestamp without time zone,";
|
sql = $"\"{name}\" timestamp without time zone";
|
||||||
}
|
}
|
||||||
else if (type == typeof(bool))
|
else if (type == typeof(bool))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" boolean,";
|
sql = $"\"{name}\" boolean";
|
||||||
}
|
}
|
||||||
else if (type == typeof(byte[]))
|
else if (type == typeof(byte[]))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" bytea,";
|
sql = $"\"{name}\" bytea";
|
||||||
}
|
}
|
||||||
else if (type == typeof(Int64))
|
else if (type == typeof(Int64))
|
||||||
{
|
{
|
||||||
sql = $"\"{name}\" bigint,";
|
sql = $"\"{name}\" bigint";
|
||||||
}
|
}
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
|
|
Loading…
Reference in New Issue