mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 扩展 内部方法 QuoteReadColumn
This commit is contained in:
parent
f7205b0414
commit
bbba06a343
@ -110,6 +110,13 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||||
|
<summary>
|
||||||
|
根据 lambda 条件删除数据
|
||||||
|
</summary>
|
||||||
|
<param name="predicate"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
|
@ -15,6 +15,7 @@ using System.Data.SqlClient;
|
|||||||
using kwlib;
|
using kwlib;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace FreeSql.Tests
|
namespace FreeSql.Tests
|
||||||
{
|
{
|
||||||
@ -95,6 +96,36 @@ namespace FreeSql.Tests
|
|||||||
fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I012", Qty = 1 }).ExecuteAffrows();
|
fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I012", Qty = 1 }).ExecuteAffrows();
|
||||||
fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I013", Qty = 1 }).ExecuteAffrows();
|
fsql.Insert<OrderDetail>(new OrderDetail { OrderNo = "1002", ItemNo = "I013", Qty = 1 }).ExecuteAffrows();
|
||||||
fsql.Ado.Query<object>("select * from orderdetail left join ordermain on orderdetail.orderno=ordermain.orderno where ordermain.orderno='1001'");
|
fsql.Ado.Query<object>("select * from orderdetail left join ordermain on orderdetail.orderno=ordermain.orderno where ordermain.orderno='1001'");
|
||||||
|
|
||||||
|
|
||||||
|
g.oracle.Insert(new[]
|
||||||
|
{
|
||||||
|
new SendInfo{ Code = "001", Binary = Encoding.UTF8.GetBytes("我是中国人") },
|
||||||
|
new SendInfo{ Code = "002", Binary = Encoding.UTF8.GetBytes("我是地球人") },
|
||||||
|
new SendInfo{ Code = "003", Binary = Encoding.UTF8.GetBytes("我是.net")},
|
||||||
|
new SendInfo{ Code = "004", Binary = Encoding.UTF8.GetBytes("我是freesql") },
|
||||||
|
})
|
||||||
|
.NoneParameter().ExecuteAffrows();
|
||||||
|
|
||||||
|
var slslsl = g.oracle.Select<SendInfo>().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Table(Name = "t_text")]
|
||||||
|
public class SendInfo
|
||||||
|
{
|
||||||
|
[Column(IsPrimary = true)]
|
||||||
|
public Guid ID { get; set; }
|
||||||
|
|
||||||
|
[Column(Name = "YPID5")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
public byte[] Binary { get; set; }
|
||||||
|
|
||||||
|
[Column(ServerTime = DateTimeKind.Utc)]
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
[Column(InsertValueSql = "'123'")]
|
||||||
|
public string InsertValue2 { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestByte
|
class TestByte
|
||||||
|
@ -96,7 +96,7 @@ namespace FreeSql.Internal
|
|||||||
CsType = map[idx].Column.CsType,
|
CsType = map[idx].Column.CsType,
|
||||||
MapType = map[idx].Column.Attribute.MapType
|
MapType = map[idx].Column.Attribute.MapType
|
||||||
};
|
};
|
||||||
field.Append(", ").Append(_common.QuoteReadColumn(child.MapType, child.DbField));
|
field.Append(", ").Append(_common.QuoteReadColumn(child.CsType, child.MapType, child.DbField));
|
||||||
if (index >= 0) field.Append(_common.FieldAsAlias($"as{++index}"));
|
if (index >= 0) field.Append(_common.FieldAsAlias($"as{++index}"));
|
||||||
parent.Childs.Add(child);
|
parent.Childs.Add(child);
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
if (tbiindex > 0 && colidx == 0) field.Append("\r\n");
|
if (tbiindex > 0 && colidx == 0) field.Append("\r\n");
|
||||||
}
|
}
|
||||||
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
||||||
field.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"{tbi.Alias}.{quoteName}"));
|
field.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"{tbi.Alias}.{quoteName}"));
|
||||||
++index;
|
++index;
|
||||||
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
||||||
else dicfield.Add(quoteName, true);
|
else dicfield.Add(quoteName, true);
|
||||||
@ -728,7 +728,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
{ //普通字段
|
{ //普通字段
|
||||||
if (index > 0) field.Append(", ");
|
if (index > 0) field.Append(", ");
|
||||||
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
||||||
field.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"{tb.Alias}.{quoteName}"));
|
field.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"{tb.Alias}.{quoteName}"));
|
||||||
++index;
|
++index;
|
||||||
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
||||||
else dicfield.Add(quoteName, true);
|
else dicfield.Add(quoteName, true);
|
||||||
@ -751,7 +751,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
{
|
{
|
||||||
if (index > 0) field.Append(", ");
|
if (index > 0) field.Append(", ");
|
||||||
var quoteName = _commonUtils.QuoteSqlName(col2.Attribute.Name);
|
var quoteName = _commonUtils.QuoteSqlName(col2.Attribute.Name);
|
||||||
field.Append(_commonUtils.QuoteReadColumn(col2.Attribute.MapType, $"{tb2.Alias}.{quoteName}"));
|
field.Append(_commonUtils.QuoteReadColumn(col2.CsType, col2.Attribute.MapType, $"{tb2.Alias}.{quoteName}"));
|
||||||
++index;
|
++index;
|
||||||
++otherindex;
|
++otherindex;
|
||||||
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
||||||
@ -849,7 +849,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
{ //普通字段
|
{ //普通字段
|
||||||
if (index > 0) field.Append(", ");
|
if (index > 0) field.Append(", ");
|
||||||
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
var quoteName = _commonUtils.QuoteSqlName(col.Attribute.Name);
|
||||||
field.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"{tb.Alias}.{quoteName}"));
|
field.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"{tb.Alias}.{quoteName}"));
|
||||||
++index;
|
++index;
|
||||||
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
||||||
else dicfield.Add(quoteName, true);
|
else dicfield.Add(quoteName, true);
|
||||||
@ -866,7 +866,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
{
|
{
|
||||||
if (index > 0) field.Append(", ");
|
if (index > 0) field.Append(", ");
|
||||||
var quoteName = _commonUtils.QuoteSqlName(col2.Attribute.Name);
|
var quoteName = _commonUtils.QuoteSqlName(col2.Attribute.Name);
|
||||||
field.Append(_commonUtils.QuoteReadColumn(col2.Attribute.MapType, $"{tb2.Alias}.{quoteName}"));
|
field.Append(_commonUtils.QuoteReadColumn(col2.CsType, col2.Attribute.MapType, $"{tb2.Alias}.{quoteName}"));
|
||||||
++index;
|
++index;
|
||||||
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
if (dicfield.ContainsKey(quoteName)) field.Append(_commonUtils.FieldAsAlias($"as{index}"));
|
||||||
else dicfield.Add(quoteName, true);
|
else dicfield.Add(quoteName, true);
|
||||||
|
@ -910,7 +910,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
Property = tbrefMid.Properties[col.CsName]
|
Property = tbrefMid.Properties[col.CsName]
|
||||||
};
|
};
|
||||||
read.Childs.Add(child);
|
read.Childs.Add(child);
|
||||||
field.Append(", ").Append(_commonUtils.QuoteReadColumn(child.MapType, child.DbField));
|
field.Append(", ").Append(_commonUtils.QuoteReadColumn(child.CsType, child.MapType, child.DbField));
|
||||||
}
|
}
|
||||||
otherData = (field.ToString(), read);
|
otherData = (field.ToString(), read);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ namespace FreeSql.Internal
|
|||||||
public abstract string Now { get; }
|
public abstract string Now { get; }
|
||||||
public abstract string NowUtc { get; }
|
public abstract string NowUtc { get; }
|
||||||
public abstract string QuoteWriteParamter(Type type, string paramterName);
|
public abstract string QuoteWriteParamter(Type type, string paramterName);
|
||||||
public abstract string QuoteReadColumn(Type type, string columnName);
|
public abstract string QuoteReadColumn(Type type, Type mapType, string columnName);
|
||||||
public virtual string FieldAsAlias(string alias) => $" {alias}";
|
public virtual string FieldAsAlias(string alias) => $" {alias}";
|
||||||
public virtual string IIF(string test, string ifTrue, string ifElse) => $"case when {test} then {ifTrue} else {ifElse} end";
|
public virtual string IIF(string test, string ifTrue, string ifElse) => $"case when {test} then {ifTrue} else {ifElse} end";
|
||||||
|
|
||||||
|
@ -17,92 +17,14 @@ namespace FreeSql.MsAccess.Curd
|
|||||||
|
|
||||||
public override List<T1> ExecuteDeleted()
|
public override List<T1> ExecuteDeleted()
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
throw new NotImplementedException();
|
||||||
if (string.IsNullOrEmpty(sql)) return new List<T1>();
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append(" OUTPUT ");
|
|
||||||
var colidx = 0;
|
|
||||||
foreach (var col in _table.Columns.Values)
|
|
||||||
{
|
|
||||||
if (colidx > 0) sb.Append(", ");
|
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
|
||||||
++colidx;
|
|
||||||
}
|
|
||||||
|
|
||||||
var validx = sql.IndexOf(" WHERE ");
|
|
||||||
if (validx == -1) throw new ArgumentException("找不到 WHERE ");
|
|
||||||
sb.Insert(0, sql.Substring(0, validx));
|
|
||||||
sb.Append(sql.Substring(validx));
|
|
||||||
|
|
||||||
sql = sb.ToString();
|
|
||||||
var dbParms = _params.ToArray();
|
|
||||||
var before = new Aop.CurdBeforeEventArgs(_table.Type, _table, Aop.CurdType.Delete, sql, dbParms);
|
|
||||||
_orm.Aop.CurdBefore?.Invoke(this, before);
|
|
||||||
var ret = new List<T1>();
|
|
||||||
Exception exception = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ret = _orm.Ado.Query<T1>(_connection, _transaction, CommandType.Text, sql, dbParms);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
exception = ex;
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
var after = new Aop.CurdAfterEventArgs(before, exception, ret);
|
|
||||||
_orm.Aop.CurdAfter?.Invoke(this, after);
|
|
||||||
}
|
|
||||||
this.ClearData();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
#else
|
#else
|
||||||
async public override Task<List<T1>> ExecuteDeletedAsync()
|
async public override Task<List<T1>> ExecuteDeletedAsync()
|
||||||
{
|
{
|
||||||
var sql = this.ToSql();
|
throw new NotImplementedException();
|
||||||
if (string.IsNullOrEmpty(sql)) return new List<T1>();
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
sb.Append(" OUTPUT ");
|
|
||||||
var colidx = 0;
|
|
||||||
foreach (var col in _table.Columns.Values)
|
|
||||||
{
|
|
||||||
if (colidx > 0) sb.Append(", ");
|
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
|
||||||
++colidx;
|
|
||||||
}
|
|
||||||
|
|
||||||
var validx = sql.IndexOf(" WHERE ");
|
|
||||||
if (validx == -1) throw new ArgumentException("找不到 WHERE ");
|
|
||||||
sb.Insert(0, sql.Substring(0, validx));
|
|
||||||
sb.Append(sql.Substring(validx));
|
|
||||||
|
|
||||||
sql = sb.ToString();
|
|
||||||
var dbParms = _params.ToArray();
|
|
||||||
var before = new Aop.CurdBeforeEventArgs(_table.Type, _table, Aop.CurdType.Delete, sql, dbParms);
|
|
||||||
_orm.Aop.CurdBefore?.Invoke(this, before);
|
|
||||||
var ret = new List<T1>();
|
|
||||||
Exception exception = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ret = await _orm.Ado.QueryAsync<T1>(_connection, _transaction, CommandType.Text, sql, dbParms);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
exception = ex;
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
var after = new Aop.CurdAfterEventArgs(before, exception, ret);
|
|
||||||
_orm.Aop.CurdAfter?.Invoke(this, after);
|
|
||||||
}
|
|
||||||
this.ClearData();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ namespace FreeSql.MsAccess.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -43,7 +44,7 @@ namespace FreeSql.MsAccess.Curd
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append(MsAccessUtils.GetCastSql(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)), typeof(string)));
|
caseWhen.Append(MsAccessUtils.GetCastSql(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)), typeof(string)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -73,7 +73,7 @@ namespace FreeSql.MsAccess
|
|||||||
public override string NowUtc => "now()";
|
public override string NowUtc => "now()";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
public override string FieldAsAlias(string alias) => $" as {alias}";
|
public override string FieldAsAlias(string alias) => $" as {alias}";
|
||||||
public override string IIF(string test, string ifTrue, string ifElse) => $"iif({test}, {ifTrue}, {ifElse})";
|
public override string IIF(string test, string ifTrue, string ifElse) => $"iif({test}, {ifTrue}, {ifElse})";
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -68,7 +68,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -79,7 +79,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -148,7 +148,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -40,7 +40,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -71,7 +71,8 @@ namespace FreeSql.MySql.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("CONCAT(");
|
caseWhen.Append("CONCAT(");
|
||||||
@ -79,7 +80,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -120,7 +121,7 @@ namespace FreeSql.MySql.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -104,9 +104,9 @@ namespace FreeSql.MySql
|
|||||||
}
|
}
|
||||||
return paramterName;
|
return paramterName;
|
||||||
}
|
}
|
||||||
public override string QuoteReadColumn(Type type, string columnName)
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName)
|
||||||
{
|
{
|
||||||
switch (type.FullName)
|
switch (mapType.FullName)
|
||||||
{
|
{
|
||||||
case "MygisPoint":
|
case "MygisPoint":
|
||||||
case "MygisLineString":
|
case "MygisLineString":
|
||||||
|
@ -112,9 +112,9 @@ namespace FreeSql.MySql
|
|||||||
}
|
}
|
||||||
return paramterName;
|
return paramterName;
|
||||||
}
|
}
|
||||||
public override string QuoteReadColumn(Type type, string columnName)
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName)
|
||||||
{
|
{
|
||||||
switch (type.FullName)
|
switch (mapType.FullName)
|
||||||
{
|
{
|
||||||
case "MygisPoint":
|
case "MygisPoint":
|
||||||
case "MygisLineString":
|
case "MygisLineString":
|
||||||
|
@ -31,7 +31,8 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -39,7 +40,7 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -91,7 +91,7 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
public override string NowUtc => "getutcdate";
|
public override string NowUtc => "getutcdate";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,8 @@ namespace FreeSql.Odbc.Default
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -36,7 +37,7 @@ namespace FreeSql.Odbc.Default
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append(_utils.Adapter.CastSql(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)), _utils.Adapter.MappingOdbcTypeVarChar));
|
caseWhen.Append(_utils.Adapter.CastSql(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)), _utils.Adapter.MappingOdbcTypeVarChar));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -64,7 +64,7 @@ namespace FreeSql.Odbc.Default
|
|||||||
public override string NowUtc => Adapter.LambdaDateTime_UtcNow;
|
public override string NowUtc => Adapter.LambdaDateTime_UtcNow;
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => Adapter.FieldSql(type, columnName);
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => Adapter.FieldSql(type, columnName);
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,8 @@ namespace FreeSql.Odbc.GBase
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -38,7 +39,7 @@ namespace FreeSql.Odbc.GBase
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -117,7 +117,7 @@ namespace FreeSql.Odbc.GBase
|
|||||||
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -68,7 +68,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -71,7 +71,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -151,7 +151,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -34,7 +34,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -65,7 +65,8 @@ namespace FreeSql.Odbc.MySql
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("CONCAT(");
|
caseWhen.Append("CONCAT(");
|
||||||
@ -73,7 +74,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -114,7 +115,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -75,9 +75,9 @@ namespace FreeSql.Odbc.MySql
|
|||||||
}
|
}
|
||||||
return paramterName;
|
return paramterName;
|
||||||
}
|
}
|
||||||
public override string QuoteReadColumn(Type type, string columnName)
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName)
|
||||||
{
|
{
|
||||||
switch (type.FullName)
|
switch (mapType.FullName)
|
||||||
{
|
{
|
||||||
case "MygisPoint":
|
case "MygisPoint":
|
||||||
case "MygisLineString":
|
case "MygisLineString":
|
||||||
|
@ -31,7 +31,8 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -39,7 +40,7 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -91,7 +91,7 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
public override string NowUtc => "sys_extract_utc(systimestamp)";
|
public override string NowUtc => "sys_extract_utc(systimestamp)";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -68,7 +68,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -82,7 +82,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -174,7 +174,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -33,7 +33,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -64,7 +64,8 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -72,7 +73,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -122,7 +123,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -117,7 +117,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"DELETED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"DELETED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,8 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -77,7 +78,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append("cast(").Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append(" as varchar)");
|
caseWhen.Append("cast(").Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append(" as varchar)");
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -115,7 +116,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
public override string NowUtc => "getutcdate()";
|
public override string NowUtc => "getutcdate()";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,8 @@ namespace FreeSql.Oracle.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -39,7 +40,7 @@ namespace FreeSql.Oracle.Curd
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -86,7 +86,7 @@ namespace FreeSql.Oracle
|
|||||||
public override string NowUtc => "sys_extract_utc(systimestamp)";
|
public override string NowUtc => "sys_extract_utc(systimestamp)";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -68,7 +68,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -95,7 +95,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -187,7 +187,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -41,7 +41,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
@ -72,8 +72,9 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
|
var pk = _table.Primarys.First();
|
||||||
if (string.IsNullOrEmpty(InternalTableAlias) == false) caseWhen.Append(InternalTableAlias).Append(".");
|
if (string.IsNullOrEmpty(InternalTableAlias) == false) caseWhen.Append(InternalTableAlias).Append(".");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -82,7 +83,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(" || ");
|
if (pkidx > 0) caseWhen.Append(" || ");
|
||||||
if (string.IsNullOrEmpty(InternalTableAlias) == false) caseWhen.Append(InternalTableAlias).Append(".");
|
if (string.IsNullOrEmpty(InternalTableAlias) == false) caseWhen.Append(InternalTableAlias).Append(".");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append("::varchar");
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -132,7 +133,7 @@ namespace FreeSql.PostgreSQL.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
sql = sb.ToString();
|
sql = sb.ToString();
|
||||||
|
@ -143,7 +143,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
public override string NowUtc => "(current_timestamp at time zone 'UTC')";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
static ConcurrentDictionary<Type, bool> _dicIsAssignableFromPostgisGeometry = new ConcurrentDictionary<Type, bool>();
|
static ConcurrentDictionary<Type, bool> _dicIsAssignableFromPostgisGeometry = new ConcurrentDictionary<Type, bool>();
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
|
@ -26,7 +26,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"DELETED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append("DELETED.").Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, _commonUtils.QuoteSqlName(col.Attribute.Name))).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"DELETED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,8 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("(");
|
caseWhen.Append("(");
|
||||||
@ -78,7 +79,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append("cast(").Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append(" as varchar)");
|
caseWhen.Append("cast(").Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name))).Append(" as varchar)");
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
@ -116,7 +117,7 @@ namespace FreeSql.SqlServer.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (colidx > 0) sb.Append(", ");
|
if (colidx > 0) sb.Append(", ");
|
||||||
sb.Append(_commonUtils.QuoteReadColumn(col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
sb.Append(_commonUtils.QuoteReadColumn(col.CsType, col.Attribute.MapType, $"INSERTED.{_commonUtils.QuoteSqlName(col.Attribute.Name)}")).Append(" as ").Append(_commonUtils.QuoteSqlName(col.CsName));
|
||||||
++colidx;
|
++colidx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ namespace FreeSql.SqlServer
|
|||||||
public override string NowUtc => "getutcdate()";
|
public override string NowUtc => "getutcdate()";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,8 @@ namespace FreeSql.Sqlite.Curd
|
|||||||
{
|
{
|
||||||
if (_table.Primarys.Length == 1)
|
if (_table.Primarys.Length == 1)
|
||||||
{
|
{
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(_table.Primarys.First().Attribute.MapType, _commonUtils.QuoteSqlName(_table.Primarys.First().Attribute.Name)));
|
var pk = _table.Primarys.First();
|
||||||
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
caseWhen.Append("CONCAT(");
|
caseWhen.Append("CONCAT(");
|
||||||
@ -39,7 +40,7 @@ namespace FreeSql.Sqlite.Curd
|
|||||||
foreach (var pk in _table.Primarys)
|
foreach (var pk in _table.Primarys)
|
||||||
{
|
{
|
||||||
if (pkidx > 0) caseWhen.Append(", ");
|
if (pkidx > 0) caseWhen.Append(", ");
|
||||||
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
caseWhen.Append(_commonUtils.QuoteReadColumn(pk.CsType, pk.Attribute.MapType, _commonUtils.QuoteSqlName(pk.Attribute.Name)));
|
||||||
++pkidx;
|
++pkidx;
|
||||||
}
|
}
|
||||||
caseWhen.Append(")");
|
caseWhen.Append(")");
|
||||||
|
@ -89,7 +89,7 @@ namespace FreeSql.Sqlite
|
|||||||
public override string NowUtc => "current_timestamp";
|
public override string NowUtc => "current_timestamp";
|
||||||
|
|
||||||
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
public override string QuoteWriteParamter(Type type, string paramterName) => paramterName;
|
||||||
public override string QuoteReadColumn(Type type, string columnName) => columnName;
|
public override string QuoteReadColumn(Type type, Type mapType, string columnName) => columnName;
|
||||||
|
|
||||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user