Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendQueryParams broken in HEAD #18

Closed
daurnimator opened this issue Feb 17, 2015 · 7 comments
Closed

sendQueryParams broken in HEAD #18

daurnimator opened this issue Feb 17, 2015 · 7 comments

Comments

@daurnimator
Copy link
Contributor

local pg = require "pgsql"

local conn = pg.connectdb("dbname=test")
assert(conn:status() == pg.CONNECTION_OK, conn:errorMessage())

-- execParams works fine
local res = conn:execParams("SELECT $1, $2, $3", "foo", 123809878, 0987788789);
assert(res:status() == pg.PGRES_TUPLES_OK, res:errorMessage())

-- sendQueryParams is broken
if conn:sendQueryParams("SELECT $1, $2, $3", "foo", 123809878, 0987788789) == 0 then
    error(conn:errorMessage())
end
local res = conn:getResult()
-- Have to read until nil
assert(conn:getResult() == nil)
assert(res:status() == pg.PGRES_TUPLES_OK, res:errorMessage())
EXEC    SELECT $1, $2, $3       foo     123809878       987788789
lua5.1: failure.lua:5: ERROR:  could not determine data type of parameter $2

stack traceback:
        [C]: in function 'assert'
        failure.lua:5: in main chunk
        [C]: ?
@daurnimator daurnimator changed the title sendParams broken in HEAD sendQueryParams broken in HEAD Feb 17, 2015
@daurnimator
Copy link
Contributor Author

@mbalmer
Copy link
Collaborator

mbalmer commented Feb 18, 2015

Can you recheck now that I fixed a blocking issue?

@mbalmer
Copy link
Collaborator

mbalmer commented Feb 18, 2015

The NULL check is there in case calloc fauils (OOM)

@daurnimator
Copy link
Contributor Author

The NULL check is there in case calloc fauils (OOM)

Yes, I figured the lack of it in conn_execParams meant it was not required.
Actually it seems that it's missing in conn_execParams.

@daurnimator
Copy link
Contributor Author

In any case, d592d3f fixes the main issue reported here. Thanks @geoffleyland

@mbalmer
Copy link
Collaborator

mbalmer commented Feb 18, 2015

Am 18.02.15 um 17:40 schrieb daurnimator:

The NULL check is there in case calloc fauils (OOM)

Yes, I figured the lack of it in |conn_execParams| meant it was not
required.
Actually it seems that it's /missing/ in |conn_execParams|.


Reply to this email directly or view it on GitHub
#18 (comment).

fixed.

@daurnimator
Copy link
Contributor Author

fixed.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants