mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
修复 pgsql Enum 类型 formatSql bug
This commit is contained in:
parent
37aa5c613c
commit
ed1a68a927
@ -148,7 +148,8 @@ namespace FreeSql.Tests {
|
|||||||
var list111 = select.From<TestTypeInfo, TestTypeParentInfo>((s, b, c) => s
|
var list111 = select.From<TestTypeInfo, TestTypeParentInfo>((s, b, c) => s
|
||||||
.InnerJoin(a => a.TypeGuid == b.Guid)
|
.InnerJoin(a => a.TypeGuid == b.Guid)
|
||||||
.LeftJoin(a => c.Id == b.ParentId)
|
.LeftJoin(a => c.Id == b.ParentId)
|
||||||
.Where(a => b.Name != "xxx")).ToList((a, b, c) => new {
|
.Where(a => b.Name != "xxx"))
|
||||||
|
.ToList((a, b, c) => new {
|
||||||
a.Id,
|
a.Id,
|
||||||
a.Title,
|
a.Title,
|
||||||
a.Type,
|
a.Type,
|
||||||
|
@ -385,7 +385,7 @@ namespace FreeSql.Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLazy) {
|
if (isLazy) {
|
||||||
cscode.Append(" private bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
cscode.Append(" public bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
||||||
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
||||||
if (vp.Item2) { //get 重写
|
if (vp.Item2) { //get 重写
|
||||||
cscode.Append(" get {\r\n")
|
cscode.Append(" get {\r\n")
|
||||||
@ -460,7 +460,7 @@ namespace FreeSql.Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLazy) {
|
if (isLazy) {
|
||||||
cscode.Append(" private bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
cscode.Append(" public bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
||||||
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
||||||
if (vp.Item2) { //get 重写
|
if (vp.Item2) { //get 重写
|
||||||
cscode.Append(" get {\r\n")
|
cscode.Append(" get {\r\n")
|
||||||
@ -550,7 +550,7 @@ namespace FreeSql.Internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLazy) {
|
if (isLazy) {
|
||||||
cscode.Append(" private bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
cscode.Append(" public bool __lazy__").Append(pnv.Name).AppendLine(" = false;")
|
||||||
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
.Append(" public override ").Append(propTypeName).Append(" ").Append(pnv.Name).AppendLine(" {");
|
||||||
if (vp.Item2) { //get 重写
|
if (vp.Item2) { //get 重写
|
||||||
cscode.Append(" get {\r\n")
|
cscode.Append(" get {\r\n")
|
||||||
|
@ -30,8 +30,10 @@ namespace FreeSql.PostgreSQL {
|
|||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
return (bool)param ? "'t'" : "'f'";
|
return (bool)param ? "'t'" : "'f'";
|
||||||
else if (param is string || param is char || param is Enum)
|
else if (param is string || param is char)
|
||||||
return string.Concat("'", param.ToString().Replace("'", "''"), "'");
|
return string.Concat("'", param.ToString().Replace("'", "''"), "'");
|
||||||
|
else if (param is Enum)
|
||||||
|
return ((Enum)param).ToInt64();
|
||||||
else if (decimal.TryParse(string.Concat(param), out var trydec))
|
else if (decimal.TryParse(string.Concat(param), out var trydec))
|
||||||
return param;
|
return param;
|
||||||
else if (param is DateTime || param is DateTime?)
|
else if (param is DateTime || param is DateTime?)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user