- Check for NULL before checking whether argument is an array.
authorMichael Meskes <[email protected]>
Wed, 24 Aug 2005 10:34:19 +0000 (10:34 +0000)
committerMichael Meskes <[email protected]>
Wed, 24 Aug 2005 10:34:19 +0000 (10:34 +0000)
        - Remove stary character from string quoting.
        - Fixed check to report missing varchar pointer implementation.

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/preproc/preproc.y

index 20ace619deebfebe7c51933b69597e6fb1087504..dcb8d4242e1ced5c8b099a745372287e8d4d8b71 100644 (file)
@@ -1929,6 +1929,12 @@ Thu Jun  2 14:22:32 CEST 2005
        - Fixed memory leak in ecpglib by adding some missing free() commands.
        - Added patch by Gavin Scott <[email protected]> for Intel 64bit
          hardware.
+
+Wed Aug 24 12:17:48 CEST 2005
+
+       - Check for NULL before checking whether argument is an array.
+       - Removed stray character from string quoting.
+       - Fixed check to report missing varchar pointer implementation.
        - Set ecpg library version to 5.1.
        - Set ecpg version to 4.1.1.
 
index f880cf03c6ed982297e2933425fbbac031cc7702..201fe9ee7d8d79793895913c9bb9051894bf147e 100644 (file)
@@ -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)
index 0610689737283b77d98479f357bc8277635037b3..6b43bad2e590718b363e252bf4ac3f7ffaefa48c 100644 (file)
@@ -5144,7 +5144,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)