mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 增加 Async CancellationToken OnDuplicateKeyUpdate/OnConflictDoUpdate;
This commit is contained in:
parent
37cd18d7c4
commit
b25bcf8ee5
@ -6,6 +6,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.KingbaseES
|
namespace FreeSql.KingbaseES
|
||||||
@ -177,7 +178,7 @@ namespace FreeSql.KingbaseES
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -188,7 +189,7 @@ namespace FreeSql.KingbaseES
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _insert.InternalOrm.Ado.ExecuteNonQueryAsync(_insert.InternalConnection, _insert.InternalTransaction, CommandType.Text, sql, _insert._commandTimeout, _insert.InternalParams);
|
ret = await _insert.InternalOrm.Ado.ExecuteNonQueryAsync(_insert.InternalConnection, _insert.InternalTransaction, CommandType.Text, sql, _insert._commandTimeout, _insert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.MySql.Curd
|
namespace FreeSql.MySql.Curd
|
||||||
@ -136,7 +137,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -147,7 +148,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _mysqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_mysqlInsert.InternalConnection, _mysqlInsert.InternalTransaction, CommandType.Text, sql, _mysqlInsert._commandTimeout, _mysqlInsert.InternalParams);
|
ret = await _mysqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_mysqlInsert.InternalConnection, _mysqlInsert.InternalTransaction, CommandType.Text, sql, _mysqlInsert._commandTimeout, _mysqlInsert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.Odbc.KingbaseES
|
namespace FreeSql.Odbc.KingbaseES
|
||||||
@ -177,7 +178,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -188,7 +189,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams);
|
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.Odbc.MySql
|
namespace FreeSql.Odbc.MySql
|
||||||
@ -136,7 +137,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -147,7 +148,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _mysqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_mysqlInsert.InternalConnection, _mysqlInsert.InternalTransaction, CommandType.Text, sql, _mysqlInsert._commandTimeout, _mysqlInsert.InternalParams);
|
ret = await _mysqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_mysqlInsert.InternalConnection, _mysqlInsert.InternalTransaction, CommandType.Text, sql, _mysqlInsert._commandTimeout, _mysqlInsert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.Odbc.PostgreSQL
|
namespace FreeSql.Odbc.PostgreSQL
|
||||||
@ -177,7 +178,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -188,7 +189,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams);
|
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FreeSql.PostgreSQL.Curd
|
namespace FreeSql.PostgreSQL.Curd
|
||||||
@ -177,7 +178,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public Task<long> ExecuteAffrowsAsync()
|
async public Task<long> ExecuteAffrowsAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
var sql = this.ToSql();
|
||||||
if (string.IsNullOrEmpty(sql)) return 0;
|
if (string.IsNullOrEmpty(sql)) return 0;
|
||||||
@ -188,7 +189,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams);
|
ret = await _pgsqlInsert.InternalOrm.Ado.ExecuteNonQueryAsync(_pgsqlInsert.InternalConnection, _pgsqlInsert.InternalTransaction, CommandType.Text, sql, _pgsqlInsert._commandTimeout, _pgsqlInsert.InternalParams, cancellationToken);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user