mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 补充 同线程时间 fsql.Transaction 事务等级参数的传入;
This commit is contained in:
@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
|
||||
using FreeSql.MySql.Curd;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
@ -70,7 +71,8 @@ namespace FreeSql.MySql
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
|
||||
@ -49,7 +50,8 @@ namespace FreeSql.Odbc.Dameng
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -4,6 +4,7 @@ using FreeSql.Odbc.Default;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
@ -83,7 +84,8 @@ namespace FreeSql.Odbc.Default
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace FreeSql.Odbc.GBase
|
||||
@ -46,7 +47,8 @@ namespace FreeSql.Odbc.GBase
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace FreeSql.Odbc.GBase
|
||||
|
||||
{ typeof(byte).FullName, (OdbcType.SmallInt, "byte","byte NOT NULL", false, false, 0) },{ typeof(byte?).FullName, (OdbcType.SmallInt, "byte", "byte", false, true, null) },
|
||||
{ typeof(ushort).FullName, (OdbcType.Int, "integer","integer NOT NULL", false, false, 0) },{ typeof(ushort?).FullName, (OdbcType.Int, "integer", "integer", false, true, null) },
|
||||
{ typeof(uint).FullName, (OdbcType.BigInt, "int8","int8 NOT NULL", false, false, 0) },{ typeof(uint?).FullName, (OdbcType.BigInt, "int8", "int8", false, true, null) },
|
||||
{ typeof(uint).FullName, (OdbcType.BigInt, "bigint","bigint NOT NULL", false, false, 0) },{ typeof(uint?).FullName, (OdbcType.BigInt, "bigint", "bigint", false, true, null) },
|
||||
{ typeof(ulong).FullName, (OdbcType.Decimal, "decimal","decimal(20,0) NOT NULL", false, false, 0) },{ typeof(ulong?).FullName, (OdbcType.Decimal, "decimal", "decimal(20,0)", false, true, null) },
|
||||
|
||||
{ typeof(float).FullName, (OdbcType.Real, "smallfloat","smallfloat NOT NULL", false, false, 0) },{ typeof(float?).FullName, (OdbcType.Real, "smallfloat", "smallfloat", false, true, null) },
|
||||
|
@ -27,21 +27,21 @@ namespace FreeSql.Odbc.GBase
|
||||
switch (exp.Type.NullableTypeOrThis().ToString())
|
||||
{
|
||||
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||
case "System.Byte": return $"({getExp(operandExp)})::byte";
|
||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||
case "System.Int32": return $"({getExp(operandExp)})::int4";
|
||||
case "System.Int64": return $"({getExp(operandExp)})::int8";
|
||||
case "System.SByte": return $"({getExp(operandExp)})::int2";
|
||||
case "System.Single": return $"({getExp(operandExp)})::float4";
|
||||
case "System.String": return $"({getExp(operandExp)})::varchar";
|
||||
case "System.UInt16": return $"({getExp(operandExp)})::int2";
|
||||
case "System.UInt32": return $"({getExp(operandExp)})::int4";
|
||||
case "System.UInt64": return $"({getExp(operandExp)})::int8";
|
||||
case "System.Guid": return $"({getExp(operandExp)})::uuid";
|
||||
case "System.Decimal": return $"({getExp(operandExp)})::decimal";
|
||||
case "System.Double": return $"({getExp(operandExp)})::float";
|
||||
case "System.Int16": return $"({getExp(operandExp)})::smallint";
|
||||
case "System.Int32": return $"({getExp(operandExp)})::integer";
|
||||
case "System.Int64": return $"({getExp(operandExp)})::bigint";
|
||||
case "System.SByte": return $"({getExp(operandExp)})::smallint";
|
||||
case "System.Single": return $"({getExp(operandExp)})::smallfloat";
|
||||
case "System.String": return $"({getExp(operandExp)})::nvarchar";
|
||||
case "System.UInt16": return $"({getExp(operandExp)})::integer";
|
||||
case "System.UInt32": return $"({getExp(operandExp)})::bigint";
|
||||
case "System.UInt64": return $"({getExp(operandExp)})::decimal";
|
||||
case "System.Guid": return $"({getExp(operandExp)})::char";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -59,26 +59,26 @@ namespace FreeSql.Odbc.GBase
|
||||
switch (callExp.Method.DeclaringType.NullableTypeOrThis().ToString())
|
||||
{
|
||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::byte";
|
||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||
case "System.Int32": return $"({getExp(callExp.Arguments[0])})::int4";
|
||||
case "System.Int64": return $"({getExp(callExp.Arguments[0])})::int8";
|
||||
case "System.SByte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||
case "System.Single": return $"({getExp(callExp.Arguments[0])})::float4";
|
||||
case "System.UInt16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||
case "System.UInt32": return $"({getExp(callExp.Arguments[0])})::int4";
|
||||
case "System.UInt64": return $"({getExp(callExp.Arguments[0])})::int8";
|
||||
case "System.Guid": return $"({getExp(callExp.Arguments[0])})::uuid";
|
||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::decimal";
|
||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float";
|
||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::smallint";
|
||||
case "System.Int32": return $"({getExp(callExp.Arguments[0])})::integer";
|
||||
case "System.Int64": return $"({getExp(callExp.Arguments[0])})::bigint";
|
||||
case "System.SByte": return $"({getExp(callExp.Arguments[0])})::smallint";
|
||||
case "System.Single": return $"({getExp(callExp.Arguments[0])})::smallfloat";
|
||||
case "System.UInt16": return $"({getExp(callExp.Arguments[0])})::integer";
|
||||
case "System.UInt32": return $"({getExp(callExp.Arguments[0])})::bigint";
|
||||
case "System.UInt64": return $"({getExp(callExp.Arguments[0])})::decimal";
|
||||
case "System.Guid": return $"({getExp(callExp.Arguments[0])})::char";
|
||||
}
|
||||
break;
|
||||
case "NewGuid":
|
||||
return null;
|
||||
case "Next":
|
||||
if (callExp.Object?.Type == typeof(Random)) return "(random()*1000000000)::int4";
|
||||
if (callExp.Object?.Type == typeof(Random)) return "(random()*1000000000)::integer";
|
||||
return null;
|
||||
case "NextDouble":
|
||||
if (callExp.Object?.Type == typeof(Random)) return "random()";
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
@ -48,7 +49,8 @@ namespace FreeSql.Odbc.MySql
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
|
||||
@ -49,7 +50,8 @@ namespace FreeSql.Odbc.Oracle
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace FreeSql.Odbc.PostgreSQL
|
||||
@ -46,7 +47,8 @@ namespace FreeSql.Odbc.PostgreSQL
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FreeSql.Internal.CommonProvider;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace FreeSql.Odbc.SqlServer
|
||||
@ -54,7 +55,8 @@ namespace FreeSql.Odbc.SqlServer
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
|
||||
using FreeSql.Oracle.Curd;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
|
||||
@ -44,7 +45,8 @@ namespace FreeSql.Oracle
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -7,6 +7,7 @@ using NpgsqlTypes;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq.Expressions;
|
||||
using System.Net;
|
||||
@ -97,7 +98,8 @@ namespace FreeSql.PostgreSQL
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
|
||||
using FreeSql.SqlServer.Curd;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
|
||||
namespace FreeSql.SqlServer
|
||||
@ -55,7 +56,8 @@ namespace FreeSql.SqlServer
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
@ -3,6 +3,7 @@ using FreeSql.Internal.CommonProvider;
|
||||
using FreeSql.Sqlite.Curd;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Threading;
|
||||
|
||||
@ -43,7 +44,8 @@ namespace FreeSql.Sqlite
|
||||
internal CommonExpression InternalCommonExpression { get; }
|
||||
|
||||
public void Transaction(Action handler) => Ado.Transaction(handler);
|
||||
public void Transaction(Action handler, TimeSpan timeout) => Ado.Transaction(handler, timeout);
|
||||
public void Transaction(TimeSpan timeout, Action handler) => Ado.Transaction(timeout, handler);
|
||||
public void Transaction(IsolationLevel isolationLevel, TimeSpan timeout, Action handler) => Ado.Transaction(isolationLevel, timeout, handler);
|
||||
|
||||
public GlobalFilter GlobalFilter { get; } = new GlobalFilter();
|
||||
|
||||
|
Reference in New Issue
Block a user