]> granicus.if.org Git - postgresql/commitdiff
From: Michael Meskes <meskes@topsystem.de>
authorMarc G. Fournier <scrappy@hub.org>
Wed, 3 Jun 1998 13:55:15 +0000 (13:55 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Wed, 3 Jun 1998 13:55:15 +0000 (13:55 +0000)
+ Wed Jun  3 13:38:57 CEST 1998
+
+       - Made sqlca struct compatible with other systems.
+       - Give back a warning in case of truncation
+       - Changed the handling of OptimizableStmt since the old one broke
+         CREATE RULE
+       - Set library version to 2.3
+       - Set version to 2.3.3

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/TODO
src/interfaces/ecpg/include/sqlca.h
src/interfaces/ecpg/lib/Makefile.in
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/test/header_test.h
src/interfaces/ecpg/test/test2.pgc

index 0211c321cb79c953f1cccd0024ee821757700dfd..bef6e29787bf2715ed4c9042d53e0d212815757f 100644 (file)
@@ -239,3 +239,12 @@ Wed May 20 10:46:48 CEST 1998
          initialization.
        - Added enum datatype.
        - Set version to 2.3.2
+
+Wed Jun  3 13:38:57 CEST 1998
+
+       - Made sqlca struct compatible with other systems.
+       - Give back a warning in case of truncation
+       - Changed the handling of OptimizableStmt since the old one broke
+         CREATE RULE
+       - Set library version to 2.3
+       - Set version to 2.3.3
index 06a818d1e8d6b30be6f4bf6bb0f8cdd4bedc7ae6..b174b56e5e9ea3fbbbd60e2ae4decb867597174d 100644 (file)
@@ -3,6 +3,14 @@ section of the structure variable for ecpg to be able to understand it.
 
 Variable type bool has to be checked. I never used it so far.
 
+The error message for "no data" in an exec sql insert select from statement
+has to be 100.
+
+sqlwarn[6] should be 'W' if the PRECISION or SCALE value specified in a SET
+DESCRIPTOR statement will be ignored.
+
+it would be nice to be able to use :var[:index] as cvariable
+
 Missing statements:
  - exec sql type
  - exec sql define
@@ -10,3 +18,4 @@ Missing statements:
  - exec sql allocate
  - exqc sql free
  - SQLSTATE
+ - exec sql whenever sqlwarning
index 7e99484d5aed054b45e8302e9219098eef6207b5..7d6c9994349eea3c1bcf7a7eda08347850377d8d 100644 (file)
@@ -7,13 +7,37 @@ extern "C" {
 
 struct sqlca
 {
-       int                     sqlcode;
+       char                    sqlcaid[8];
+       long                    sqlabc;
+       long                    sqlcode;
        struct
        {
                int             sqlerrml;
-               char            sqlerrmc[1000];
+               char            sqlerrmc[70];
        }                       sqlerrm;
+       char                    sqlerrp[8];
        long                    sqlerrd[6];
+               /* Element 0: empty                     */
+                /*         1: empty                     */
+                /*         2: number of rows processed  */
+                /*            after an INSERT, UPDATE or*/
+                /*            DELETE statement          */
+                /*         3: empty                     */
+               /*         4: empty                     */
+               /*         5: empty                     */
+       char                    sqlwarn[8];
+               /* Element 0: set to 'W' if at least one other is 'W' */
+               /*         1: if 'W' at least one character string    */
+               /*            value was truncated when it was         */
+               /*            stored into a host variable.            */
+               /*         2: empty                                   */
+               /*         3: empty                                   */
+               /*         4: empty                                   */
+               /*         5: empty                                   */
+               /*         6: empty                                   */
+               /*         7: empty                                   */
+                                                                               
+       char                    sqlext[8];
 } sqlca;
 
 #endif
index c402afc8446a0e2e23e31756aaaf2c8a42b00a55..1b38c6a539a4ab9abc598b3bfda3eca832f2fdd0 100644 (file)
@@ -4,7 +4,7 @@ include $(SRCDIR)/Makefile.global
 PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
 
 SO_MAJOR_VERSION=2
-SO_MINOR_VERSION=2
+SO_MINOR_VERSION=3
 
 PORTNAME=@PORTNAME@
 
index 504a0388ccdd364b05554747f9fe7cc0299e1ff5..ecbd2354617998d5b104fbe5748bdb3ab0ca5ea5 100644 (file)
@@ -38,7 +38,7 @@ static FILE *debugstream = NULL;
 static int     committed = true;
 
 static void
-register_error(int code, char *fmt,...)
+register_error(long code, char *fmt,...)
 {
        va_list         args;
 
@@ -131,9 +131,9 @@ ECPGdo(int lineno, char *query,...)
        long            offset, ind_offset;
        enum ECPGttype ind_type;
 
+       memset((char *) &sqlca, 0, sizeof (sqlca));
        va_start(ap, query);
 
-       sqlca.sqlcode = 0;
        copiedquery = strdup(query);
 
        type = va_arg(ap, enum ECPGttype);
@@ -666,6 +666,7 @@ ECPGdo(int lineno, char *query,...)
                                                                                          default:
                                                                                                  break;
                                                                                  }
+                                                                                 sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
                                                                          }
                                                                  }
                                                          }
@@ -702,6 +703,7 @@ ECPGdo(int lineno, char *query,...)
                                                                                  default:
                                                                                          break;
                                                                          }
+                                                                         sqlca.sqlwarn[0] = sqlca.sqlwarn[1] = 'W';
     
                                                                          var->len = varcharsize;
                                                                  }
