add column escaper function
This commit is contained in:
parent
6754905f24
commit
5eb3701f9f
2 changed files with 3 additions and 3 deletions
|
|
@ -21,10 +21,10 @@ func EscapeColumn(dbType, col string) string {
|
|||
|
||||
func GetNamedParameter(dbType, col string, number int) string {
|
||||
if dbType == "mysql" {
|
||||
return fmt.Sprintf("%s=?", EscapeColumn(col))
|
||||
return fmt.Sprintf("%s=?", EscapeColumn(dbType, col))
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s=$%d", EscapeColumn(col), number)
|
||||
return fmt.Sprintf("%s=$%d", EscapeColumn(dbType, col), number)
|
||||
}
|
||||
|
||||
func IsPgNumberType(value string) bool {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ func TestEscapeColumn(t *testing.T) {
|
|||
t.Fatalf("TestEscapeColumn: mysql check failed")
|
||||
}
|
||||
|
||||
if EscapeTable("postgres", "foo") != "\"foo\"" {
|
||||
if EscapeColumn("postgres", "foo") != "\"foo\"" {
|
||||
t.Fatalf("TestEscapeColumn: postgres check failed")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue