Commit 3acb7d16 authored by Bruce Momjian's avatar Bruce Momjian

Test Case:

----------
exec sql begin declare section;
   short s ;
   unsigned short us;
exec sql end   declare section;
exec sql create table test(s smallint, us smallint);
exec sql commit;
s = 1; us =32000;
exec sql insert into test values( :s, :us ) ;  <== error

Error Message: "i4toi2: '-600309759' causes int2 underflow"

Masaaki Sakaida
parent 0343024a
...@@ -434,12 +434,20 @@ ECPGexecute(struct statement * stmt) ...@@ -434,12 +434,20 @@ ECPGexecute(struct statement * stmt)
switch (var->type) switch (var->type)
{ {
case ECPGt_short: case ECPGt_short:
sprintf(buff, "%d", *(short *) var->value);
tobeinserted = buff;
break;
case ECPGt_int: case ECPGt_int:
sprintf(buff, "%d", *(int *) var->value); sprintf(buff, "%d", *(int *) var->value);
tobeinserted = buff; tobeinserted = buff;
break; break;
case ECPGt_unsigned_short: case ECPGt_unsigned_short:
sprintf(buff, "%d", *(unsigned short *) var->value);
tobeinserted = buff;
break;
case ECPGt_unsigned_int: case ECPGt_unsigned_int:
sprintf(buff, "%d", *(unsigned int *) var->value); sprintf(buff, "%d", *(unsigned int *) var->value);
tobeinserted = buff; tobeinserted = buff;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment