From: Michael Meskes
authorMarc G. Fournier
Thu, 21 May 1998 03:52:37 +0000 (03:52 +0000)
committerMarc G. Fournier
Thu, 21 May 1998 03:52:37 +0000 (03:52 +0000)
+ Tue May 19 11:49:34 CEST 1998
+
+       - Tested (and fixed) 'set connection'
+       - Fixed string notation in C
+       - Set version to 2.3.2

src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/TODO
src/interfaces/ecpg/lib/ecpglib.c
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/preproc.y

index c7acdf023dfe5937d51c4cec77c719d98aa4b2aa..2dd35c7b48c684cc4f94ac694e17c60567ede5cf 100644 (file)
@@ -228,3 +228,8 @@ Mon May 18 10:33:58 CEST 1998
    - Set version to 2.3.1
    - Set library version to 2.2
 
+Tue May 19 11:49:34 CEST 1998
+
+   - Tested (and fixed) 'set connection'
+   - Fixed string notation in C
+   - Set version to 2.3.2
index 3787f100ed5dab9269eb1d4d933c9d01c6c1d7be..cff7d70aeb2ddfe3c11a98cc3aa46f5750e0973d 100644 (file)
@@ -5,10 +5,10 @@ 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.
 
-ecpg cannot use pointer variables except [unsigned] char *
-
-There is no exec sql type statement which is the SQL version of a typedef.
-
-There is no exec sql prepare statement.
-
-There is no SQLSTATE
+Missing statements:
+ - exec sql type
+ - exec sql define
+ - exec sql prepare
+ - exec sql allocate
+ - exqc sql free
+ - SQLSTATE
index 445776ec828ec845864a57b60e0ea5c3813611ff..504a0388ccdd364b05554747f9fe7cc0299e1ff5 100644 (file)
@@ -804,8 +804,10 @@ bool
 ECPGsetconn(int lineno, const char *connection_name)
 {
    struct connection *con = all_connections;
+
+   ECPGlog("ECPGsetconn: setting actual connection to %s\n", connection_name); 
    
-   for (; con && strcmp(connection_name, con->name) == 0; con=con->next);
+   for (; con && strcmp(connection_name, con->name) != 0; con=con->next);
    if (con)
    {
        actual_connection = con;
@@ -883,7 +885,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
    }
    else 
    {
-       for (con = all_connections; con && strcmp(con->name, connection_name);con = con->next);
+       for (con = all_connections; con && strcmp(con->name, connection_name) != 0;con = con->next);
        if (con == NULL)
        {       
            ECPGlog("disconnect: not connected to connection %s\n", connection_name);
index 1410087832a7ad1450061dbd82dc5fdae9245397..30b6d829a376bbb57465dc151e5324791db5593b 100644 (file)
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
 
 MAJOR_VERSION=2
 MINOR_VERSION=3
-PATCHLEVEL=1
+PATCHLEVEL=2
 
 CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
    -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
index c9f0cd459b5d2f810127e146b13d357b690838bd..6ac025c0fee5e3f8e2627e4dd724e7131b3e48c1 100644 (file)
@@ -180,14 +180,11 @@ sql     [sS][qQ][lL]
 
 {xcstar}       { /* ignore */ }
 {xcstart}      {
-               fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);
                before_comment = YYSTATE;
                BEGIN(xc);
-               fprintf(stderr,"ys = %d %d\n", YYSTATE,
-before_comment);
            }
 
-{xcstop}   { fprintf(stderr,"ys = %d %d\n", YYSTATE, before_comment);BEGIN(before_comment); }
+{xcstop}   { BEGIN(before_comment); }
 
 {xcinside} { /* ignore */ }
 
index 5e99e7190d9630a4d45fcb6e609d3c0a8f716f0b..53916b231684e767d8ba34d6a7bf8694b1990da3 100644 (file)
@@ -673,8 +673,8 @@ output_statement(char * stmt, int mode)
 %type     ECPGWhenever ECPGConnect connection_target ECPGOpen open_opts
 %type     indicator ECPGExecute c_expr variable_list dotext
 %type      storage_clause opt_initializer vartext c_anything blockstart
-%type      blockend variable_list variable var_anything sql_anything
-%type     opt_pointer ecpg_ident cvariable ECPGDisconnect dis_name
+%type      blockend variable_list variable var_anything do_anything
+%type     opt_pointer cvariable ECPGDisconnect dis_name
 %type     stmt symbol opt_symbol ECPGRelease execstring server_name
 %type     connection_object opt_server opt_port
 %type      user_name opt_user char_variable ora_user ident
@@ -762,7 +762,7 @@ stmt:  AddAttrStmt          { output_statement($1, 0); }
        | ECPGOpen      { output_statement($1, 0); }
        | ECPGRelease       { /* output already done */ }
        | ECPGSetConnection     {
-                       fprintf(yyout, "ECPGsetcon(__LINE__, %s);", $1);
+                       fprintf(yyout, "ECPGsetconn(__LINE__, %s);", $1);
                        whenever_action(0);
                                                free($1);
                    }
@@ -4014,6 +4014,13 @@ connection_target: database_name opt_server opt_port
                 {
          $$ = $1;
        }
+   | Sconst
+       {
+         $$ = strdup($1);
+         $$[0] = '\"';
+         $$[strlen($$) - 1] = '\"';
+         free($1);
+       }
 
 db_prefix: ident cvariable
                 {
@@ -4075,9 +4082,12 @@ ora_user: user_name
                $$ = make3_str($1, make1_str(","), $3);
                 }
 
-user_name: UserId       { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
+user_name: UserId       { if ($1[0] == '\"')
+               $$ = $1;
+             else
+               $$ = make3_str(make1_str("\""), $1, make1_str("\""));
+           }
         | char_variable { $$ = $1; }
-        | CSTRING       { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
         | SCONST        { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
 
 char_variable: cvariable
@@ -4137,7 +4147,8 @@ connection_object: connection_target { $$ = $1; }
  */
 ECPGExecute : EXECUTE SQL_IMMEDIATE execstring { $$ = $3; };
 
-execstring: cvariable | CSTRING;
+execstring: cvariable |
+   CSTRING  { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); };
 
 /*
  * open is an open cursor, at the moment this has to be removed
@@ -4534,7 +4545,7 @@ into_list : coutputvariable | into_list ',' coutputvariable;
 ecpgstart: SQL_START { reset_variables();}
 
 dotext: /* empty */        { $$ = make1_str(""); }
-   | dotext sql_anything   { $$ = make2_str($1, $2); }
+   | dotext do_anything    { $$ = make2_str($1, $2); }
 
 vartext: var_anything      { $$ = $1; }
         | vartext var_anything { $$ = make2_str($1, $2); }
@@ -4559,16 +4570,15 @@ indicator: /* empty */          { $$ = NULL; }
    | SQL_INDICATOR name        { check_indicator((find_variable($2))->type); $$ = $2; }
 
 ident: IDENT   { $$ = make1_str($1); }
-
-ecpg_ident: ident  { $$ = $1; }
-   | CSTRING   { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
+   | CSTRING   { $$ = $1; }
 /*
  * C stuff
  */
 
-symbol: ecpg_ident { $$ = $1; }
+symbol: IDENT  { $$ = make1_str($1); }
 
-c_anything:  ecpg_ident    { $$ = $1; }
+c_anything:  IDENT     { $$ = make1_str($1); }
+   | CSTRING   { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
    | Iconst    { $$ = $1; }
    | FCONST    { $$ = make_name(); }
    | '*'           { $$ = make1_str("*"); }
@@ -4597,12 +4607,14 @@ c_anything:  ecpg_ident     { $$ = $1; }
    | '='       { $$ = make1_str("="); }
    | ','       { $$ = make1_str(","); }
 
-sql_anything: ecpg_ident   { $$ = $1; }
-   | Iconst    { $$ = $1; }
+do_anything: IDENT { $$ = make1_str($1); }
+        | CSTRING       { $$ = make3_str(make1_str("\""), $1, make1_str("\""));}
+        | Iconst        { $$ = $1; }
    | FCONST    { $$ = make_name(); }
    | ','       { $$ = make1_str(","); }
 
-var_anything: ecpg_ident   { $$ = $1; }
+var_anything: IDENT    { $$ = make1_str($1); }
+   | CSTRING       { $$ = make3_str(make1_str("\""), $1, make1_str("\"")); }
    | Iconst    { $$ = $1; }
    | FCONST    { $$ = make_name(); }
 /*FIXME:   | ','       { $$ = make1_str(","); }*/