Browse Source

修复join无法使用with临时表问题

master
zhenghaorong 2 months ago
parent
commit
2d94f24f43
3 changed files with 8 additions and 0 deletions
  1. +2
    -0
      chain.go
  2. +4
    -0
      db.go
  3. +2
    -0
      transaction_chain.go

+ 2
- 0
chain.go View File

@ -291,6 +291,7 @@ func (this *Query) BuildSelectSql() (map[string]interface{}, error) {
withSql := ""
if len(this.with) > 0 {
var builder strings.Builder
builder.Reset()
builder.WriteString("WITH ")
boo := false
for k, v := range this.with {
@ -351,6 +352,7 @@ func (this *Query) BuildSelectSql() (map[string]interface{}, error) {
if len(this.join) > 0 {
var builder strings.Builder
builder.Reset()
for _, joinitem := range this.join {
if len(joinitem) < 2 {
continue


+ 4
- 0
db.go View File

@ -307,6 +307,7 @@ func GetRow(dbName, table_name, alias string, titles string, with, join [][]stri
withSql := ""
if len(with) > 0 {
var builder strings.Builder
builder.Reset()
builder.WriteString("WITH ")
boo := false
for k, v := range with {
@ -353,6 +354,7 @@ func GetRow(dbName, table_name, alias string, titles string, with, join [][]stri
if len(join) > 0 {
var builder strings.Builder
builder.Reset()
for _, joinitem := range join {
if len(joinitem) < 2 {
continue
@ -496,6 +498,7 @@ func FetchRows(dbName, table_name, alias string, titles string, with, join [][]s
withSql := ""
if len(with) > 0 {
var builder strings.Builder
builder.Reset()
builder.WriteString("WITH ")
boo := false
for k, v := range with {
@ -543,6 +546,7 @@ func FetchRows(dbName, table_name, alias string, titles string, with, join [][]s
if len(join) > 0 {
var builder strings.Builder
builder.Reset()
for _, joinitem := range join {
if len(joinitem) < 2 {
continue


+ 2
- 0
transaction_chain.go View File

@ -225,6 +225,7 @@ func (this *TxQuery) BuildSelectSql() (map[string]interface{}, error) {
withSql := ""
if len(this.with) > 0 {
var builder strings.Builder
builder.Reset()
builder.WriteString("WITH ")
boo := false
for k, v := range this.with {
@ -269,6 +270,7 @@ func (this *TxQuery) BuildSelectSql() (map[string]interface{}, error) {
if len(this.join) > 0 {
var builder strings.Builder
builder.Reset()
for _, joinitem := range this.join {
if len(joinitem) < 2 {
continue


Loading…
Cancel
Save