diff options
author | Wez Furlong <wez@php.net> | 2005-11-25 03:35:04 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2005-11-25 03:35:04 +0000 |
commit | 70331c361e5457f09523bfbd81dce92c01741181 (patch) | |
tree | 83902f2b3eec1bec0d0d740a847365751c09f213 /ext/pdo_pgsql/php_pdo_pgsql_int.h | |
parent | 2256ec00ef3a90290d333c0cc157a65210e14cde (diff) | |
download | php-git-70331c361e5457f09523bfbd81dce92c01741181.tar.gz |
Addresses #35338.
Postgres client API is pretty poor, so we have zero idea about the actual
parameter types in a statement.
We now defer the preparation of a statement until the first call to execute is
made. At that point, we have the parameters defined by the calling script, so
we can use the typing specified there when we perform the prepare.
For PDO_PARAM_LOB parameters, we set the binary formatting flag.
We can't just set this flag for all parameters, because its meaning is not
"string data, counted length" but "data is in native format". If this flag is
set for a numeric column and we send the number 1 formatted as a string, then
we will get an "insufficient data left in message" error message, because the
library was expecting sizeof(int4) bytes but only saw 1 byte for "1".
This is infuriating because we have no way to determine the datatypes for
parameters, and the type we explicitly set has to match the type in the
database. The only choice we're left with is telling postgres to deduce the
type; we still have no idea what type was deduced.
Diffstat (limited to 'ext/pdo_pgsql/php_pdo_pgsql_int.h')
-rw-r--r-- | ext/pdo_pgsql/php_pdo_pgsql_int.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 855c934488..1b48f63ee1 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -57,9 +57,11 @@ typedef struct { char *cursor_name; #if HAVE_PQPREPARE char *stmt_name; + char *query; char **param_values; int *param_lengths; int *param_formats; + Oid *param_types; #endif } pdo_pgsql_stmt; |