- 修复 浮点类型 NoneParameter 不使用科学字符串表示;

This commit is contained in:
28810
2020-04-30 12:06:19 +08:00
parent f39a4cb778
commit 0ffea2b871
16 changed files with 34 additions and 9 deletions

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
namespace FreeSql.Odbc.Dameng
{
@ -101,6 +102,7 @@ namespace FreeSql.Odbc.Dameng
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
if (type == typeof(byte[])) return $"hextoraw('{CommonUtils.BytesSqlRaw(value as byte[])}')";
return FormatSql("{0}", value, 1);
}

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
namespace FreeSql.Odbc.Default
{
@ -71,6 +72,7 @@ namespace FreeSql.Odbc.Default
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
if (type == typeof(byte[])) return Adapter.ByteRawSql(value);
return FormatSql("{0}", value, 1);
}

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
namespace FreeSql.Odbc.MySql
{
@ -95,6 +96,7 @@ namespace FreeSql.Odbc.MySql
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
{

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
namespace FreeSql.Odbc.Oracle
{
@ -101,6 +102,7 @@ namespace FreeSql.Odbc.Oracle
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
if (type == typeof(byte[])) return $"hextoraw('{CommonUtils.BytesSqlRaw(value as byte[])}')";
return FormatSql("{0}", value, 1);
}

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
using System.Linq;
using System.Text;
@ -124,6 +125,7 @@ namespace FreeSql.Odbc.PostgreSQL
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
value = getParamterValue(type, value);
var type2 = value.GetType();
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.Odbc;
using System.Globalization;
using System.Text;
namespace FreeSql.Odbc.SqlServer
@ -87,6 +88,7 @@ namespace FreeSql.Odbc.SqlServer
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
{
if (value == null) return "NULL";
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
{