mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
db.Fastest oracle
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -9,6 +10,23 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class OracleFastBuilder : FastBuilder, IFastBuilder
|
public class OracleFastBuilder : FastBuilder, IFastBuilder
|
||||||
{
|
{
|
||||||
|
public override string UpdateSql { get; set; } = "UPDATE (SELECT A.NAME ANAME,B.NAME BNAME FROM A,B WHERE A.ID=B.ID)SET ANAME = BNAME;";
|
||||||
|
public override async Task CreateTempAsync<T>(DataTable dt)
|
||||||
|
{
|
||||||
|
dt.TableName = "T" + SnowFlakeSingle.instance.getID().ToString().Substring(4,16);
|
||||||
|
var sql = this.Context.Queryable<T>().Where(it => false).Select("*").ToSql().Key;
|
||||||
|
await this.Context.Ado.ExecuteCommandAsync($"create global temporary table {dt.TableName} as {sql} ");
|
||||||
|
var xxx = this.Context.Queryable<T>().AS(dt.TableName).ToList();
|
||||||
|
}
|
||||||
|
public override async Task<int> UpdateByTempAsync(string tableName, string tempName, string[] updateColumns, string[] whereColumns)
|
||||||
|
{
|
||||||
|
Check.ArgumentNullException(!updateColumns.Any(), "update columns count is 0");
|
||||||
|
Check.ArgumentNullException(!whereColumns.Any(), "where columns count is 0");
|
||||||
|
var sets = string.Join(",", updateColumns.Select(it => $"TM.{it}=TE.{it}"));
|
||||||
|
var wheres = string.Join(",", whereColumns.Select(it => $"TM.{it}=TE.{it}"));
|
||||||
|
string sql = string.Format(UpdateSql, sets, tableName, tempName, wheres);
|
||||||
|
return await this.Context.Ado.ExecuteCommandAsync(sql);
|
||||||
|
}
|
||||||
private OracleBulkCopy GetBulkCopyInstance()
|
private OracleBulkCopy GetBulkCopyInstance()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user