]> granicus.if.org Git - postgresql/commitdiff
Joachim fixed some bugs in numeric handling in pgtypeslib.
authorMichael Meskes <meskes@postgresql.org>
Mon, 7 Aug 2006 13:17:02 +0000 (13:17 +0000)
committerMichael Meskes <meskes@postgresql.org>
Mon, 7 Aug 2006 13:17:02 +0000 (13:17 +0000)
Fixed and cleaned up some regression tests. Also added a new one.

23 files changed:
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/pgtypeslib/numeric.c
src/interfaces/ecpg/test/compat_informix/test_informix.pgc
src/interfaces/ecpg/test/expected/compat_informix-test_informix.c
src/interfaces/ecpg/test/expected/compat_informix-test_informix.stderr
src/interfaces/ecpg/test/expected/compat_informix-test_informix.stdout
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.c
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stderr
src/interfaces/ecpg/test/expected/pgtypeslib-dt_test.stdout
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c [new file with mode: 0644]
src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr [new file with mode: 0644]
src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout [new file with mode: 0644]
src/interfaces/ecpg/test/expected/sql-dyntest2.c
src/interfaces/ecpg/test/expected/sql-dyntest2.stderr
src/interfaces/ecpg/test/expected/sql-dyntest2.stdout
src/interfaces/ecpg/test/pgtypeslib/Makefile
src/interfaces/ecpg/test/pgtypeslib/dt_test.pgc
src/interfaces/ecpg/test/pgtypeslib/num_test.pgc
src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc [new file with mode: 0644]
src/interfaces/ecpg/test/sql/dyntest2.pgc

index 933d962464663a526847289ced2ef49795779a1d..ac70c770acb8a87d281885749e8738579337a351 100644 (file)
@@ -2068,5 +2068,9 @@ We Aug  2 13:15:25 CEST 2006
 Fr Aug  4 10:44:30 CEST 2006
 
        - Applied test suite update by Joachim Wieland <joe@mcknight.de>.
+
+Mo Aug  7 14:56:44 CEST 2006
+
+       - Joachim fixed some bugs in numeric handling in pgtypeslib.
        - Set ecpg library version to 5.2.
        - Set ecpg version to 4.2.1.
index 52c5bbca8026e1ce931147ef54747d27cd3a00fe..ba60ede72468cf7945a1be8949a1911934a25c4d 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.27 2006/06/21 10:24:41 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/numeric.c,v 1.28 2006/08/07 13:17:01 meskes Exp $ */
 
 #include "postgres_fe.h"
 #include <ctype.h>
@@ -386,10 +386,18 @@ PGTYPESnumeric_from_asc(char *str, char **endptr)
 char *
 PGTYPESnumeric_to_asc(numeric *num, int dscale)
 {
+       numeric *numcopy = PGTYPESnumeric_new();
+       char    *s;
+
        if (dscale < 0)
                dscale = num->dscale;
 
-       return (get_str_from_var(num, dscale));
+       if (PGTYPESnumeric_copy(num, numcopy) < 0)
+               return NULL;
+       /* get_str_from_var may change its argument */
+       s = get_str_from_var(numcopy, dscale);
+       PGTYPESnumeric_free(numcopy);
+       return (s);
 }
 
 /* ----------
@@ -1448,6 +1456,7 @@ PGTYPESnumeric_from_double(double d, numeric *dst)
        if (PGTYPESnumeric_copy(tmp, dst) != 0)
                return -1;
        PGTYPESnumeric_free(tmp);
+       errno = 0;
        return 0;
 }
 
@@ -1457,12 +1466,23 @@ numericvar_to_double_no_overflow(numeric *var, double *dp)
        char       *tmp;
        double          val;
        char       *endptr;
+       numeric    *varcopy = PGTYPESnumeric_new();
 
-       if ((tmp = get_str_from_var(var, var->dscale)) == NULL)
+       if (PGTYPESnumeric_copy(var, varcopy) < 0)
                return -1;
+       if ((tmp = get_str_from_var(varcopy, varcopy->dscale)) == NULL)
+               return -1;
+       PGTYPESnumeric_free(varcopy);
 
-       /* unlike float8in, we ignore ERANGE from strtod */
        val = strtod(tmp, &endptr);
+       if (errno == ERANGE)
+       {
+               free(tmp);
+               errno = PGTYPES_NUM_OVERFLOW;
+               return -1;
+       }
+
+       /* can't free tmp yet, endptr points still into it */
        if (*endptr != '\0')
        {
                /* shouldn't happen ... */
@@ -1470,8 +1490,8 @@ numericvar_to_double_no_overflow(numeric *var, double *dp)
                errno = PGTYPES_NUM_BAD_NUMERIC;
                return -1;
        }
-       *dp = val;
        free(tmp);
+       *dp = val;
        return 0;
 }
 
@@ -1509,28 +1529,23 @@ PGTYPESnumeric_to_int(numeric *nv, int *ip)
 int
 PGTYPESnumeric_to_long(numeric *nv, long *lp)
 {
-       int                     i;
-       long            l = 0;
+       char *s = PGTYPESnumeric_to_asc(nv, 0);
+       char *endptr;
 
-       for (i = 1; i < nv->weight + 2; i++)
-       {
-               l *= 10;
-               l += nv->buf[i];
-       }
-       if (nv->buf[i] >= 5)
-       {
-               /* round up */
-               l++;
-       }
-       if (l > LONG_MAX || l < 0)
+       if (s == NULL)
+               return -1;
+
+       errno = 0;
+       *lp = strtol(s, &endptr, 10);
+       if (endptr == s)
+               /* this should not happen actually */
+               return -1;
+       if (errno == ERANGE)
        {
                errno = PGTYPES_NUM_OVERFLOW;
                return -1;
        }
-
-       if (nv->sign == NUMERIC_NEG)
-               l *= -1;
-       *lp = l;
+       free(s);
        return 0;
 }
 
index 2a78396abdb8a27d62d1b4610494434cba70b92a..744eded5745a5fd2257f6f56c46d543768d16a2f 100644 (file)
@@ -37,9 +37,10 @@ int main(void)
 
        /* this will fail (more than one row in subquery) */
        $select i from test where j=(select j from test);
+       $rollback;
 
        /* this however should be ok */
-       $select i from test where j=(select j from test limit 1);
+       $select i from test where j=(select j from test order by i limit 1);
        printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
        if (sqlca.sqlcode != 0) $rollback;
 
index cb42a40479582495e9f7f322dc5399679539cce6..b6efd82727d078a9ca04d6abdf8fa703e61baede 100644 (file)
@@ -118,25 +118,31 @@ if (sqlca.sqlcode < 0) dosqlprint (  );}
 if (sqlca.sqlcode < 0) dosqlprint (  );}
 #line 39 "test_informix.pgc"
 
+       { ECPGtrans(__LINE__, NULL, "rollback");
+#line 40 "test_informix.pgc"
+
+if (sqlca.sqlcode < 0) dosqlprint (  );}
+#line 40 "test_informix.pgc"
+
 
        /* this however should be ok */
