postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: JacoboSanchez (@JacoboSanchez) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] issue #82: Is this expected a bind to BIGINT to be surrounded by quotes?
Date: Fri, 13 Dec 2024 18:47:11 +0000
Message-ID: <[email protected]> (raw)
I was testing the folowing:
* Prepare a statement with a parameter
```
odbct32w 7d60-31c0 ENTER SQLPrepareW
HSTMT 0x00000000020DAFA0
WCHAR * 0x000000000053C320 [ 50] "select * from public.testview where longfield < ?"
SDWORD 50
odbct32w 7d60-31c0 EXIT SQLPrepareW with return code 0 (SQL_SUCCESS)
HSTMT 0x00000000020DAFA0
WCHAR * 0x000000000053C320 [ 50] "select * from public.testview where longfield < ?"
SDWORD 50
```
* Bind the parameter to BIGINT:
```
odbct32w 7d60-31c0 ENTER SQLBindParameter
HSTMT 0x00000000020DAFA0
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD 99 <SQL_C_DEFAULT>
SWORD -5 <SQL_BIGINT>
SQLULEN 0
SWORD 0
PTR 0x0000000001F30000
SQLLEN 0
SQLLEN * 0x0000000002DD0000
odbct32w 7d60-31c0 EXIT SQLBindParameter with return code 0 (SQL_SUCCESS)
HSTMT 0x00000000020DAFA0
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD 99 <SQL_C_DEFAULT>
SWORD -5 <SQL_BIGINT>
SQLULEN 0
SWORD 0
PTR 0x0000000001F30000
SQLLEN 0
SQLLEN * 0x0000000002DD0000 (4294967293)
```
When I execute I see that the executed sentence does contain the number quoted. Example (probably not exactly from the same test than previous trace logs):
`[14.554]PQsendQuery: 00000000005B4DB0 'BEGIN;declare "SQL_CUR000000000053DB60" cursor with hold for select * from public.testview where longfield< '5545';fetch 10000 in "SQL_CUR000000000053DB60"'
`
I think the reason for SQL_INTEGER and SQL_SMALLINT not being quoted (or quoted with ::int4) is [in convert.c#L5310](https://github.com/postgresql-interfaces/psqlodbc/blob/72943916325e2443fdb85fa5d1e053d9ef72f683/conv...) but I don't figure out why this is not the same for SQL_BIGINT.
It is not throwing an error but does not seems correct to me to use a text literal there
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://postgresql-interfaces/psqlodbc
Cc: [email protected], [email protected]
Subject: Re: [postgresql-interfaces/psqlodbc] issue #82: Is this expected a bind to BIGINT to be surrounded by quotes?
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox