Re: [Sqlrelay-discussion] Bind (bytea) with Postgresql
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2006-04-13 13:40:20
|
SQL Relay 0.36.4 doesn't support postgresql 8's bind syntax. I added it
in 0.37. If you upgrade to 0.37, it should work.
In 0.36, you could write the query like:
UPDATE queue_job_info SET job_request = :1 WHERE job_id = :2
And SQL Relay will rewrite the query, substituting in the bind values.
However, there were other bugs in 0.36.4 that could cause blob data to
get truncated and/or cause errors if it had single or double-quotes in
it, so I'd recommend upgrading to 0.37.
Dave
dav...@fi...
On Fri, 2006-04-07 at 11:51 +0200, Marcel C. Pantigny wrote:
> Hi,
>
> I use sqlrelay 36.4 with the programming language C.
>
> with the following code:
>
> /* C-CODE */
> FILE *file;
> char *fileName="input.dat";
> long id = 1;
> unsigned int len = 14112;
>
> file = fopen(fileName, "r");
> char data[len+1];
> if( fread(data, 1, len, file) != len )
> printf ("NOK\n");
> data[len]=NULL;
> fclose(file);
>
> sqlrcur_prepareQuery(cur, "UPDATE data SET info = ? WHERE id = ?");
> sqlrcur_inputBindBlob(cur, "1", data, len);
> sqlrcur_inputBindLong(cur, "2", id);
> if (!sqlrcur_executeQuery(cur))
> printf (" %s\n", sqlrcur_errorMessage(cur));
> /* C-CODE END */
>
> This returns an error (cur.getErrorMessage):
>
> ERROR: syntax error at or near "WHERE" at character 42
>
> Attempted Query:
> UPDATE queue_job_info SET job_request = ? WHERE job_id = ?
>
> For what do I make wrong around blob to read/write?
>
> Thanks and Regards,
> Marcel C. Pantigny
|