aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2005-08-24 10:35:12 +0000
committerMichael Meskes <meskes@postgresql.org>2005-08-24 10:35:12 +0000
commit5576a611cd8f358a751f53ad787b4b659bbf77cc (patch)
treea782e2e9774c4d2ac4cf4970bdc4df03db84bac8 /src
parent9b4296abe0f0bcb07aab589a70cb01bb2dc8f437 (diff)
downloadpostgresql-5576a611cd8f358a751f53ad787b4b659bbf77cc.tar.gz
postgresql-5576a611cd8f358a751f53ad787b4b659bbf77cc.zip
- Check for NULL before checking whether argument is an array.
- Removed stray character from string quoting. - Fixed check to report missing varchar pointer implementation.
Diffstat (limited to 'src')
-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 25738796fb2..b1719ab38d3 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.27 2004/08/29 05:06:59 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.27.4.1 2005/08/24 10:35:12 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -50,29 +50,6 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %s\n", lineno, pval ? pval : "", offset, isarray ? "Yes" : "No");
- /* 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 */
/*
@@ -129,6 +106,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 c2b4d43ad5b..4b9b84e839f 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.303.4.3 2005/02/10 08:07:46 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.303.4.4 2005/08/24 10:35:12 meskes Exp $ */
/* Copyright comment */
%{
@@ -5142,7 +5142,8 @@ variable: opt_pointer ECPGColLabel 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)