-       { ECPGdo(__LINE__, 1, 1, NULL, "select  i  from test where j = ( select  j  from test     limit 1  )  ", ECPGt_EOIT, ECPGt_EORT);
-#line 42 "test_informix.pgc"
+       { ECPGdo(__LINE__, 1, 1, NULL, "select  i  from test where j = ( select  j  from test    order by i limit 1  )  ", ECPGt_EOIT, ECPGt_EORT);
+#line 43 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 42 "test_informix.pgc"
+#line 43 "test_informix.pgc"
 
        printf("SELECT: %ld=%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
        if (sqlca.sqlcode != 0) { ECPGtrans(__LINE__, NULL, "rollback");
-#line 44 "test_informix.pgc"
+#line 45 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 44 "test_informix.pgc"
+#line 45 "test_informix.pgc"
 
 
         ECPG_informix_set_var( 0, &( i ), __LINE__);\
   /* declare c  cursor  for select  *  from test where i <=  ?   */
-#line 46 "test_informix.pgc"
+#line 47 "test_informix.pgc"
 
        openit();
 
@@ -149,10 +155,10 @@ if (sqlca.sqlcode < 0) dosqlprint (  );}
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
        ECPGt_decimal,&(j),(long)1,(long)1,sizeof(decimal), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 53 "test_informix.pgc"
+#line 54 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 53 "test_informix.pgc"
+#line 54 "test_informix.pgc"
 
                if (sqlca.sqlcode == 100) break;
                else if (sqlca.sqlcode != 0) printf ("Error: %ld\n", sqlca.sqlcode);
@@ -174,53 +180,53 @@ if (sqlca.sqlcode < 0) dosqlprint (  );}
        { ECPGdo(__LINE__, 1, 1, NULL, "delete from test  where i =  ?", 
        ECPGt_decimal,&(n),(long)1,(long)1,sizeof(decimal), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 71 "test_informix.pgc"
+#line 72 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 71 "test_informix.pgc"
+#line 72 "test_informix.pgc"
 
        printf("DELETE: %ld\n", sqlca.sqlcode);
 
        { ECPGdo(__LINE__, 1, 1, NULL, "select  1  from test where i = 14  ", ECPGt_EOIT, ECPGt_EORT);
-#line 74 "test_informix.pgc"
+#line 75 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 74 "test_informix.pgc"
+#line 75 "test_informix.pgc"
 
        printf("Exists: %ld\n", sqlca.sqlcode);
 
        { ECPGdo(__LINE__, 1, 1, NULL, "select  1  from test where i = 147  ", ECPGt_EOIT, ECPGt_EORT);
-#line 77 "test_informix.pgc"
+#line 78 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 77 "test_informix.pgc"
+#line 78 "test_informix.pgc"
 
        printf("Does not exist: %ld\n", sqlca.sqlcode);
 
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 80 "test_informix.pgc"
+#line 81 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 80 "test_informix.pgc"
+#line 81 "test_informix.pgc"
 
        { ECPGdo(__LINE__, 1, 1, NULL, "drop table test ", ECPGt_EOIT, ECPGt_EORT);
-#line 81 "test_informix.pgc"
+#line 82 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 81 "test_informix.pgc"
+#line 82 "test_informix.pgc"
 
        { ECPGtrans(__LINE__, NULL, "commit");
-#line 82 "test_informix.pgc"
+#line 83 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 82 "test_informix.pgc"
+#line 83 "test_informix.pgc"
 
 
        { ECPGdisconnect(__LINE__, "CURRENT");
-#line 84 "test_informix.pgc"
+#line 85 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 84 "test_informix.pgc"
+#line 85 "test_informix.pgc"
 
 
        return 0;
@@ -231,10 +237,10 @@ static void openit(void)
        { ECPGdo(__LINE__, 1, 1, NULL, "declare c  cursor  for select  *  from test where i <=  ?  ", 
        ECPGt_int,&(*( int  *)(ECPG_informix_get_var( 0))),(long)1,(long)1,sizeof(int), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 91 "test_informix.pgc"
+#line 92 "test_informix.pgc"
 
 if (sqlca.sqlcode < 0) dosqlprint (  );}
-#line 91 "test_informix.pgc"
+#line 92 "test_informix.pgc"
 
 }
 
index 2ec0c149d688d1a35209e166f5ed46321106d19c..edb98910720c9f72e06e4fb1f946c386daee87b4 100644 (file)
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: raising sqlstate 21000 (sqlcode: -284) in line 39, ''more than one row returned by a subquery used as an expression' in line 39.'.
 [NO_PID]: sqlca: code: -284, state: 21000
-[NO_PID]: ECPGexecute line 42: QUERY: select  i  from test where j = ( select  j  from test     limit 1  )   on connection regress1
+[NO_PID]: ECPGtrans line 40 action = rollback connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 42: Error: ERROR:  current transaction is aborted, commands ignored until end of transaction block
+[NO_PID]: ECPGexecute line 43: QUERY: select  i  from test where j = ( select  j  from test    order by i limit 1  )   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlstate 25P02 (sqlcode: -400) in line 42, ''current transaction is aborted, commands ignored until end of transaction block' in line 42.'.
-[NO_PID]: sqlca: code: -400, state: 25P02
-[NO_PID]: ECPGtrans line 44 action = rollback connection = regress1
+[NO_PID]: ECPGexecute line 43: Correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91: QUERY: declare c  cursor  for select  *  from test where i <=  14   on connection regress1
+[NO_PID]: ECPGexecute line 92: QUERY: declare c  cursor  for select  *  from test where i <=  14   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 91 Ok: DECLARE CURSOR
+[NO_PID]: ECPGexecute line 92 Ok: DECLARE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 54: Correctly got 1 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 53: RESULT: 7 offset: 4 array: Yes
+[NO_PID]: ECPGget_data line 54: RESULT: 7 offset: 4 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 53: RESULT: 0 offset: 52 array: Yes
+[NO_PID]: ECPGget_data line 54: RESULT: 0 offset: 52 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 2 fields
+[NO_PID]: ECPGexecute line 54: Correctly got 1 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 53: RESULT: 14 offset: 4 array: Yes
+[NO_PID]: ECPGget_data line 54: RESULT: 14 offset: 4 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 53: RESULT: 1 offset: 52 array: Yes
+[NO_PID]: ECPGget_data line 54: RESULT: 1 offset: 52 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch forward from c on connection regress1
+[NO_PID]: ECPGexecute line 54: QUERY: fetch forward from c on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 0 tuples with 2 fields
+[NO_PID]: ECPGexecute line 54: Correctly got 0 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 53, 'No data found in line 53.'.
+[NO_PID]: raising sqlcode 100 in line 54, 'No data found in line 54.'.
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 71: QUERY: delete from test  where i =  21.0 on connection regress1
+[NO_PID]: ECPGexecute line 72: QUERY: delete from test  where i =  21.0 on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 71 Ok: DELETE 0
+[NO_PID]: ECPGexecute line 72 Ok: DELETE 0
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 71, 'No data found in line 71.'.
+[NO_PID]: raising sqlcode 100 in line 72, 'No data found in line 72.'.
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 74: QUERY: select  1  from test where i = 14   on connection regress1
+[NO_PID]: ECPGexecute line 75: QUERY: select  1  from test where i = 14   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 74: Correctly got 1 tuples with 1 fields
+[NO_PID]: ECPGexecute line 75: Correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 77: QUERY: select  1  from test where i = 147   on connection regress1
+[NO_PID]: ECPGexecute line 78: QUERY: select  1  from test where i = 147   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 77: Correctly got 0 tuples with 1 fields
+[NO_PID]: ECPGexecute line 78: Correctly got 0 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 77, 'No data found in line 77.'.
+[NO_PID]: raising sqlcode 100 in line 78, 'No data found in line 78.'.
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGtrans line 80 action = commit connection = regress1
+[NO_PID]: ECPGtrans line 81 action = commit connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 81: QUERY: drop table test  on connection regress1
+[NO_PID]: ECPGexecute line 82: QUERY: drop table test  on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 81 Ok: DROP TABLE
+[NO_PID]: ECPGexecute line 82 Ok: DROP TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 82 action = commit connection = regress1
+[NO_PID]: ECPGtrans line 83 action = commit connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: Connection regress1 closed.
 [NO_PID]: sqlca: code: 0, state: 00000
index d589abe09d0812147c85176e95a3ce0a7576a7e7..d3bb3736f7d99a171829f3da550f81b9a6e8440c 100644 (file)
@@ -1,8 +1,7 @@
 doSQLprint: Error: 'duplicate key violates unique constraint "test_pkey"' in line 31.
 INSERT: -239='duplicate key violates unique constraint "test_pkey"' in line 31.
 doSQLprint: Error: 'more than one row returned by a subquery used as an expression' in line 39.
-doSQLprint: Error: 'current transaction is aborted, commands ignored until end of transaction block' in line 42.
-SELECT: -400='current transaction is aborted, commands ignored until end of transaction block' in line 42.
+SELECT: 0=
 7 0
 14 1
 DELETE: 100
index 466c5de744206e2a0d78e90c04c89c0e2b4efc1e..6082488a8bf9526567942c294ce309d18e248e88 100644 (file)
@@ -31,7 +31,7 @@ main(void)
        /* exec sql begin declare section */
                 
                 
-                
+                 
                 
        
 #line 14 "dt_test.pgc"
@@ -41,7 +41,7 @@ main(void)
  timestamp  ts1    ;
  
 #line 16 "dt_test.pgc"
- interval  iv1    ;
+ interval * iv1    ,  iv2    ;
  
 #line 17 "dt_test.pgc"
  char * text    ;
@@ -65,7 +65,7 @@ main(void)
 if (sqlca.sqlcode < 0) sqlprint (  );}
 #line 28 "dt_test.pgc"
 
-        { ECPGdo(__LINE__, 0, 1, NULL, "create  table date_test ( d date   , ts timestamp    , iv interval    )    ", ECPGt_EOIT, ECPGt_EORT);
+        { ECPGdo(__LINE__, 0, 1, NULL, "create  table date_test ( d date   , ts timestamp    )    ", ECPGt_EOIT, ECPGt_EORT);
 #line 29 "dt_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
@@ -81,7 +81,7 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        date1 = PGTYPESdate_from_asc(d1, NULL); 
        ts1 = PGTYPEStimestamp_from_asc(t1, NULL); 
 
-       { ECPGdo(__LINE__, 0, 1, NULL, "insert into date_test ( d  , ts  , iv  ) values(  ? ,  ? , '2003-02-28 12:34' :: timestamp   - 'Mon Jan 17 1966' :: timestamp   )", 
+       { ECPGdo(__LINE__, 0, 1, NULL, "insert into date_test ( d  , ts  ) values(  ? ,  ? )", 
        ECPGt_date,&(date1),(long)1,(long)1,sizeof(date), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
        ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp), 
@@ -98,8 +98,6 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        ECPGt_date,&(date1),(long)1,(long)1,sizeof(date), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
        ECPGt_timestamp,&(ts1),(long)1,(long)1,sizeof(timestamp), 
-       ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, 
-       ECPGt_interval,&(iv1),(long)1,(long)1,sizeof(interval), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
 #line 37 "dt_test.pgc"
 
@@ -115,7 +113,9 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        printf ("timestamp: %s\n", text);
        free(text);
 
-       text = PGTYPESinterval_to_asc(&iv1);
+       iv1 = PGTYPESinterval_from_asc("13556 days 12 hours 34 minutes 14 seconds ", NULL);
+       PGTYPESinterval_copy(iv1, &iv2);
+       text = PGTYPESinterval_to_asc(&iv2);
        printf ("interval: %s\n", text);
        free(text);
 
@@ -132,11 +132,6 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
        text = PGTYPEStimestamp_to_asc(ts1);
        printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
-
-       PGTYPESdate_today(&date1);
-       /* can't output this in regression mode */
-
-       printf("using date %s\n", text);
        free(text);
 
        fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
@@ -423,16 +418,16 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        free(text);
 
        { ECPGtrans(__LINE__, NULL, "rollback");
-#line 354 "dt_test.pgc"
+#line 351 "dt_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 354 "dt_test.pgc"
+#line 351 "dt_test.pgc"
 
         { ECPGdisconnect(__LINE__, "CURRENT");
-#line 355 "dt_test.pgc"
+#line 352 "dt_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 355 "dt_test.pgc"
+#line 352 "dt_test.pgc"
 
 
        return (0);
index e1377e3f37d7ff3693fa271bf2d36e39dad0abd5..9513e6be68dee3c490f1f9b9de4f5c5126e50707 100644 (file)
@@ -2,7 +2,7 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 29: QUERY: create  table date_test ( d date   , ts timestamp    , iv interval    )     on connection regress1
+[NO_PID]: ECPGexecute line 29: QUERY: create  table date_test ( d date   , ts timestamp    )     on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute line 29 Ok: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute line 30 Ok: SET
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 35: QUERY: insert into date_test ( d  , ts  , iv  ) values(  date '1966-01-17' ,  timestamp '2000-07-12 17:34:29' , '2003-02-28 12:34' :: timestamp   - 'Mon Jan 17 1966' :: timestamp   ) on connection regress1
+[NO_PID]: ECPGexecute line 35: QUERY: insert into date_test ( d  , ts  ) values(  date '1966-01-17' ,  timestamp '2000-07-12 17:34:29' ) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute line 35 Ok: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute line 37: QUERY: select  *  from date_test where d =  date '1966-01-17'   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 3 fields
+[NO_PID]: ECPGexecute line 37: Correctly got 1 tuples with 2 fields
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_data line 37: RESULT: 1966-01-17 offset: 4 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_data line 37: RESULT: 2000-07-12 17:34:29 offset: 8 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 37: RESULT: 13556 days 12:34:00 offset: 12 array: Yes
-[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 354 action = rollback connection = regress1
+[NO_PID]: ECPGtrans line 351 action = rollback connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: Connection regress1 closed.
 [NO_PID]: sqlca: code: 0, state: 00000
index 29f321928f7087efccb93bd20f2ed162ce6d42cd..03f01de0c6fb2e1b2ab64769d94e4306cd14ac56 100644 (file)
@@ -1,11 +1,10 @@
 Date: 1966-01-17
 timestamp: 2000-07-12 17:34:29
-interval: @ 13556 days 12 hours 34 mins
+interval: @ 13556 days 12 hours 34 mins 14 secs
 m: 4, d: 19, y: 1998
 date seems to get encoded to julian -622
 m: 4, d: 19, y: 1998
 date_day of 2003-12-04 17:34:29 is 4
-using date 2003-12-04 17:34:29
 Above date in format "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end" is "(Thu), Dec. 04, 2003, repeat: (Thu), Dec. 04, 2003. end"
 date_defmt_asc1: 1995-12-25
 date_defmt_asc2: 0095-12-25
index 58ca7964ca3e3fe93ef3a0c092404301424c61ab..d865bc54852f09e58afb421421c31f93a1afc9f0 100644 (file)
@@ -38,36 +38,38 @@ main(void)
 #line 16 "num_test.pgc"
 
        double d;
+       long l1, l2;
+       int i;
 
        ECPGdebug(1, stderr);
        /* exec sql whenever sqlerror  do sqlprint (  ) ; */
-#line 20 "num_test.pgc"
+#line 22 "num_test.pgc"
 
 
        { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); 
-#line 22 "num_test.pgc"
+#line 24 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 22 "num_test.pgc"
+#line 24 "num_test.pgc"
 
 
        { ECPGsetcommit(__LINE__, "off", NULL);
-#line 24 "num_test.pgc"
+#line 26 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 24 "num_test.pgc"
+#line 26 "num_test.pgc"
 
        { ECPGdo(__LINE__, 0, 1, NULL, "create  table test ( text char  ( 5 )    , num numeric ( 14 , 7 )   )    ", ECPGt_EOIT, ECPGt_EORT);
-#line 25 "num_test.pgc"
+#line 27 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 25 "num_test.pgc"
+#line 27 "num_test.pgc"
 
 
        value1 = PGTYPESnumeric_new();
        PGTYPESnumeric_from_int(1407, value1);
        text = PGTYPESnumeric_to_asc(value1, -1);
-       printf("long = %s\n", text);
+       printf("from int = %s\n", text);
        free(text);
        PGTYPESnumeric_free(value1);
 
@@ -90,10 +92,10 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        { ECPGdo(__LINE__, 0, 1, NULL, "insert into test ( text  , num  ) values( 'test' ,  ? )", 
        ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 50 "num_test.pgc"
+#line 52 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 50 "num_test.pgc"
+#line 52 "num_test.pgc"
 
 
        value2 = PGTYPESnumeric_from_asc("2369.7", NULL);
@@ -103,10 +105,10 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        { ECPGdo(__LINE__, 0, 1, NULL, "select  num  from test where text = 'test'  ", ECPGt_EOIT, 
        ECPGt_numeric,&(des),(long)1,(long)0,sizeof(numeric), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 56 "num_test.pgc"
+#line 58 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 56 "num_test.pgc"
+#line 58 "num_test.pgc"
 
 
        PGTYPESnumeric_mul(res, des, res);
@@ -120,22 +122,28 @@ if (sqlca.sqlcode < 0) sqlprint (  );}
        text = PGTYPESnumeric_to_asc(res, -1);
        PGTYPESnumeric_to_double(res, &d);
        printf("div = %s %e\n", text, d);
+
+       value1 = PGTYPESnumeric_from_asc("2E7", NULL);
+       value2 = PGTYPESnumeric_from_asc("14", NULL);
+       i = PGTYPESnumeric_to_long(value1, &l1) | PGTYPESnumeric_to_long(value2, &l2);
+       printf("to long(%d) = %ld %ld\n", i, l1, l2);
+
        free(text);
        PGTYPESnumeric_free(value1);
        PGTYPESnumeric_free(value2);
        PGTYPESnumeric_free(res);
 
        { ECPGtrans(__LINE__, NULL, "rollback");
-#line 74 "num_test.pgc"
+#line 82 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 74 "num_test.pgc"
+#line 82 "num_test.pgc"
 
        { ECPGdisconnect(__LINE__, "CURRENT");
-#line 75 "num_test.pgc"
+#line 83 "num_test.pgc"
 
 if (sqlca.sqlcode < 0) sqlprint (  );}
-#line 75 "num_test.pgc"
+#line 83 "num_test.pgc"
 
 
        return (0);
index f22986bcdfa203a9f5f08c233f86649cd57d4a12..c8c0c7457d074ff87bed7a5c11a9d2d42c213dba 100644 (file)
@@ -2,23 +2,23 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGsetcommit line 24 action = off connection = regress1
+[NO_PID]: ECPGsetcommit line 26 action = off connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25: QUERY: create  table test ( text char  ( 5 )    , num numeric ( 14 , 7 )   )     on connection regress1
+[NO_PID]: ECPGexecute line 27: QUERY: create  table test ( text char  ( 5 )    , num numeric ( 14 , 7 )   )     on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 25 Ok: CREATE TABLE
+[NO_PID]: ECPGexecute line 27 Ok: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 50: QUERY: insert into test ( text  , num  ) values( 'test' ,  2369.7 ) on connection regress1
+[NO_PID]: ECPGexecute line 52: QUERY: insert into test ( text  , num  ) values( 'test' ,  2369.7 ) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 50 Ok: INSERT 0 1
+[NO_PID]: ECPGexecute line 52 Ok: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 56: QUERY: select  num  from test where text = 'test'   on connection regress1
+[NO_PID]: ECPGexecute line 58: QUERY: select  num  from test where text = 'test'   on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 56: Correctly got 1 tuples with 1 fields
+[NO_PID]: ECPGexecute line 58: Correctly got 1 tuples with 1 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 56: RESULT: 2369.7000000 offset: 28 array: Yes
+[NO_PID]: ECPGget_data line 58: RESULT: 2369.7000000 offset: 28 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans line 74 action = rollback connection = regress1
+[NO_PID]: ECPGtrans line 82 action = rollback connection = regress1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ecpg_finish: Connection regress1 closed.
 [NO_PID]: sqlca: code: 0, state: 00000
index c8a5376d72e0258763a559a6388eebb77dafba81..52515ebde268e1c082f6e525a04d161036de6d24 100644 (file)
@@ -1,5 +1,6 @@
-long = 1407.0
+from int = 1407.0
 add = 2379.7
 sub = 2369.7
 mul = 13306998429.873000000
 div = 1330699.84298730000 1.330700e+06
+to long(0) = 20000000 14
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.c
new file mode 100644 (file)
index 0000000..241b250
--- /dev/null
@@ -0,0 +1,138 @@
+/* Processed by ecpg (4.2.1) */
+/* These include files are added by the preprocessor */
+#include <ecpgtype.h>
+#include <ecpglib.h>
+#include <ecpgerrno.h>
+#include <sqlca.h>
+/* End of automatic include section */
+
+#line 1 "num_test2.pgc"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_numeric.h>
+#include <pgtypes_error.h>
+#include <decimal.h>
+
+
+#line 1 "./../regression.h"
+
+
+
+
+
+
+#line 7 "num_test2.pgc"
+
+
+char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E07", "-32.84e4",
+                                "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
+                                ".500001", "-.5000001",
+                                NULL};
+
+
+static void
+check_errno(void);
+
+int
+main(void)
+{
+       char *text="error\n";
+       char *endptr;
+       numeric *num, *nin;
+       long l;
+       int i, r, k;
+       double d;
+
+       ECPGdebug(1, stderr);
+
+       for (i = 0; nums[i]; i++)
+       {
+               num = PGTYPESnumeric_from_asc(nums[i], &endptr);
+               check_errno();
+               if (endptr != NULL)
+                       printf("endptr of %d is not NULL\n", i);
+               if (*endptr != '\0')
+                       printf("*endptr of %d is not \\0\n", i);
+               text = PGTYPESnumeric_to_asc(num, -1);
+               check_errno();
+               printf("num[%d,1]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 0);
+               check_errno();
+               printf("num[%d,2]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 1);
+               check_errno();
+               printf("num[%d,3]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 2);
+               check_errno();
+               printf("num[%d,4]: %s\n", i, text); free(text);
+
+               nin = PGTYPESnumeric_new();
+               text = PGTYPESnumeric_to_asc(nin, 2);
+               check_errno();
+               printf("num[%d,5]: %s\n", i, text); free(text);
+
+               r = PGTYPESnumeric_to_long(num, &l);
+               check_errno();
+               printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_long(l, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,7]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               r = PGTYPESnumeric_to_int(num, &k);
+               check_errno();
+               printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_int(k, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,9]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               r = PGTYPESnumeric_to_double(num, &d);
+               check_errno();
+               printf("num[%d,10]: %2.7f (r: %d)\n", i, r?0.0:d, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_double(d, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,11]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               /* xxx decimal conversions still missing */
+               PGTYPESnumeric_free(nin);
+               printf("\n");
+       }
+
+       return (0);
+}
+
+static void
+check_errno(void)
+{
+       switch(errno)
+       {
+               case 0:
+                       printf("(no errno set) - ");
+                       break;
+               case PGTYPES_NUM_OVERFLOW:
+                       printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
+                       break;
+               case PGTYPES_NUM_BAD_NUMERIC:
+                       printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
+                       break;
+               default:
+                       printf("(unknown errno (%d))\n", errno);
+                       printf("(libc: (%s)) ", strerror(errno));
+                       break;
+       }
+
+}
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stderr
new file mode 100644 (file)
index 0000000..1a3639d
--- /dev/null
@@ -0,0 +1,2 @@
+[NO_PID]: ECPGdebug: set to 1
+[NO_PID]: sqlca: code: 0, state: 00000
diff --git a/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout b/src/interfaces/ecpg/test/expected/pgtypeslib-num_test2.stdout
new file mode 100644 (file)
index 0000000..567a5f9
--- /dev/null
@@ -0,0 +1,163 @@
+(no errno set) - endptr of 0 is not NULL
+(no errno set) - num[0,1]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+(no errno set) - num[0,2]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+(no errno set) - num[0,3]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0
+(no errno set) - num[0,4]: 20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00
+(no errno set) - num[0,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,8]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[0,10]: 0.0000000 (r: -1)
+
+(no errno set) - endptr of 1 is not NULL
+(no errno set) - num[1,1]: -2
+(no errno set) - num[1,2]: -2
+(no errno set) - num[1,3]: -2.0
+(no errno set) - num[1,4]: -2.00
+(no errno set) - num[1,5]: 0.00
+(no errno set) - num[1,6]: -2 (r: 0)
+(no errno set) - num[1,7]: -2.00 (cmp: 0)
+(no errno set) - num[1,8]: -2 (r: 0)
+(no errno set) - num[1,9]: -2.00 (cmp: 0)
+(no errno set) - num[1,10]: -2.0000000 (r: 0)
+(no errno set) - num[1,11]: -2.00 (cmp: 0)
+
+(no errno set) - endptr of 2 is not NULL
+(no errno set) - num[2,1]: 0.794
+(no errno set) - num[2,2]: 1
+(no errno set) - num[2,3]: 0.8
+(no errno set) - num[2,4]: 0.79
+(no errno set) - num[2,5]: 0.00
+(no errno set) - num[2,6]: 1 (r: 0)
+(no errno set) - num[2,7]: 1.00 (cmp: -1)
+(no errno set) - num[2,8]: 1 (r: 0)
+(no errno set) - num[2,9]: 1.00 (cmp: -1)
+(no errno set) - num[2,10]: 0.7940000 (r: 0)
+(no errno set) - num[2,11]: 0.79 (cmp: 0)
+
+(no errno set) - endptr of 3 is not NULL
+(no errno set) - num[3,1]: 3.44
+(no errno set) - num[3,2]: 3
+(no errno set) - num[3,3]: 3.4
+(no errno set) - num[3,4]: 3.44
+(no errno set) - num[3,5]: 0.00
+(no errno set) - num[3,6]: 3 (r: 0)
+(no errno set) - num[3,7]: 3.00 (cmp: 1)
+(no errno set) - num[3,8]: 3 (r: 0)
+(no errno set) - num[3,9]: 3.00 (cmp: 1)
+(no errno set) - num[3,10]: 3.4400000 (r: 0)
+(no errno set) - num[3,11]: 3.44 (cmp: 0)
+
+(no errno set) - endptr of 4 is not NULL
+(no errno set) - num[4,1]: 5924900000
+(no errno set) - num[4,2]: 5924900000
+(no errno set) - num[4,3]: 5924900000.0
+(no errno set) - num[4,4]: 5924900000.00
+(no errno set) - num[4,5]: 0.00
+(errno == PGTYPES_NUM_OVERFLOW) - num[4,6]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[4,8]: 0 (r: -1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[4,10]: 5924900000.0000000 (r: 0)
+(no errno set) - num[4,11]: 5924900000.00 (cmp: 0)
+
+(no errno set) - endptr of 5 is not NULL
+(no errno set) - num[5,1]: -328400
+(no errno set) - num[5,2]: -328400
+(no errno set) - num[5,3]: -328400.0
+(no errno set) - num[5,4]: -328400.00
+(no errno set) - num[5,5]: 0.00
+(no errno set) - num[5,6]: -328400 (r: 0)
+(no errno set) - num[5,7]: -328400.00 (cmp: 0)
+(no errno set) - num[5,8]: -328400 (r: 0)
+(no errno set) - num[5,9]: -328400.00 (cmp: 0)
+(no errno set) - num[5,10]: -328400.0000000 (r: 0)
+(no errno set) - num[5,11]: -328400.00 (cmp: 0)
+
+(no errno set) - endptr of 6 is not NULL
+(no errno set) - num[6,1]: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
+(no errno set) - num[6,2]: 0
+(no errno set) - num[6,3]: 0.0
+(no errno set) - num[6,4]: 0.00
+(no errno set) - num[6,5]: 0.00
+(no errno set) - num[6,6]: 0 (r: 0)
+(no errno set) - num[6,7]: 0.00 (cmp: 1)
+(no errno set) - num[6,8]: 0 (r: 0)
+(no errno set) - num[6,9]: 0.00 (cmp: 1)
+(errno == PGTYPES_NUM_OVERFLOW) - num[6,10]: 0.0000000 (r: -1)
+
+(no errno set) - endptr of 7 is not NULL
+(no errno set) - num[7,1]: 0.001
+(no errno set) - num[7,2]: 0
+(no errno set) - num[7,3]: 0.0
+(no errno set) - num[7,4]: 0.00
+(no errno set) - num[7,5]: 0.00
+(no errno set) - num[7,6]: 0 (r: 0)
+(no errno set) - num[7,7]: 0.00 (cmp: 1)
+(no errno set) - num[7,8]: 0 (r: 0)
+(no errno set) - num[7,9]: 0.00 (cmp: 1)
+(no errno set) - num[7,10]: 0.0010000 (r: 0)
+(no errno set) - num[7,11]: 0.00 (cmp: 0)
+
+(no errno set) - endptr of 8 is not NULL
+(no errno set) - num[8,1]: 0.0
+(no errno set) - num[8,2]: 0
+(no errno set) - num[8,3]: 0.0
+(no errno set) - num[8,4]: 0.00
+(no errno set) - num[8,5]: 0.00
+(no errno set) - num[8,6]: 0 (r: 0)
+(no errno set) - num[8,7]: 0.00 (cmp: 0)
+(no errno set) - num[8,8]: 0 (r: 0)
+(no errno set) - num[8,9]: 0.00 (cmp: 0)
+(no errno set) - num[8,10]: 0.0000000 (r: 0)
+(no errno set) - num[8,11]: 0.00 (cmp: 0)
+
+(no errno set) - endptr of 9 is not NULL
+(no errno set) - num[9,1]: -0.000059249
+(no errno set) - num[9,2]: -0
+(no errno set) - num[9,3]: -0.0
+(no errno set) - num[9,4]: -0.00
+(no errno set) - num[9,5]: 0.00
+(no errno set) - num[9,6]: 0 (r: 0)
+(no errno set) - num[9,7]: 0.00 (cmp: -1)
+(no errno set) - num[9,8]: 0 (r: 0)
+(no errno set) - num[9,9]: 0.00 (cmp: -1)
+(no errno set) - num[9,10]: -0.0000592 (r: 0)
+(no errno set) - num[9,11]: -0.00 (cmp: -1)
+
+(no errno set) - endptr of 10 is not NULL
+(no errno set) - num[10,1]: 0.003284
+(no errno set) - num[10,2]: 0
+(no errno set) - num[10,3]: 0.0
+(no errno set) - num[10,4]: 0.00
+(no errno set) - num[10,5]: 0.00
+(no errno set) - num[10,6]: 0 (r: 0)
+(no errno set) - num[10,7]: 0.00 (cmp: 1)
+(no errno set) - num[10,8]: 0 (r: 0)
+(no errno set) - num[10,9]: 0.00 (cmp: 1)
+(no errno set) - num[10,10]: 0.0032840 (r: 0)
+(no errno set) - num[10,11]: 0.00 (cmp: 0)
+
+(no errno set) - endptr of 11 is not NULL
+(no errno set) - num[11,1]: 0.500001
+(no errno set) - num[11,2]: 1
+(no errno set) - num[11,3]: 0.5
+(no errno set) - num[11,4]: 0.50
+(no errno set) - num[11,5]: 0.00
+(no errno set) - num[11,6]: 1 (r: 0)
+(no errno set) - num[11,7]: 1.00 (cmp: -1)
+(no errno set) - num[11,8]: 1 (r: 0)
+(no errno set) - num[11,9]: 1.00 (cmp: -1)
+(no errno set) - num[11,10]: 0.5000010 (r: 0)
+(no errno set) - num[11,11]: 0.50 (cmp: 0)
+
+(no errno set) - endptr of 12 is not NULL
+(no errno set) - num[12,1]: -0.5000001
+(no errno set) - num[12,2]: -1
+(no errno set) - num[12,3]: -0.5
+(no errno set) - num[12,4]: -0.50
+(no errno set) - num[12,5]: 0.00
+(no errno set) - num[12,6]: -1 (r: 0)
+(no errno set) - num[12,7]: -1.00 (cmp: 1)
+(no errno set) - num[12,8]: -1 (r: 0)
+(no errno set) - num[12,9]: -1.00 (cmp: 1)
+(no errno set) - num[12,10]: -0.5000001 (r: 0)
+(no errno set) - num[12,11]: -0.50 (cmp: -1)
+
index 38fde0cfa848747acc3df6aa5146e2d6f479ed6a..086dfc3c4f02f7bd93669c50361ace2d848331de 100644 (file)
@@ -162,7 +162,6 @@ int main(int argc,char **argv)
    
    
    
-   
 
 #line 20 "dyntest2.pgc"
  int  COUNT    ;
@@ -189,61 +188,77 @@ int main(int argc,char **argv)
  char  STRINGVAR [ 1024 ]    ;
  
 #line 28 "dyntest2.pgc"
- float  FLOATVAR    ;
-#line 29 "dyntest2.pgc"
  double  DOUBLEVAR    ;
  
-#line 30 "dyntest2.pgc"
+#line 29 "dyntest2.pgc"
  char * QUERY    ;
 /* exec sql end declare section */
-#line 31 "dyntest2.pgc"
+#line 30 "dyntest2.pgc"
 
   int done=0;
 
   /* exec sql var BOOLVAR is bool   */
-#line 34 "dyntest2.pgc"
+#line 33 "dyntest2.pgc"
 
 
   ECPGdebug(1, stderr);
 
-  QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite order by rulename limit 2";
+  QUERY="select * from dyntest";
 
   /* exec sql whenever sqlerror  do error (  ) ; */
-#line 40 "dyntest2.pgc"
+#line 39 "dyntest2.pgc"
 
 
   ECPGallocate_desc(__LINE__, "MYDESC");
-#line 42 "dyntest2.pgc"
+#line 41 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );
-#line 42 "dyntest2.pgc"
+#line 41 "dyntest2.pgc"
 
 
   { ECPGconnect(__LINE__, 0, "regress1" , NULL,NULL , NULL, 0); 
-#line 44 "dyntest2.pgc"
+#line 43 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 44 "dyntest2.pgc"
+#line 43 "dyntest2.pgc"
 
 
-  { ECPGprepare(__LINE__, "MYQUERY" , QUERY);
+  { ECPGdo(__LINE__, 0, 1, NULL, "create  table dyntest ( name char  ( 14 )    , d float8   , i int   , bignumber int8   , b boolean   , comment text   , day date   )    ", ECPGt_EOIT, ECPGt_EORT);
+#line 45 "dyntest2.pgc"
+
+if (sqlca.sqlcode < 0) error (  );}
+#line 45 "dyntest2.pgc"
+
+  { ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' )", ECPGt_EOIT, ECPGt_EORT);
 #line 46 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
 #line 46 "dyntest2.pgc"
 
-  /* declare MYCURS  cursor  for ? */
+  { ECPGdo(__LINE__, 0, 1, NULL, "insert into dyntest values( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' )", ECPGt_EOIT, ECPGt_EORT);
+#line 47 "dyntest2.pgc"
+
+if (sqlca.sqlcode < 0) error (  );}
 #line 47 "dyntest2.pgc"
 
 
+  { ECPGprepare(__LINE__, "MYQUERY" , QUERY);
+#line 49 "dyntest2.pgc"
+
+if (sqlca.sqlcode < 0) error (  );}
+#line 49 "dyntest2.pgc"
+
+  /* declare MYCURS  cursor  for ? */
+#line 50 "dyntest2.pgc"
+
+
   { ECPGdo(__LINE__, 0, 1, NULL, "declare MYCURS  cursor  for ?", 
        ECPGt_char_variable,(ECPGprepared_statement("MYQUERY")),(long)1,(long)1,(1)*sizeof(char), 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT);
-#line 49 "dyntest2.pgc"
+#line 52 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 49 "dyntest2.pgc"
+#line 52 "dyntest2.pgc"
 
 
   while (1)
@@ -251,20 +266,20 @@ if (sqlca.sqlcode < 0) error (  );}
      { ECPGdo(__LINE__, 0, 1, NULL, "fetch in MYCURS", ECPGt_EOIT, 
        ECPGt_descriptor, "MYDESC", 0L, 0L, 0L, 
        ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);
-#line 53 "dyntest2.pgc"
+#line 56 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 53 "dyntest2.pgc"
+#line 56 "dyntest2.pgc"
 
 
      if (sqlca.sqlcode) break;
 
      { ECPGget_desc_header(__LINE__, "MYDESC", &(COUNT));
 
-#line 57 "dyntest2.pgc"
+#line 60 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 57 "dyntest2.pgc"
+#line 60 "dyntest2.pgc"
 
      if (!done)
      {
@@ -274,7 +289,7 @@ if (sqlca.sqlcode < 0) error (  );}
 
      for (INDEX=1;INDEX<=COUNT;++INDEX)
      {
-       /* :NULLABLE=nullable, */{ ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_indicator,
+       { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_indicator,
        ECPGt_int,&(INDICATOR),(long)1,(long)1,sizeof(int), ECPGd_name,
        ECPGt_char,(NAME),(long)120,(long)1,(120)*sizeof(char), ECPGd_scale,
        ECPGt_int,&(SCALE),(long)1,(long)1,sizeof(int), ECPGd_precision,
@@ -284,15 +299,15 @@ if (sqlca.sqlcode < 0) error (  );}
        ECPGt_int,&(LENGTH),(long)1,(long)1,sizeof(int), ECPGd_type,
        ECPGt_int,&(TYPE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
 
-#line 72 "dyntest2.pgc"
+#line 74 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 72 "dyntest2.pgc"
+#line 74 "dyntest2.pgc"
 
        printf("%2d\t%s (type: %d length: %d precision: %d scale: %d\n"
                "\toctet_length: %d returned_octet_length: %d)\n\t= "
                        ,INDEX,NAME,TYPE,LENGTH,PRECISION,SCALE
-                       ,OCTET_LENGTH,RETURNED_OCTET_LENGTH /* ,NULLABLE */);
+                       ,OCTET_LENGTH,RETURNED_OCTET_LENGTH);
        if (INDICATOR==-1) printf("NULL\n");
         else switch (TYPE)
        {
@@ -300,72 +315,33 @@ if (sqlca.sqlcode < 0) error (  );}
                { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
        ECPGt_bool,&(BOOLVAR),(long)1,(long)1,sizeof(bool), ECPGd_EODT);
 
-#line 81 "dyntest2.pgc"
+#line 83 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 81 "dyntest2.pgc"
+#line 83 "dyntest2.pgc"
 
                printf("%s\n",BOOLVAR ? "true":"false");
                break;
-          case SQL3_NUMERIC:
-          case SQL3_DECIMAL:
-               if (SCALE==0)
-               {
-                  { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
-       ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
-
-#line 88 "dyntest2.pgc"
-
-if (sqlca.sqlcode < 0) error (  );}
-#line 88 "dyntest2.pgc"
-
-                  printf("%d\n",INTVAR);
-               }
-               else
-               {
-                  { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
-       ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
-
-#line 93 "dyntest2.pgc"
-
-if (sqlca.sqlcode < 0) error (  );}
-#line 93 "dyntest2.pgc"
-
-                  printf("%.*f\n",SCALE,FLOATVAR);
-               }
-               break;
           case SQL3_INTEGER:
           case SQL3_SMALLINT:
                { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
        ECPGt_int,&(INTVAR),(long)1,(long)1,sizeof(int), ECPGd_EODT);
 
-#line 99 "dyntest2.pgc"
+#line 88 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 99 "dyntest2.pgc"
+#line 88 "dyntest2.pgc"
 
                printf("%d\n",INTVAR);
                break;
-          case SQL3_FLOAT:
-          case SQL3_REAL:
-               { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
-       ECPGt_float,&(FLOATVAR),(long)1,(long)1,sizeof(float), ECPGd_EODT);
-
-#line 104 "dyntest2.pgc"
-
-if (sqlca.sqlcode < 0) error (  );}
-#line 104 "dyntest2.pgc"
-
-               printf("%.*f\n",PRECISION,FLOATVAR);
-               break;
           case SQL3_DOUBLE_PRECISION:
                { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
        ECPGt_double,&(DOUBLEVAR),(long)1,(long)1,sizeof(double), ECPGd_EODT);
 
-#line 108 "dyntest2.pgc"
+#line 92 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 108 "dyntest2.pgc"
+#line 92 "dyntest2.pgc"
 
                printf("%.*f\n",PRECISION,DOUBLEVAR);
                break;
@@ -374,33 +350,22 @@ if (sqlca.sqlcode < 0) error (  );}
        ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_di_code,
        ECPGt_int,&(DATETIME_INTERVAL_CODE),(long)1,(long)1,sizeof(int), ECPGd_EODT);
 
-#line 114 "dyntest2.pgc"
+#line 98 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 114 "dyntest2.pgc"
+#line 98 "dyntest2.pgc"
 
                printf("%d \"%s\"\n",DATETIME_INTERVAL_CODE,STRINGVAR);
                break;
-          case SQL3_INTERVAL:
-               { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
-       ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
-
-#line 118 "dyntest2.pgc"
-
-if (sqlca.sqlcode < 0) error (  );}
-#line 118 "dyntest2.pgc"
-
-               printf("\"%s\"\n",STRINGVAR);
-               break;
           case SQL3_CHARACTER:
           case SQL3_CHARACTER_VARYING:
                { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
        ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
 
-#line 123 "dyntest2.pgc"
+#line 103 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 123 "dyntest2.pgc"
+#line 103 "dyntest2.pgc"
 
                printf("\"%s\"\n",STRINGVAR);
                break;
@@ -408,10 +373,10 @@ if (sqlca.sqlcode < 0) error (  );}
                { ECPGget_desc(__LINE__, "MYDESC", INDEX,ECPGd_data,
        ECPGt_char,(STRINGVAR),(long)1024,(long)1,(1024)*sizeof(char), ECPGd_EODT);
 
-#line 127 "dyntest2.pgc"
+#line 107 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 127 "dyntest2.pgc"
+#line 107 "dyntest2.pgc"
 
                printf("<\"%s\">\n",STRINGVAR);
                break;
@@ -420,17 +385,17 @@ if (sqlca.sqlcode < 0) error (  );}
   }
 
   { ECPGdo(__LINE__, 0, 1, NULL, "close MYCURS", ECPGt_EOIT, ECPGt_EORT);
-#line 134 "dyntest2.pgc"
+#line 114 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );}
-#line 134 "dyntest2.pgc"
+#line 114 "dyntest2.pgc"
 
 
   ECPGdeallocate_desc(__LINE__, "MYDESC");
-#line 136 "dyntest2.pgc"
+#line 116 "dyntest2.pgc"
 
 if (sqlca.sqlcode < 0) error (  );
-#line 136 "dyntest2.pgc"
+#line 116 "dyntest2.pgc"
 
 
   return 0;
index dd04de2727850792619f3747285fbc982534c963..035f222d9e029cebc26e1c8ae4cd53362f716e35 100644 (file)
@@ -2,67 +2,79 @@
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> 
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGprepare line 46: QUERY: select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite order by rulename limit 2
+[NO_PID]: ECPGexecute line 45: QUERY: create  table dyntest ( name char  ( 14 )    , d float8   , i int   , bignumber int8   , b boolean   , comment text   , day date   )     on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49: QUERY: declare MYCURS  cursor  for select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite order by rulename limit 2 on connection regress1
+[NO_PID]: ECPGexecute line 45 Ok: CREATE TABLE
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 49 Ok: DECLARE CURSOR
+[NO_PID]: ECPGexecute line 46: QUERY: insert into dyntest values( 'first entry' , 14.7 , 14 , 123045607890 , true , 'The world''s most advanced open source database.' , '1987-07-14' ) on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 46 Ok: INSERT 0 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 6 fields
+[NO_PID]: ECPGexecute line 47: QUERY: insert into dyntest values( 'second entry' , 1407.87 , 1407 , 987065403210 , false , 'The elephant never forgets.' , '1999-11-5' ) on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 47 Ok: INSERT 0 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGprepare line 49: QUERY: select * from dyntest
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52: QUERY: declare MYCURS  cursor  for select * from dyntest on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 52 Ok: DECLARE CURSOR
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 56: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGexecute line 56: Correctly got 1 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute putting result (1 tuples) into descriptor 'MYDESC'
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc_header: found 6 attributes.
+[NO_PID]: ECPGget_desc_header: found 7 attributes.
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = rulename
+[NO_PID]: ECPGget_desc: NAME = name
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: ECPGget_desc: SCALE = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: ECPGget_desc: PRECISION = 0
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 7
+[NO_PID]: ECPGget_desc: RETURNED[0] = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 64
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: ECPGget_desc: LENGTH = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -19
+[NO_PID]: ECPGget_desc: TYPE = 1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: _RETURN offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 103: RESULT: first entry    offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_class
+[NO_PID]: ECPGget_desc: NAME = d
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 5
+[NO_PID]: ECPGget_desc: RETURNED[0] = 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -26
+[NO_PID]: ECPGget_desc: TYPE = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: 10297 offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 92: RESULT: 14.7 offset: 8 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_attr
+[NO_PID]: ECPGget_desc: NAME = i
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: RETURNED[0] = 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 2
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = 5
+[NO_PID]: ECPGget_desc: TYPE = 4
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 99: RESULT: -1 offset: 4 array: Yes
+[NO_PID]: ECPGget_data line 88: RESULT: 14 offset: 4 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_type
+[NO_PID]: ECPGget_desc: NAME = bignumber
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 1
+[NO_PID]: ECPGget_desc: RETURNED[0] = 12
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 1
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -18
+[NO_PID]: ECPGget_desc: TYPE = -20
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: 1 offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 107: RESULT: 123045607890 offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = is_instead
+[NO_PID]: ECPGget_desc: NAME = b
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 81: RESULT: t offset: 1 array: Yes
+[NO_PID]: ECPGget_data line 83: RESULT: t offset: 1 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_qual
+[NO_PID]: ECPGget_desc: NAME = comment
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 2
+[NO_PID]: ECPGget_desc: RETURNED[0] = 47
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 123: RESULT: <> offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 103: RESULT: The world's most advanced open source database. offset: 1024 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = day
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 10
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 96: RESULT: 07-14-1987 offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 56: QUERY: fetch in MYCURS on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 1 tuples with 6 fields
+[NO_PID]: ECPGexecute line 56: Correctly got 1 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGexecute putting result (1 tuples) into descriptor 'MYDESC'
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc_header: found 6 attributes.
+[NO_PID]: ECPGget_desc_header: found 7 attributes.
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = rulename
+[NO_PID]: ECPGget_desc: NAME = name
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: ECPGget_desc: SCALE = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: ECPGget_desc: PRECISION = 0
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 7
+[NO_PID]: ECPGget_desc: RETURNED[0] = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 64
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: ECPGget_desc: LENGTH = 14
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -19
+[NO_PID]: ECPGget_desc: TYPE = 1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: _RETURN offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 103: RESULT: second entry   offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_class
+[NO_PID]: ECPGget_desc: NAME = d
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 5
+[NO_PID]: ECPGget_desc: RETURNED[0] = 7
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -26
+[NO_PID]: ECPGget_desc: TYPE = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 2
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: 10300 offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 92: RESULT: 1407.87 offset: 8 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_attr
+[NO_PID]: ECPGget_desc: NAME = i
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 2
+[NO_PID]: ECPGget_desc: RETURNED[0] = 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 2
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = 5
+[NO_PID]: ECPGget_desc: TYPE = 4
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 3
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 99: RESULT: -1 offset: 4 array: Yes
+[NO_PID]: ECPGget_data line 88: RESULT: 1407 offset: 4 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_type
+[NO_PID]: ECPGget_desc: NAME = bignumber
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 1
+[NO_PID]: ECPGget_desc: RETURNED[0] = 12
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: OCTET_LENGTH = 1
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 8
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: LENGTH = -5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: TYPE = -18
+[NO_PID]: ECPGget_desc: TYPE = -20
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: INDICATOR[0] = 0
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 4
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 127: RESULT: 1 offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 107: RESULT: 987065403210 offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = is_instead
+[NO_PID]: ECPGget_desc: NAME = b
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 5
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 81: RESULT: t offset: 1 array: Yes
+[NO_PID]: ECPGget_data line 83: RESULT: f offset: 1 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: NAME = ev_qual
+[NO_PID]: ECPGget_desc: NAME = comment
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: SCALE = 65531
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: PRECISION = -1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_desc: RETURNED[0] = 2
+[NO_PID]: ECPGget_desc: RETURNED[0] = 27
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: OCTET_LENGTH = -1
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: sqlca: code: 0, state: 00000
 [NO_PID]: ECPGget_desc: reading items for tuple 6
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGget_data line 123: RESULT: <> offset: 1024 array: Yes
+[NO_PID]: ECPGget_data line 103: RESULT: The elephant never forgets. offset: 1024 array: Yes
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: NAME = day
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: SCALE = 65531
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: PRECISION = -1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: RETURNED[0] = 10
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: OCTET_LENGTH = 4
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: LENGTH = -5
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 9
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: INDICATOR[0] = 0
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: reading items for tuple 7
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_desc: TYPE = 1
+[NO_PID]: sqlca: code: 0, state: 00000
+[NO_PID]: ECPGget_data line 96: RESULT: 11-05-1999 offset: 1024 array: Yes
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: QUERY: fetch in MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 56: QUERY: fetch in MYCURS on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 53: Correctly got 0 tuples with 6 fields
+[NO_PID]: ECPGexecute line 56: Correctly got 0 tuples with 7 fields
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode 100 in line 53, 'No data found in line 53.'.
+[NO_PID]: raising sqlcode 100 in line 56, 'No data found in line 56.'.
 [NO_PID]: sqlca: code: 100, state: 02000
-[NO_PID]: ECPGexecute line 134: QUERY: close MYCURS on connection regress1
+[NO_PID]: ECPGexecute line 114: QUERY: close MYCURS on connection regress1
 [NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGexecute line 134 Ok: CLOSE CURSOR
+[NO_PID]: ECPGexecute line 114 Ok: CLOSE CURSOR
 [NO_PID]: sqlca: code: 0, state: 00000
index 85c7de5b4942712a36819ea6bf36730e1f5c0b05..52d242f315f7dedb18f666b1718e65d3f5356134 100644 (file)
@@ -1,37 +1,43 @@
-Count 6
- 1     rulename (type: -19 length: -5 precision: -1 scale: 65531
-       octet_length: 64 returned_octet_length: 7)
-       = <"_RETURN">
- 2     ev_class (type: -26 length: -5 precision: -1 scale: 65531
-       octet_length: 4 returned_octet_length: 5)
-       = <"10297">
- 3     ev_attr (type: 5 length: -5 precision: -1 scale: 65531
-       octet_length: 2 returned_octet_length: 2)
-       = -1
- 4     ev_type (type: -18 length: -5 precision: -1 scale: 65531
-       octet_length: 1 returned_octet_length: 1)
-       = <"1">
- 5     is_instead (type: 16 length: -5 precision: -1 scale: 65531
+Count 7
+ 1     name (type: 1 length: 14 precision: 0 scale: 14
+       octet_length: -1 returned_octet_length: 14)
+       = "first entry   "
+ 2     d (type: 8 length: -5 precision: -1 scale: 65531
+       octet_length: 8 returned_octet_length: 4)
+       = 14.700000
+ 3     i (type: 4 length: -5 precision: -1 scale: 65531
+       octet_length: 4 returned_octet_length: 2)
+       = 14
+ 4     bignumber (type: -20 length: -5 precision: -1 scale: 65531
+       octet_length: 8 returned_octet_length: 12)
+       = <"123045607890">
+ 5     b (type: 16 length: -5 precision: -1 scale: 65531
        octet_length: 1 returned_octet_length: 1)
        = true
- 6     ev_qual (type: 1 length: -5 precision: -1 scale: 65531
-       octet_length: -1 returned_octet_length: 2)
-       = "<>"
- 1     rulename (type: -19 length: -5 precision: -1 scale: 65531
-       octet_length: 64 returned_octet_length: 7)
-       = <"_RETURN">
- 2     ev_class (type: -26 length: -5 precision: -1 scale: 65531
-       octet_length: 4 returned_octet_length: 5)
-       = <"10300">
- 3     ev_attr (type: 5 length: -5 precision: -1 scale: 65531
-       octet_length: 2 returned_octet_length: 2)
-       = -1
- 4     ev_type (type: -18 length: -5 precision: -1 scale: 65531
-       octet_length: 1 returned_octet_length: 1)
-       = <"1">
- 5     is_instead (type: 16 length: -5 precision: -1 scale: 65531
+ 6     comment (type: 1 length: -5 precision: -1 scale: 65531
+       octet_length: -1 returned_octet_length: 47)
+       = "The world's most advanced open source database."
+ 7     day (type: 9 length: -5 precision: -1 scale: 65531
+       octet_length: 4 returned_octet_length: 10)
+       = 1 "07-14-1987"
+ 1     name (type: 1 length: 14 precision: 0 scale: 14
+       octet_length: -1 returned_octet_length: 14)
+       = "second entry  "
+ 2     d (type: 8 length: -5 precision: -1 scale: 65531
+       octet_length: 8 returned_octet_length: 7)
+       = 1407.870000
+ 3     i (type: 4 length: -5 precision: -1 scale: 65531
+       octet_length: 4 returned_octet_length: 4)
+       = 1407
+ 4     bignumber (type: -20 length: -5 precision: -1 scale: 65531
+       octet_length: 8 returned_octet_length: 12)
+       = <"987065403210">
+ 5     b (type: 16 length: -5 precision: -1 scale: 65531
        octet_length: 1 returned_octet_length: 1)
        = true
- 6     ev_qual (type: 1 length: -5 precision: -1 scale: 65531
-       octet_length: -1 returned_octet_length: 2)
-       = "<>"
+ 6     comment (type: 1 length: -5 precision: -1 scale: 65531
+       octet_length: -1 returned_octet_length: 27)
+       = "The elephant never forgets."
+ 7     day (type: 9 length: -5 precision: -1 scale: 65531
+       octet_length: 4 returned_octet_length: 10)
+       = 1 "11-05-1999"
index d019a35d88c3c8732943058ca89fd325f7045d0c..5b6901fa167da2d3b970e9460bb05b7f12d43560 100644 (file)
@@ -5,7 +5,8 @@ include ../Makefile.regress
 
 TESTS = dt_test dt_test.c \
         dt_test2 dt_test2.c \
-        num_test num_test.c
+        num_test num_test.c \
+        num_test2 num_test2.c
 
 all: $(TESTS)
 
index 20a42b509ef78cc8768eb3b30b7edd4b81b9522b..51dcf37f904d1eaf688912f1dd2d00c0e27f0568 100644 (file)
@@ -13,7 +13,7 @@ main(void)
        exec sql begin declare section;
                date date1;
                timestamp ts1;
-               interval iv1;
+               interval *iv1, iv2;
                char *text;
        exec sql end declare section;
        date date2;
@@ -26,15 +26,15 @@ main(void)
         ECPGdebug(1, stderr);
         exec sql whenever sqlerror do sqlprint();
         exec sql connect to REGRESSDB1;
-        exec sql create table date_test (d date, ts timestamp, iv interval);
+        exec sql create table date_test (d date, ts timestamp);
        exec sql set datestyle to iso;
 
        date1 = PGTYPESdate_from_asc(d1, NULL); 
        ts1 = PGTYPEStimestamp_from_asc(t1, NULL); 
 
-       exec sql insert into date_test(d, ts, iv) values (:date1, :ts1, '2003-02-28 12:34'::timestamp-'Mon Jan 17 1966'::timestamp);
+       exec sql insert into date_test(d, ts) values (:date1, :ts1);
 
-       exec sql select * into :date1, :ts1 , :iv1 from date_test where d=:date1;
+       exec sql select * into :date1, :ts1 from date_test where d=:date1;
 
        text = PGTYPESdate_to_asc(date1);
        printf ("Date: %s\n", text);
@@ -44,7 +44,9 @@ main(void)
        printf ("timestamp: %s\n", text);
        free(text);
 
-       text = PGTYPESinterval_to_asc(&iv1);
+       iv1 = PGTYPESinterval_from_asc("13556 days 12 hours 34 minutes 14 seconds ", NULL);
+       PGTYPESinterval_copy(iv1, &iv2);
+       text = PGTYPESinterval_to_asc(&iv2);
        printf ("interval: %s\n", text);
        free(text);
 
@@ -61,11 +63,6 @@ main(void)
        ts1 = PGTYPEStimestamp_from_asc("2003-12-04 17:34:29", NULL);
        text = PGTYPEStimestamp_to_asc(ts1);
        printf("date_day of %s is %d\n", text, PGTYPESdate_dayofweek(ts1));
-
-       PGTYPESdate_today(&date1);
-       /* can't output this in regression mode */
-
-       printf("using date %s\n", text);
        free(text);
 
        fmt = "(ddd), mmm. dd, yyyy, repeat: (ddd), mmm. dd, yyyy. end";
index 7f50e4773b998c47260d3f27dbafd82a0ba5d40f..e3522fb736c5cf461515e7447e3087ee2d7c4adb 100644 (file)
@@ -15,6 +15,8 @@ main(void)
                /* = {0, 0, 0, 0, 0, NULL, NULL} ; */
        exec sql end declare section;
        double d;
+       long l1, l2;
+       int i;
 
        ECPGdebug(1, stderr);
        exec sql whenever sqlerror do sqlprint();
@@ -27,7 +29,7 @@ main(void)
        value1 = PGTYPESnumeric_new();
        PGTYPESnumeric_from_int(1407, value1);
        text = PGTYPESnumeric_to_asc(value1, -1);
-       printf("long = %s\n", text);
+       printf("from int = %s\n", text);
        free(text);
        PGTYPESnumeric_free(value1);
 
@@ -66,6 +68,12 @@ main(void)
        text = PGTYPESnumeric_to_asc(res, -1);
        PGTYPESnumeric_to_double(res, &d);
        printf("div = %s %e\n", text, d);
+
+       value1 = PGTYPESnumeric_from_asc("2E7", NULL);
+       value2 = PGTYPESnumeric_from_asc("14", NULL);
+       i = PGTYPESnumeric_to_long(value1, &l1) | PGTYPESnumeric_to_long(value2, &l2);
+       printf("to long(%d) = %ld %ld\n", i, l1, l2);
+
        free(text);
        PGTYPESnumeric_free(value1);
        PGTYPESnumeric_free(value2);
diff --git a/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc b/src/interfaces/ecpg/test/pgtypeslib/num_test2.pgc
new file mode 100644 (file)
index 0000000..1b9f5fe
--- /dev/null
@@ -0,0 +1,120 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <pgtypes_numeric.h>
+#include <pgtypes_error.h>
+#include <decimal.h>
+
+exec sql include ../regression;
+
+char* nums[] = { "2E394", "-2", ".794", "3.44", "592.49E07", "-32.84e4",
+                                "2E-394", ".1E-2", "+.0", "-592.49E-07", "+32.84e-4",
+                                ".500001", "-.5000001",
+                                NULL};
+
+
+static void
+check_errno(void);
+
+int
+main(void)
+{
+       char *text="error\n";
+       char *endptr;
+       numeric *num, *nin;
+       long l;
+       int i, r, k;
+       double d;
+
+       ECPGdebug(1, stderr);
+
+       for (i = 0; nums[i]; i++)
+       {
+               num = PGTYPESnumeric_from_asc(nums[i], &endptr);
+               check_errno();
+               if (endptr != NULL)
+                       printf("endptr of %d is not NULL\n", i);
+               if (*endptr != '\0')
+                       printf("*endptr of %d is not \\0\n", i);
+               text = PGTYPESnumeric_to_asc(num, -1);
+               check_errno();
+               printf("num[%d,1]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 0);
+               check_errno();
+               printf("num[%d,2]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 1);
+               check_errno();
+               printf("num[%d,3]: %s\n", i, text); free(text);
+               text = PGTYPESnumeric_to_asc(num, 2);
+               check_errno();
+               printf("num[%d,4]: %s\n", i, text); free(text);
+
+               nin = PGTYPESnumeric_new();
+               text = PGTYPESnumeric_to_asc(nin, 2);
+               check_errno();
+               printf("num[%d,5]: %s\n", i, text); free(text);
+
+               r = PGTYPESnumeric_to_long(num, &l);
+               check_errno();
+               printf("num[%d,6]: %ld (r: %d)\n", i, r?0L:l, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_long(l, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,7]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               r = PGTYPESnumeric_to_int(num, &k);
+               check_errno();
+               printf("num[%d,8]: %d (r: %d)\n", i, r?0:k, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_int(k, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,9]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               r = PGTYPESnumeric_to_double(num, &d);
+               check_errno();
+               printf("num[%d,10]: %2.7f (r: %d)\n", i, r?0.0:d, r);
+               if (r == 0)
+               {
+                       r = PGTYPESnumeric_from_double(d, nin);
+                       check_errno();
+                       text = PGTYPESnumeric_to_asc(nin, 2);
+                       r = PGTYPESnumeric_cmp(num, nin);
+                       printf("num[%d,11]: %s (cmp: %d)\n", i, text, r); free(text);
+               }
+
+               /* xxx decimal conversions still missing */
+               PGTYPESnumeric_free(nin);
+               printf("\n");
+       }
+
+       return (0);
+}
+
+static void
+check_errno(void)
+{
+       switch(errno)
+       {
+               case 0:
+                       printf("(no errno set) - ");
+                       break;
+               case PGTYPES_NUM_OVERFLOW:
+                       printf("(errno == PGTYPES_NUM_OVERFLOW) - ");
+                       break;
+               case PGTYPES_NUM_BAD_NUMERIC:
+                       printf("(errno == PGTYPES_NUM_BAD_NUMERIC) - ");
+                       break;
+               default:
+                       printf("(unknown errno (%d))\n", errno);
+                       printf("(libc: (%s)) ", strerror(errno));
+                       break;
+       }
+
+}
index 207b86805de7813bfd5b9dcfd7348ccbbb28961c..d3bd9d0a07382e2ec62d34afd5219843c32c883a 100644 (file)
@@ -25,7 +25,6 @@ exec sql begin declare section;
   int DATETIME_INTERVAL_CODE;
   char NAME[120];
   char STRINGVAR[1024];
-  float FLOATVAR;
   double DOUBLEVAR;
   char *QUERY;
 exec sql end declare section;
@@ -35,7 +34,7 @@ exec sql end declare section;
 
   ECPGdebug(1, stderr);
 
-  QUERY="select rulename, ev_class, ev_attr, ev_type, is_instead, ev_qual from pg_rewrite order by rulename limit 2";
+  QUERY="select * from dyntest";
 
   exec sql whenever sqlerror do error();
 
@@ -43,6 +42,10 @@ exec sql end declare section;
 
   exec sql connect to REGRESSDB1;
 
+  exec sql create table dyntest (name char(14), d float8, i int, bignumber int8, b boolean, comment text, day date);
+  exec sql insert into dyntest values('first entry', 14.7, 14, 123045607890, true, 'The world''''s most advanced open source database.', '1987-07-14');
+  exec sql insert into dyntest values('second entry', 1407.87, 1407, 987065403210, false, 'The elephant never forgets.', '1999-11-5');
+
   exec sql prepare MYQUERY from :QUERY;
   exec sql declare MYCURS cursor for MYQUERY;
 
@@ -68,12 +71,11 @@ exec sql end declare section;
                :LENGTH = length, :OCTET_LENGTH=octet_length,
                :RETURNED_OCTET_LENGTH=returned_octet_length,
                :PRECISION = precision, :SCALE=scale,
-               /* :NULLABLE=nullable, */ :NAME=name,
-               :INDICATOR=indicator;
+               :NAME=name, :INDICATOR=indicator;
        printf("%2d\t%s (type: %d length: %d precision: %d scale: %d\n"
                "\toctet_length: %d returned_octet_length: %d)\n\t= "
                        ,INDEX,NAME,TYPE,LENGTH,PRECISION,SCALE
-                       ,OCTET_LENGTH,RETURNED_OCTET_LENGTH /* ,NULLABLE */);
+                       ,OCTET_LENGTH,RETURNED_OCTET_LENGTH);
        if (INDICATOR==-1) printf("NULL\n");
         else switch (TYPE)
        {
@@ -81,29 +83,11 @@ exec sql end declare section;
                exec sql get descriptor MYDESC value :INDEX :BOOLVAR=data;
                printf("%s\n",BOOLVAR ? "true":"false");
                break;
-          case SQL3_NUMERIC:
-          case SQL3_DECIMAL:
-               if (SCALE==0)
-               {
-                  exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
-                  printf("%d\n",INTVAR);
-               }
-               else
-               {
-                  exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
-                  printf("%.*f\n",SCALE,FLOATVAR);
-               }
-               break;
           case SQL3_INTEGER:
           case SQL3_SMALLINT:
                exec sql get descriptor MYDESC value :INDEX :INTVAR=data;
                printf("%d\n",INTVAR);
                break;
-          case SQL3_FLOAT:
-          case SQL3_REAL:
-               exec sql get descriptor MYDESC value :INDEX :FLOATVAR=data;
-               printf("%.*f\n",PRECISION,FLOATVAR);
-               break;
           case SQL3_DOUBLE_PRECISION:
                exec sql get descriptor MYDESC value :INDEX :DOUBLEVAR=data;
                printf("%.*f\n",PRECISION,DOUBLEVAR);
@@ -114,10 +98,6 @@ exec sql end declare section;
                        :STRINGVAR=data;
                printf("%d \"%s\"\n",DATETIME_INTERVAL_CODE,STRINGVAR);
                break;
-          case SQL3_INTERVAL:
-               exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;
-               printf("\"%s\"\n",STRINGVAR);
-               break;
           case SQL3_CHARACTER:
           case SQL3_CHARACTER_VARYING:
                exec sql get descriptor MYDESC value :INDEX :STRINGVAR=data;