Update sqlite

This commit is contained in:
sunkaixuan
2022-12-20 15:53:47 +08:00
parent c1aa361854
commit 25d105122e
2 changed files with 44 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ namespace SqlSugar
private string GetOracleUpdateColums(int i,DbColumnInfo m,bool iswhere)
{
return string.Format("\"{0}\"={1}", m.DbColumnName.ToUpper(), FormatValue(i,m.DbColumnName,m.Value,iswhere));
return string.Format("\"{0}\"={1}", m.DbColumnName.ToUpper(),base.GetDbColumn(m, FormatValue(i,m.DbColumnName,m.Value,iswhere)));
}
public object FormatValue(int i,string name,object value,bool iswhere)

View File

@@ -23,6 +23,47 @@ namespace OrmTest
}).ExecuteCommand();
db.Insertable(new ORDER1() { Name = "a" }).ExecuteCommand();
db.Updateable(new Order1()
{
CustomId = 1,
CreateTime = DateTime.Now,
Id = 1,
Price = 1,
Name = "a"
}).ExecuteCommand();
db.Updateable(new List<Order1>(){ new Order1()
{
CustomId = 1,
CreateTime = DateTime.Now,
Id = 1,
Price = 1,
Name = "a"
},
new Order1()
{
CustomId = 1,
CreateTime = DateTime.Now,
Id = 1,
Price = 1,
Name = "a"
} }).ExecuteCommand();
db.Updateable<Order1>().SetColumns(it => new Order1()
{
CustomId = 1,
Price = 1,
Name = "a"
}, true).Where(it => it.Id == 1).ExecuteCommand();
db.Updateable<ORDER1>().SetColumns(it => new ORDER1()
{
CustomId = 1,
Price = 1,
Name = "a"
}, true).Where(it => it.Id == 1).ExecuteCommand();
}
public class Order1
@@ -34,7 +75,7 @@ namespace OrmTest
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertServerTime =true)]
[SugarColumn(InsertServerTime =true,UpdateServerTime =true)]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }
@@ -49,7 +90,7 @@ namespace OrmTest
/// </summary>
public string Name { get; set; }
public decimal Price { get; set; }
[SugarColumn(InsertSql = "'2020-1-1'")]
[SugarColumn(InsertSql = "'2020-1-1'", UpdateSql = "'2020-1-1'")]
public DateTime CreateTime { get; set; }
[SugarColumn(IsNullable = true)]
public int CustomId { get; set; }