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
This commit is contained in:
Bruce Momjian 1999-07-08 03:32:57 +00:00
parent 0343024a5c
commit 3acb7d1634
1 changed files with 8 additions and 0 deletions

View File

@ -434,12 +434,20 @@ ECPGexecute(struct statement * stmt)
switch (var->type)
{
case ECPGt_short:
sprintf(buff, "%d", *(short *) var->value);
tobeinserted = buff;
break;
case ECPGt_int:
sprintf(buff, "%d", *(int *) var->value);
tobeinserted = buff;
break;
case ECPGt_unsigned_short:
sprintf(buff, "%d", *(unsigned short *) var->value);
tobeinserted = buff;
break;
case ECPGt_unsigned_int:
sprintf(buff, "%d", *(unsigned int *) var->value);
tobeinserted = buff;