mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Support OleDb Insert
This commit is contained in:
parent
b31f7118b0
commit
8aa6beee1e
@ -8,6 +8,7 @@ namespace SqlSugar.Access
|
||||
{
|
||||
public class AccessInsertBuilder : InsertBuilder
|
||||
{
|
||||
public override bool IsOleDb { get; set; } = true;
|
||||
public override string SqlTemplate
|
||||
{
|
||||
get
|
||||
@ -17,7 +18,7 @@ namespace SqlSugar.Access
|
||||
return @"INSERT INTO {0}
|
||||
({1})
|
||||
VALUES
|
||||
({2}) ;";
|
||||
({2}) ;select @@identity";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -69,7 +69,16 @@ namespace SqlSugar
|
||||
return 0;
|
||||
}
|
||||
string sql = _ExecuteReturnIdentity();
|
||||
var result = Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
var result = 0;
|
||||
if (InsertBuilder.IsOleDb)
|
||||
{
|
||||
result = Ado.GetInt(sql.Split(';').First(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
result = Ado.GetInt(sql.Split(';').Last(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray());
|
||||
}
|
||||
After(sql, result);
|
||||
return result;
|
||||
}
|
||||
@ -81,7 +90,16 @@ namespace SqlSugar
|
||||
return 0;
|
||||
}
|
||||
string sql = _ExecuteReturnBigIdentity();
|
||||
var result = Convert.ToInt64(Ado.GetScalar(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
long result = 0;
|
||||
if (InsertBuilder.IsOleDb)
|
||||
{
|
||||
result = Convert.ToInt64(Ado.GetScalar(sql.Split(';').First(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
result = Convert.ToInt64(Ado.GetScalar(sql.Split(';').Last(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
}
|
||||
else
|
||||
{
|
||||
result= Convert.ToInt64(Ado.GetScalar(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()));
|
||||
}
|
||||
After(sql, result);
|
||||
return result;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ namespace SqlSugar
|
||||
public EntityInfo EntityInfo { get; set; }
|
||||
public Dictionary<string, int> OracleSeqInfoList { get; set; }
|
||||
public bool IsBlukCopy { get; set; }
|
||||
public virtual bool IsOleDb { get; set; }
|
||||
#endregion
|
||||
|
||||
#region SqlTemplate
|
||||
|
Loading…
Reference in New Issue
Block a user