3 ms·
How about having two statements for running queries, Exec, and Query, but unlike other database engines where you might expect to be able to execute a PQ query
by shadowmint 13y ago
How about having two statements for running queries, Exec, and Query, but unlike other database engines where you might expect to be able to execute a PQ query that returns values like:
INSERT INTO PERSON (NAME) VALUES ('JACK') RETURNING ID_PERSON, CREATION_TIME
...no, actually, you cannot perform a query for an INSERT statement, even if it returns values.
This isn't a database driver issue even, apparently. It's just the way the database API was defined. Query is not for inserts.
Or the fact that if you run a query (eg. CREATE TABLE blah...) you get a result set that you have to call Next() on to flush the query to the database, even if you close the connection.
...because obviously, running next on a create statement is what you would do.
Or how you have to import a singleton to load the database driver you want.
import (
_ "github.com/lib/pq"
"database/sql" <----- Previous import has side effects.
)
How is that idiomatic go? -__- It's totally a hack.
It's nothing major, but the database/sql library api just doesn't feel right.
It's messy.