index 30b6d829a376bbb57465dc151e5324791db5593b..e90d0731c467b463f471c0e28285dc90772a7ff6 100644 (file)
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
 
 MAJOR_VERSION=2
 MINOR_VERSION=3
-PATCHLEVEL=2
+PATCHLEVEL=3
 
 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
        -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
index 138cd601d1cbde178e1526be1443ba95902f746a..9a7b348f61922af3b482583de55978b0087935da 100644 (file)
@@ -643,9 +643,9 @@ output_statement(char * stmt, int mode)
 %type  <str>   group_clause groupby_list groupby having_clause from_clause
 %type  <str>   from_list from_val join_expr join_outer join_spec join_list
 %type  <str>   join_using where_clause relation_expr row_op sub_type
-%type  <str>   opt_column_list insert_rest InsertStmt
+%type  <str>   opt_column_list insert_rest InsertStmt OptimizableStmt
 %type  <str>    columnList DeleteStmt LockStmt UpdateStmt CursorStmt
-%type  <str>    NotifyStmt columnElem copy_dirn OptimizableStmt
+%type  <str>    NotifyStmt columnElem copy_dirn 
 %type  <str>    copy_delimiter ListenStmt CopyStmt copy_file_name opt_binary
 %type  <str>    opt_with_copy FetchStmt opt_direction fetch_how_many opt_portal_name
 %type  <str>    ClosePortalStmt DestroyStmt VacuumStmt opt_verbose
@@ -691,6 +691,7 @@ output_statement(char * stmt, int mode)
 %type  <action> action
 
 %type  <index> opt_array_bounds nest_array_bounds
+
 %%
 prog: statements;
 
@@ -735,7 +736,16 @@ stmt:  AddAttrStmt                 { output_statement($1, 0); }
                | RemoveStmt            { output_statement($1, 0); }
                | RenameStmt            { output_statement($1, 0); }
                | RevokeStmt            { output_statement($1, 0); }
-                | OptimizableStmt      { /* output already written */ }
+                | OptimizableStmt      {
+                                               if (strncmp($1, "/* declare" , sizeof("/* declare")-1) == 0)
+                                               {
+                                                       fputs($1, yyout);
+                                                       output_line_number();
+                                                       free($1);
+                                               }
+                                               else
+                                                       output_statement($1, 1);
+                                       }
                | RuleStmt              { output_statement($1, 0); }
                | TransactionStmt       {
                                                fprintf(yyout, "ECPGtrans(__LINE__, \"%s\");", $1);
@@ -1989,7 +1999,7 @@ OptStmtMulti:  OptStmtMulti OptimizableStmt ';'
                | OptStmtMulti OptimizableStmt
                                {  $$ = cat2_str($1, $2); }
                | OptimizableStmt ';'
-                               { $$ = $1; }
+                               { $$ = cat2_str($1, make1_str(";")); }
                ;
 
 event_object:  relation_name '.' attr_name
@@ -2197,17 +2207,12 @@ ExplainStmt:  EXPLAIN opt_verbose OptimizableStmt
  *                                                                                                                                                      *
  *****************************************************************************/
 
-OptimizableStmt:  SelectStmt   { output_statement($1, 1); }
-               | CursorStmt    
-                   {
-                     fputs($1, yyout);
-                     output_line_number();
-                     free($1);
-                   }
-               | UpdateStmt    { output_statement($1, 0); }
-               | InsertStmt    { output_statement($1, 0); }
-               | NotifyStmt    { output_statement($1, 0); }
-               | DeleteStmt    { output_statement($1, 0); }
+OptimizableStmt:  SelectStmt
+               | CursorStmt
+               | UpdateStmt
+               | InsertStmt
+               | NotifyStmt
+               | DeleteStmt
                ;
 
 
@@ -2334,7 +2339,7 @@ CursorStmt:  DECLARE name opt_binary CURSOR FOR
                                                cur = this;
                                        }
 
-                                       $$ = cat5_str(make1_str("/* declare cursor\""), $2, make1_str("\"statement has been moved to location of open cursor \""), strdup($2), make1_str("\"statement. */"));
+                                       $$ = make5_str(make1_str("/* declare cursor \""), $2, make1_str("\" statement has been moved to location of open cursor \""), strdup($2), make1_str("\" statement. */"));
                                }
                ;
 
@@ -4584,7 +4589,7 @@ cinputvariable : cvariable indicator {
                add_variable(&argsinsert, find_variable($1), ($2 == NULL) ? &no_indicator : find_variable($2)); 
 }
 
-civariableonly : cvariable name {
+civariableonly : cvariable {
                add_variable(&argsinsert, find_variable($1), &no_indicator); 
 }
 
index cc84aed778fece57a86ce9797e9697d40e4ad840..7d495ac64fb5a422a0461c64fcebfa63e835bced 100644 (file)
@@ -1,4 +1,3 @@
 exec sql include sqlca;
 
-exec sql whenever not found do break;
 exec sql whenever sqlerror sqlprint;
index 3b7ff3f9d55e7ab791d5ec6d838dec6cba6b89a1..324a63b941b18ab6f4e74f35630e58795dfb13c0 100644 (file)
@@ -48,6 +48,8 @@ exec sql end declare section;
        strcpy(msg, "open");
        exec sql open cur;
 
+       exec sql whenever not found do break;
+
        while (1) {
                strcpy(msg, "fetch");
                exec sql fetch cur into :personal:ind_personal, :married:ind_married;