From 22b70af505319b87901e17bcc77dd6024b55d656 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 18 Mar 2005 15:34:48 +0000 Subject: [PATCH] When inserting SHRT_MIN into an int2 column, the ODBC driver comes up with the following SQL: insert into dbc_test ( i16 ) values ( -32768::int2 ); This fails with an out of range error. Changed to: insert into dbc_test ( i16 ) values ( (-32768)::int2 ); patch by Kelly Burkhart --- convert.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/convert.c b/convert.c index 79f5c11..010cc38 100644 --- a/convert.c +++ b/convert.c @@ -2989,6 +2989,11 @@ ResolveOneParam(QueryBuild *qb) if (param_sqltype == SQL_BIT) CVT_APPEND_CHAR(qb, '\''); /* Open Quote */ + if (param_sqltype == SQL_SMALLINT) + { + CVT_APPEND_STR(qb, "("); + } + if (buf) { switch (used) @@ -3008,7 +3013,7 @@ ResolveOneParam(QueryBuild *qb) if (param_sqltype == SQL_SMALLINT) { /* needs cast because there is no automatic downcast from int4 constants */ - CVT_APPEND_STR(qb, "::int2"); + CVT_APPEND_STR(qb, ")::int2"); } if (param_sqltype == SQL_BIT) -- 2.39.5