good morning!!!!

Skip to content
Snippets Groups Projects
Commit 86beb3b0 authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Fixing case for information_schema.tables.

parent d80c6e00
Branches
Tags
No related merge requests found
...@@ -73,6 +73,23 @@ func TestSelectCount(t *testing.T) { ...@@ -73,6 +73,23 @@ func TestSelectCount(t *testing.T) {
} }
} }
func TestSelectCountRelation(t *testing.T) {
var s, e string
var stmt Statement
stmt = Statement{
Type: SqlSelectCount,
Table: Table{"information_schema.tables"},
}
s = trim(stmt.Compile())
e = `SELECT COUNT(1) AS _t FROM "information_schema"."tables"`
if s != e {
t.Fatalf("Got: %s, Expecting: %s", s, e)
}
}
func TestSelectCountWhere(t *testing.T) { func TestSelectCountWhere(t *testing.T) {
var s, e string var s, e string
var stmt Statement var stmt Statement
......
package sqlgen package sqlgen
import ( import (
"fmt" "strings"
) )
type Table struct { type Table struct {
...@@ -9,5 +9,11 @@ type Table struct { ...@@ -9,5 +9,11 @@ type Table struct {
} }
func (self Table) String() string { func (self Table) String() string {
return mustParse(Layout.IdentifierQuote, Raw{fmt.Sprintf(`%v`, self.Value)}) chunks := strings.Split(self.Value, Layout.ColumnSeparator)
for i := range chunks {
chunks[i] = mustParse(Layout.IdentifierQuote, Raw{chunks[i]})
}
return strings.Join(chunks, Layout.ColumnSeparator)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment