mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Upadte Sqlite
This commit is contained in:
parent
b68e26b17a
commit
2a900481fd
@ -1,4 +1,6 @@
|
|||||||
namespace SqlSugar
|
using System;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public class SqliteInsertBuilder : InsertBuilder
|
public class SqliteInsertBuilder : InsertBuilder
|
||||||
{
|
{
|
||||||
@ -23,5 +25,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string SqlTemplateBatch
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "INSERT INTO {0} ({1})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object FormatValue(object value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return "NULL";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var type = value.GetType();
|
||||||
|
if (type == PubConst.DateType)
|
||||||
|
{
|
||||||
|
var date = value.ObjToDate();
|
||||||
|
if (date < Convert.ToDateTime("1900-1-1"))
|
||||||
|
{
|
||||||
|
date = Convert.ToDateTime("1900-1-1");
|
||||||
|
}
|
||||||
|
return "'" + date.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'";
|
||||||
|
}
|
||||||
|
else if (type == PubConst.BoolType)
|
||||||
|
{
|
||||||
|
return value.ObjToBool() ? "1" : "0";
|
||||||
|
}
|
||||||
|
else if (type == PubConst.StringType || type == PubConst.ObjType)
|
||||||
|
{
|
||||||
|
return "'" + value.ToString().ToSqlFilter() + "'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "'"+value.ToString() + "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user