1- /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.17 2003/09/09 10:46:37 meskes Exp $ */
1+ /* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.18 2003/09/18 13:12:23 meskes Exp $ */
22
33#define POSTGRES_ECPG_INTERNAL
44#include "postgres_fe.h"
@@ -390,6 +390,21 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
390390 else
391391 nres = PGTYPESnumeric_from_asc (pval , & scan_length );
392392
393+ /* did we get an error? */
394+ if (errno != 0 )
395+ {
396+ if (INFORMIX_MODE (compat ))
397+ {
398+ /* Informix wants its own NULL value here instead of an error */
399+ ECPGset_informix_null (ECPGt_numeric , & nres );
400+ return (true);
401+ }
402+ else
403+ {
404+ ECPGraise (lineno , ECPG_NUMERIC_FORMAT , ECPG_SQLSTATE_DATATYPE_MISMATCH , pval );
405+ return (false);
406+ }
407+ }
393408 if (isarray && * scan_length == '"' )
394409 scan_length ++ ;
395410
@@ -417,6 +432,21 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
417432 else
418433 ires = PGTYPESinterval_from_asc (pval , & scan_length );
419434
435+ /* did we get an error? */
436+ if (errno != 0 )
437+ {
438+ if (INFORMIX_MODE (compat ))
439+ {
440+ /* Informix wants its own NULL value here instead of an error */
441+ ECPGset_informix_null (ECPGt_interval , & ires );
442+ return (true);
443+ }
444+ else
445+ {
446+ ECPGraise (lineno , ECPG_INTERVAL_FORMAT , ECPG_SQLSTATE_DATATYPE_MISMATCH , pval );
447+ return (false);
448+ }
449+ }
420450 if (isarray && * scan_length == '"' )
421451 scan_length ++ ;
422452
@@ -440,6 +470,22 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
440470 else
441471 ddres = PGTYPESdate_from_asc (pval , & scan_length );
442472
473+ /* did we get an error? */
474+ if (errno != 0 )
475+ {
476+ if (INFORMIX_MODE (compat ))
477+ {
478+ /* Informix wants its own NULL value here instead of an error */
479+ ECPGset_informix_null (ECPGt_date , & ddres );
480+ return (true);
481+ }
482+ else
483+ {
484+ ECPGraise (lineno , ECPG_DATE_FORMAT , ECPG_SQLSTATE_DATATYPE_MISMATCH , pval );
485+ return (false);
486+ }
487+ }
488+
443489 if (isarray && * scan_length == '"' )
444490 scan_length ++ ;
445491
@@ -462,6 +508,21 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
462508 else
463509 tres = PGTYPEStimestamp_from_asc (pval , & scan_length );
464510
511+ /* did we get an error? */
512+ if (errno != 0 )
513+ {
514+ if (INFORMIX_MODE (compat ))
515+ {
516+ /* Informix wants its own NULL value here instead of an error */
517+ ECPGset_informix_null (ECPGt_timestamp , & tres );
518+ return (true);
519+ }
520+ else
521+ {
522+ ECPGraise (lineno , ECPG_TIMESTAMP_FORMAT , ECPG_SQLSTATE_DATATYPE_MISMATCH , pval );
523+ return (false);
524+ }
525+ }
465526 if (isarray && * scan_length == '"' )
466527 scan_length ++ ;
467528
0 commit comments