mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-26 05:32:53 +08:00
-
This commit is contained in:
@@ -9,7 +9,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SqliteProvider : AdoProvider
|
||||
public partial class SqliteProvider : AdoProvider
|
||||
{
|
||||
public SqliteProvider() { }
|
||||
public override IDbConnection Connection
|
||||
@@ -94,6 +94,7 @@ namespace SqlSugar
|
||||
}
|
||||
if (sqlParameter.DbType == System.Data.DbType.Guid) {
|
||||
sqlParameter.DbType = System.Data.DbType.String;
|
||||
sqlParameter.Value = sqlParameter.Value.ObjToString();
|
||||
}
|
||||
++index;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public partial class SqliteProvider : AdoProvider
|
||||
{
|
||||
public override void ExecuteBefore(string sql, SugarParameter[] parameters)
|
||||
{
|
||||
if (sql.IsValuable() && parameters.IsValuable())
|
||||
{
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
//Compatible with.NET CORE parameters case
|
||||
var name = parameter.ParameterName;
|
||||
if (!sql.Contains(name) && Regex.IsMatch(sql, "(" + name + "$)" + "|(" + name + @"[ ,\,])", RegexOptions.IgnoreCase)) {
|
||||
parameter.ParameterName=Regex.Match(sql, "(" + name + "$)" + "|(" + name + @"[ ,\,])", RegexOptions.IgnoreCase).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.IsEnableLogEvent)
|
||||
{
|
||||
Action<string, string> action = LogEventStarting;
|
||||
if (action != null)
|
||||
{
|
||||
if (parameters == null || parameters.Length == 0)
|
||||
{
|
||||
action(sql, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
action(sql, this.Context.RewritableMethods.SerializeObject(parameters.Select(it => new { key = it.ParameterName, value = it.Value.ObjToString() })));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -11,7 +11,7 @@ namespace OrmTest.Models
|
||||
[SugarTable("STudent")]
|
||||
public class Student
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "Id")]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "ID")]
|
||||
public int Id { get; set; }
|
||||
public int? SchoolId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
@@ -21,18 +21,18 @@ namespace OrmTest
|
||||
/***SQLITE CORE case sensitive, Unit comment dropped***/
|
||||
|
||||
///***Unit Test***/
|
||||
//new Field(1).Init();
|
||||
//new Where(1).Init();
|
||||
//new Method(1).Init();
|
||||
//new JoinQuery(1).Init();
|
||||
//new SingleQuery(1).Init();
|
||||
//new SelectQuery(1).Init();
|
||||
//new AutoClose(1).Init();
|
||||
//new Insert(1).Init();
|
||||
//new Delete(1).Init();
|
||||
//new Update(1).Init();
|
||||
//new Mapping(1).Init();
|
||||
//new DataTest(1).Init();
|
||||
new Field(1).Init();
|
||||
new Where(1).Init();
|
||||
new Method(1).Init();
|
||||
new JoinQuery(1).Init();
|
||||
new SingleQuery(1).Init();
|
||||
new SelectQuery(1).Init();
|
||||
new AutoClose(1).Init();
|
||||
new Insert(1).Init();
|
||||
new Delete(1).Init();
|
||||
new Update(1).Init();
|
||||
new Mapping(1).Init();
|
||||
new DataTest(1).Init();
|
||||
|
||||
/***Performance Test***/
|
||||
new SqlSugarPerformance(100).Select();
|
||||
|
||||
Reference in New Issue
Block a user