2
0

Add support for integer, float and text arrays

Restructure internals a bit so pgx/stdlib can turn off binary encoding and
receive text back for array types.
This commit is contained in:
Jack Christensen
2014-07-26 15:03:52 -05:00
parent b06d71f684
commit e29574d447
8 changed files with 864 additions and 44 deletions
+22
View File
@@ -336,6 +336,28 @@ func TestConnQueryFailure(t *testing.T) {
ensureConnValid(t, db)
}
// Test type that pgx would handle natively in binary, but since it is not a
// database/sql native type should be passed through as a string
func TestConnQueryRowPgxBinary(t *testing.T) {
db := openDB(t)
defer closeDB(t, db)
sql := "select $1::int4[]"
expected := "{1,2,3}"
var actual string
err := db.QueryRow(sql, expected).Scan(&actual)
if err != nil {
t.Errorf("Unexpected failure: %v (sql -> %v)", err, sql)
}
if actual != expected {
t.Errorf(`Expected "%v", got "%v" (sql -> %v)`, expected, actual, sql)
}
ensureConnValid(t, db)
}
func TestConnQueryRowUnknownType(t *testing.T) {
db := openDB(t)
defer closeDB(t, db)