summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-08-24 10:35:54 +0000
committerMichael Meskes <meskes@postgresql.org>2005-08-24 10:35:54 +0000
commitd00f6b249afecef48dfcbc35ea0be9fc08922e2e (patch)
tree35005e3fa9369a7e81b6554fe1fc8f96d41e620f
parente2e2e15cf89ec67eeed443e4548b72e701a3d202 (diff)
downloadpostgresql-d00f6b249afecef48dfcbc35ea0be9fc08922e2e.tar.gz
- Check for NULL before checking whether argument is an array.
- Removed stray character from string quoting. - Fixed check to report missing varchar pointer implementation.
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c48
-rw-r--r--src/interfaces/ecpg/preproc/preproc.y5
2 files changed, 27 insertions, 26 deletions
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index 5aa46b94dd..fe258dba8f 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.20.2.1 2003/11/12 08:42:57 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.20.2.2 2005/08/24 10:35:54 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -46,29 +46,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %d\n", lineno, pval ? pval : "", offset, isarray);
- /* pval is a pointer to the value */
- /* let's check if it really is an array if it should be one */
- if (isarray == ECPG_ARRAY_ARRAY)
- {
- if (*pval != '{')
- {
- ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
- return (false);
- }
-
- switch (type)
- {
- case ECPGt_char:
- case ECPGt_unsigned_char:
- case ECPGt_varchar:
- break;
-
- default:
- pval++;
- break;
- }
- }
-
/* We will have to decode the value */
/*
@@ -125,6 +102,29 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
if (value_for_indicator == -1)
return (true);
+ /* pval is a pointer to the value */
+ /* let's check if it really is an array if it should be one */
+ if (isarray == ECPG_ARRAY_ARRAY)
+ {
+ if (*pval != '{')
+ {
+ ECPGraise(lineno, ECPG_DATA_NOT_ARRAY, ECPG_SQLSTATE_DATATYPE_MISMATCH, NULL);
+ return (false);
+ }
+
+ switch (type)
+ {
+ case ECPGt_char:
+ case ECPGt_unsigned_char:
+ case ECPGt_varchar:
+ break;
+
+ default:
+ pval++;
+ break;
+ }
+ }
+
do
{
switch (type)
diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y
index eede4bb9d3..80b166221b 100644
--- a/src/interfaces/ecpg/preproc/preproc.y
+++ b/src/interfaces/ecpg/preproc/preproc.y
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.263.2.19 2004/11/10 13:49:17 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.263.2.20 2005/08/24 10:35:54 meskes Exp $ */
/* Copyright comment */
%{
@@ -5121,7 +5121,8 @@ variable: opt_pointer ECPGColLabelCommon opt_array_bounds opt_initializer
*dim = '\0';
else
sprintf(dim, "[%s]", dimension);
- if (strcmp(length, "0") == 0)
+ /* if (strcmp(length, "0") == 0)*/
+ if (atoi(length) <= 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");
if (strcmp(dimension, "0") == 0)