|
|
@ -304,18 +304,6 @@ func GetRow(dbName, table_name, alias string, titles string, with, join [][]stri |
|
|
|
} |
|
|
|
|
|
|
|
table := "" |
|
|
|
if strings.Contains(table_name, "select ") || strings.HasPrefix(table, "(") { |
|
|
|
table = table_name |
|
|
|
} else { |
|
|
|
table = getTableName(dbName, table_name) |
|
|
|
} |
|
|
|
var sql_str, title string |
|
|
|
|
|
|
|
if titles != "" { |
|
|
|
title = titles |
|
|
|
} else { |
|
|
|
title = "*" |
|
|
|
} |
|
|
|
withSql := "" |
|
|
|
if len(with) > 0 { |
|
|
|
var builder strings.Builder |
|
|
@ -339,6 +327,19 @@ func GetRow(dbName, table_name, alias string, titles string, with, join [][]stri |
|
|
|
withSql = builder.String() |
|
|
|
} |
|
|
|
} |
|
|
|
if withSql != "" || strings.Contains(table_name, "select ") || strings.HasPrefix(table, "(") { |
|
|
|
table = table_name |
|
|
|
} else { |
|
|
|
table = getTableName(dbName, table_name) |
|
|
|
} |
|
|
|
var sql_str, title string |
|
|
|
|
|
|
|
if titles != "" { |
|
|
|
title = titles |
|
|
|
} else { |
|
|
|
title = "*" |
|
|
|
} |
|
|
|
|
|
|
|
if DB_PROVIDER == "TencentDB" { |
|
|
|
sql_str = helper.StringJoin("/*slave*/ ", withSql, " select ", title) |
|
|
|
} else { |
|
|
@ -364,7 +365,7 @@ func GetRow(dbName, table_name, alias string, titles string, with, join [][]stri |
|
|
|
builder.WriteString("left") |
|
|
|
} |
|
|
|
builder.WriteString(" join ") |
|
|
|
if strings.Contains(joinitem[0], "select ") || strings.HasPrefix(joinitem[0], "(") || len(joinitem) > 4 { |
|
|
|
if withSql != "" || strings.Contains(joinitem[0], "select ") || strings.HasPrefix(joinitem[0], "(") || len(joinitem) > 4 { |
|
|
|
builder.WriteString(joinitem[0]) |
|
|
|
} else { |
|
|
|
builder.WriteString(getTableName(dbName, joinitem[0])) |
|
|
@ -492,19 +493,6 @@ func FetchRows(dbName, table_name, alias string, titles string, with, join [][]s |
|
|
|
return count, list, errors.New("没有数据表") |
|
|
|
} |
|
|
|
table := "" |
|
|
|
if strings.Contains(table_name, "select ") || strings.HasPrefix(table, "(") { |
|
|
|
table = table_name |
|
|
|
} else { |
|
|
|
table = getTableName(dbName, table_name) |
|
|
|
} |
|
|
|
|
|
|
|
var sql_str, title string |
|
|
|
|
|
|
|
if titles != "" { |
|
|
|
title = titles |
|
|
|
} else { |
|
|
|
title = "*" |
|
|
|
} |
|
|
|
withSql := "" |
|
|
|
if len(with) > 0 { |
|
|
|
var builder strings.Builder |
|
|
@ -528,6 +516,20 @@ func FetchRows(dbName, table_name, alias string, titles string, with, join [][]s |
|
|
|
withSql = builder.String() |
|
|
|
} |
|
|
|
} |
|
|
|
if withSql != "" || strings.Contains(table_name, "select ") || strings.HasPrefix(table, "(") { |
|
|
|
table = table_name |
|
|
|
} else { |
|
|
|
table = getTableName(dbName, table_name) |
|
|
|
} |
|
|
|
|
|
|
|
var sql_str, title string |
|
|
|
|
|
|
|
if titles != "" { |
|
|
|
title = titles |
|
|
|
} else { |
|
|
|
title = "*" |
|
|
|
} |
|
|
|
|
|
|
|
if DB_PROVIDER == "TencentDB" { |
|
|
|
sql_str = helper.StringJoin("/*slave*/ ", withSql, " select ", title) |
|
|
|
} else { |
|
|
@ -553,7 +555,7 @@ func FetchRows(dbName, table_name, alias string, titles string, with, join [][]s |
|
|
|
builder.WriteString("left") |
|
|
|
} |
|
|
|
builder.WriteString(" join ") |
|
|
|
if strings.Contains(joinitem[0], "select ") || strings.HasPrefix(joinitem[0], "(") || len(joinitem) > 4 { |
|
|
|
if withSql != "" || strings.Contains(joinitem[0], "select ") || strings.HasPrefix(joinitem[0], "(") || len(joinitem) >= 4 { |
|
|
|
builder.WriteString(joinitem[0]) |
|
|
|
} else { |
|
|
|
builder.WriteString(getTableName(dbName, joinitem[0])) |
|
|
|