Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit723a9bd

Browse files
author
Michael Meskes
committed
- Accept output variables for FETCH in DECLARE statement.
- Synced parser.- Allowed C variables to carry the name of prepared statements.- Added Informix handling of datatype converion errors.
1 parent215d965 commit723a9bd

File tree

4 files changed

+166
-66
lines changed

4 files changed

+166
-66
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,19 @@ Tue Sep 9 12:13:51 CEST 2003
16221622
Wed Sep 10 20:01:49 CEST 2003
16231623

16241624
- Some files still had uppercase typenames
1625+
1626+
Mon Sep 15 18:09:42 CEST 2003
1627+
1628+
- Accept output variables for FETCH in DECLARE statement.
1629+
1630+
Tue Sep 16 07:56:14 CEST 2003
1631+
1632+
- Synced parser.
1633+
- Allowed C variables to carry the name of prepared statements.
1634+
1635+
Thu Sep 18 14:54:47 CEST 2003
1636+
1637+
- Added Informix handling of datatype converion errors.
16251638
- Set ecpg version to 3.0.0
16261639
- Set ecpg library to 4.0.0
16271640
- Set pgtypes library to 1.0.0

‎src/interfaces/ecpg/ecpglib/data.c

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
#definePOSTGRES_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

‎src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.24 2003/09/09 10:46:37 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.25 2003/09/18 13:12:23 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -857,7 +857,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
857857
else
858858
PGTYPESnumeric_from_decimal((decimal*) ((var+var->offset*element)->value),nval);
859859

860-
str=PGTYPESnumeric_to_asc(nval,0);
860+
str=PGTYPESnumeric_to_asc(nval,nval->dscale);
861861
PGTYPESnumeric_free(nval);
862862
slen=strlen(str);
863863

@@ -879,7 +879,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
879879
else
880880
PGTYPESnumeric_from_decimal((decimal*) (var->value),nval);
881881

882-
str=PGTYPESnumeric_to_asc(nval,0);
882+
str=PGTYPESnumeric_to_asc(nval,nval->dscale);
883883

884884
PGTYPESnumeric_free(nval);
885885
slen=strlen(str);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp