Fixed issue 3513: wrong setupQuery realization
This commit is contained in:
parent
ae60f4ae76
commit
c017904363
2 changed files with 5 additions and 7 deletions
|
|
@ -167,11 +167,7 @@ proc newRow(L: int): Row =
|
||||||
|
|
||||||
proc setupQuery(db: DbConn, query: SqlQuery,
|
proc setupQuery(db: DbConn, query: SqlQuery,
|
||||||
args: varargs[string]): PPGresult =
|
args: varargs[string]): PPGresult =
|
||||||
# s is a dummy unique id str for each setupQuery query
|
result = pqexec(db, dbFormat(query, args))
|
||||||
let s = "setupQuery_Query_" & string(query)
|
|
||||||
var res = pqprepare(db, s, dbFormat(query, args), 0, nil)
|
|
||||||
result = pqexecPrepared(db, s, 0, nil,
|
|
||||||
nil, nil, 0)
|
|
||||||
if pqResultStatus(result) != PGRES_TUPLES_OK: dbError(db)
|
if pqResultStatus(result) != PGRES_TUPLES_OK: dbError(db)
|
||||||
|
|
||||||
proc setupQuery(db: DbConn, stmtName: SqlPrepared,
|
proc setupQuery(db: DbConn, stmtName: SqlPrepared,
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,7 @@ let name = "Dom"
|
||||||
db.exec(sql"INSERT INTO myTable (id, name) VALUES (0, ?)",
|
db.exec(sql"INSERT INTO myTable (id, name) VALUES (0, ?)",
|
||||||
name)
|
name)
|
||||||
doAssert db.getValue(sql"SELECT name FROM myTable") == name
|
doAssert db.getValue(sql"SELECT name FROM myTable") == name
|
||||||
|
# Check issue #3513
|
||||||
|
doAssert db.getValue(sql"SELECT name FROM myTable") == name
|
||||||
|
|
||||||
db.close()
|
db.close()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue