summaryrefslogtreecommitdiff
path: root/statement.c
diff options
context:
space:
mode:
authorHeikki Linnakangas2015-01-29 12:29:40 +0000
committerHeikki Linnakangas2015-01-29 12:30:20 +0000
commit4c90ca65403da625f191a84258221a461bd29718 (patch)
tree98434407d544d975e3df79836b4c6e8e26fb0778 /statement.c
parente5e048509bada06c61f05901904ddbdda070bd10 (diff)
Fix crash when a query is described, without binding params.
Add test case for the same.
Diffstat (limited to 'statement.c')
-rw-r--r--statement.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/statement.c b/statement.c
index f53fcfb..20c9c06 100644
--- a/statement.c
+++ b/statement.c
@@ -2675,13 +2675,18 @@ mylog("sta_pidx=%d end_pidx=%d num_p=%d\n", sta_pidx, end_pidx, num_params);
j = 0;
for (i = sta_pidx; i <= end_pidx; i++)
{
- if (i < ipdopts->allocated &&
- SQL_PARAM_OUTPUT == ipdopts->parameters[i].paramType)
- paramTypes[j++] = PG_TYPE_VOID;
+ if (i < ipdopts->allocated)
+ {
+ if (SQL_PARAM_OUTPUT == ipdopts->parameters[i].paramType)
+ paramTypes[j++] = PG_TYPE_VOID;
+ else
+ paramTypes[j++] = sqltype_to_bind_pgtype(conn,
+ ipdopts->parameters[i].SQLType);
+ }
else
{
- paramTypes[j++] = sqltype_to_bind_pgtype(conn,
- ipdopts->parameters[i].SQLType);
+ /* Unknown type of parameter. Let the server decide */
+ paramTypes[j++] = 0;
}
}
}