@@ -654,12 +654,12 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
654654}
655655
656656/* special embedded SQL token*/
657- %token SQL_AT SQL_BOOL SQL_BREAK
657+ %token SQL_AT SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK
658658%token SQL_CALL SQL_CONNECT SQL_CONNECTION SQL_CONTINUE
659659%token SQL_DEALLOCATE SQL_DISCONNECT SQL_ENUM
660660%token SQL_FOUND SQL_FREE SQL_GO SQL_GOTO
661661%token SQL_IDENTIFIED SQL_IMMEDIATE SQL_INDICATOR SQL_INT SQL_LONG
662- %token SQL_OPEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
662+ %token SQL_OFF SQL_OPEN SQL_PREPARE SQL_RELEASE SQL_REFERENCE
663663%token SQL_SECTION SQL_SHORT SQL_SIGNED SQL_SQLERROR SQL_SQLPRINT
664664%token SQL_SQLWARNING SQL_START SQL_STOP SQL_STRUCT SQL_UNSIGNED
665665%token SQL_VAR SQL_WHENEVER
@@ -831,7 +831,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
831831%type <str> ECPGFree ECPGDeclare ECPGVar sql_variable_declarations
832832%type <str> sql_declaration sql_variable_list sql_variable opt_at
833833%type <str> struct_type s_struct declaration variable_declarations
834- %type <str> s_struct s_union union_type
834+ %type <str> s_struct s_union union_type ECPGSetAutocommit on_off
835835
836836%type <type_enum> simple_type varchar_type
837837
@@ -842,6 +842,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
842842%type <index> opt_array_bounds nest_array_bounds opt_type_array_bounds
843843%type <index> nest_type_array_bounds
844844
845+ %type <ival> Iresult
845846%%
846847prog :statements ;
847848
@@ -913,7 +914,7 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
913914if (connection)
914915yyerror (" no at option for connect statement.\n " );
915916
916- fprintf (yyout," ECPGconnect(__LINE__, %s, %d);" , $1 ,no_auto_trans );
917+ fprintf (yyout," ECPGconnect(__LINE__, %s, %d);" , $1 ,autocommit );
917918whenever_action (0 );
918919free ($1 );
919920}
@@ -981,6 +982,11 @@ stmt: AddAttrStmt{ output_statement($1, 0); }
981982free ($1 );
982983}
983984| ECPGRelease {/* output already done*/ }
985+ | ECPGSetAutocommit {
986+ fprintf (yyout," ECPGsetcommit(__LINE__,\" %s\" , %s);" , $1 , connection ? connection :" NULL" );
987+ whenever_action (0 );
988+ free ($1 );
989+ }
984990| ECPGSetConnection {
985991if (connection)
986992yyerror (" no at option for set connection statement.\n " );
@@ -3170,11 +3176,14 @@ opt_array_bounds: '[' ']' nest_array_bounds
31703176$$ .index2 =$3 .index1;
31713177$$ .str = cat2_str(make1_str(" []" ),$3 .str);
31723178 }
3173- | ' [' Iconst ' ]' nest_array_bounds
3179+ | ' [' Iresult ' ]' nest_array_bounds
31743180{
3175- $$ .index1 = atol($2 );
3181+ char *txt = mm_alloc(20L );
3182+
3183+ sprintf (txt," %d" , $2 );
3184+ $$ .index1 =$2 ;
31763185$$ .index2 =$4 .index1;
3177- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
3186+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
31783187 }
31793188| /* EMPTY*/
31803189{
@@ -3190,11 +3199,14 @@ nest_array_bounds:'[' ']' nest_array_bounds
31903199$$ .index2 =$3 .index1;
31913200$$ .str = cat2_str(make1_str(" []" ),$3 .str);
31923201 }
3193- | ' [' Iconst ' ]' nest_array_bounds
3202+ | ' [' Iresult ' ]' nest_array_bounds
31943203{
3195- $$ .index1 = atol($2 );
3204+ char *txt = mm_alloc(20L );
3205+
3206+ sprintf (txt," %d" , $2 );
3207+ $$ .index1 =$2 ;
31963208$$ .index2 =$4 .index1;
3197- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
3209+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
31983210 }
31993211| /* EMPTY*/
32003212{
@@ -3204,6 +3216,16 @@ nest_array_bounds:'[' ']' nest_array_bounds
32043216 }
32053217 ;
32063218
3219+ Iresult :Iconst {$$ = atol($1 ); }
3220+ | ' (' Iresult ' )' {$$ =$2 ; }
3221+ | Iresult ' +' Iresult {$$ =$1 +$3 };
3222+ |Iresult '-' Iresult{ $$ = $1 - $3};
3223+ |Iresult '*' Iresult{ $$ = $1 * $3};
3224+ |Iresult '/' Iresult{ $$ = $1 / $3};
3225+ |Iresult '%' Iresult{ $$ = $1 % $3};
3226+
3227+
3228+
32073229/* ****************************************************************************
32083230 *
32093231 *Type syntax
@@ -3239,6 +3261,7 @@ Generic: generic
32393261generic :ident {$$ =$1 ; }
32403262| TYPE_P {$$ = make1_str(" type" ); }
32413263| SQL_AT {$$ = make1_str(" at" ); }
3264+ | SQL_AUTOCOMMIT {$$ = make1_str(" autocommit" ); }
32423265| SQL_BOOL {$$ = make1_str(" bool" ); }
32433266| SQL_BREAK {$$ = make1_str(" break" ); }
32443267| SQL_CALL {$$ = make1_str(" call" ); }
@@ -3255,6 +3278,7 @@ generic: ident{ $$ = $1; }
32553278| SQL_INDICATOR {$$ = make1_str(" indicator" ); }
32563279| SQL_INT {$$ = make1_str(" int" ); }
32573280| SQL_LONG {$$ = make1_str(" long" ); }
3281+ | SQL_OFF {$$ = make1_str(" off" ); }
32583282| SQL_OPEN {$$ = make1_str(" open" ); }
32593283| SQL_PREPARE {$$ = make1_str(" prepare" ); }
32603284| SQL_RELEASE {$$ = make1_str(" release" ); }
@@ -4475,7 +4499,6 @@ ColId: ident{ $$ = $1; }
44754499| SQL_BREAK {$$ = make1_str(" break" ); }
44764500| SQL_CALL {$$ = make1_str(" call" ); }
44774501| SQL_CONNECT {$$ = make1_str(" connect" ); }
4478- | SQL_CONNECTION {$$ = make1_str(" connection" ); }
44794502| SQL_CONTINUE {$$ = make1_str(" continue" ); }
44804503| SQL_DEALLOCATE {$$ = make1_str(" deallocate" ); }
44814504| SQL_DISCONNECT {$$ = make1_str(" disconnect" ); }
@@ -4487,6 +4510,7 @@ ColId: ident{ $$ = $1; }
44874510| SQL_INDICATOR {$$ = make1_str(" indicator" ); }
44884511| SQL_INT {$$ = make1_str(" int" ); }
44894512| SQL_LONG {$$ = make1_str(" long" ); }
4513+ | SQL_OFF {$$ = make1_str(" off" ); }
44904514| SQL_OPEN {$$ = make1_str(" open" ); }
44914515| SQL_PREPARE {$$ = make1_str(" prepare" ); }
44924516| SQL_RELEASE {$$ = make1_str(" release" ); }
@@ -5138,13 +5162,27 @@ ECPGRelease: TransactionStmt SQL_RELEASE
51385162free ($1 );
51395163}
51405164
5165+ /*
5166+ * set/reset the automatic transaction mode, this needs a differnet handling
5167+ * as the other set commands
5168+ */
5169+ ECPGSetAutocommit :SET SQL_AUTOCOMMIT to_equal on_off
5170+ {
5171+ $$ =$4 ;
5172+ }
5173+
5174+ on_off :ON {$$ = make1_str(" on" ); }
5175+ | SQL_OFF {$$ = make1_str(" off" ); }
5176+
5177+ to_equal :TO | " =" ;
5178+
51415179/*
51425180 * set the actual connection, this needs a differnet handling as the other
51435181 * set commands
51445182*/
5145- ECPGSetConnection :SET SQL_CONNECTION connection_object
5183+ ECPGSetConnection :SET SQL_CONNECTION to_equal connection_object
51465184 {
5147- $$ =$3 ;
5185+ $$ =$4 ;
51485186 }
51495187
51505188/*
@@ -5204,17 +5242,23 @@ opt_type_array_bounds: '[' ']' nest_type_array_bounds
52045242$$ .index2 =$3 .index1;
52055243$$ .str = cat2_str(make1_str(" []" ),$3 .str);
52065244 }
5207- | ' [' Iconst ' ]' nest_type_array_bounds
5245+ | ' [' Iresult ' ]' nest_type_array_bounds
52085246{
5209- $$ .index1 = atol($2 );
5247+ char *txt = mm_alloc(20L );
5248+
5249+ sprintf (txt," %d" , $2 );
5250+ $$ .index1 =$2 ;
52105251$$ .index2 =$4 .index1;
5211- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
5252+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
52125253 }
5213- | ' (' Iconst ' )' nest_type_array_bounds
5254+ | ' (' Iresult ' )' nest_type_array_bounds
52145255{
5215- $$ .index1 = atol($2 );
5256+ char *txt = mm_alloc(20L );
5257+
5258+ sprintf (txt," %d" , $2 );
5259+ $$ .index1 =$2 ;
52165260$$ .index2 =$4 .index1;
5217- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
5261+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
52185262 }
52195263| /* EMPTY*/
52205264{
@@ -5236,17 +5280,23 @@ nest_type_array_bounds:'[' ']' nest_type_array_bounds
52365280$$ .index2 =$3 .index1;
52375281$$ .str = cat2_str(make1_str(" []" ),$3 .str);
52385282 }
5239- | ' [' Iconst ' ]' nest_type_array_bounds
5283+ | ' [' Iresult ' ]' nest_type_array_bounds
52405284{
5241- $$ .index1 = atol($2 );
5285+ char *txt = mm_alloc(20L );
5286+
5287+ sprintf (txt," %d" , $2 );
5288+ $$ .index1 =$2 ;
52425289$$ .index2 =$4 .index1;
5243- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
5290+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
52445291 }
5245- | ' (' Iconst ' )' nest_type_array_bounds
5292+ | ' (' Iresult ' )' nest_type_array_bounds
52465293{
5247- $$ .index1 = atol($2 );
5294+ char *txt = mm_alloc(20L );
5295+
5296+ sprintf (txt," %d" , $2 );
5297+ $$ .index1 =$2 ;
52485298$$ .index2 =$4 .index1;
5249- $$ .str = cat4_str(make1_str(" [" ),$2 , make1_str(" ]" ),$4 .str);
5299+ $$ .str = cat4_str(make1_str(" [" ),txt , make1_str(" ]" ),$4 .str);
52505300 }
52515301| /* EMPTY*/
52525302{
@@ -5954,6 +6004,10 @@ c_anything: IDENT { $$ = $1; }
59546004| Iconst {$$ =$1 ; }
59556005| Fconst {$$ =$1 ; }
59566006| ' *' {$$ = make1_str(" *" ); }
6007+ | ' +' {$$ = make1_str(" +" ); }
6008+ | ' -' {$$ = make1_str(" -" ); }
6009+ | ' /' {$$ = make1_str(" /" ); }
6010+ | ' %' {$$ = make1_str(" %" ); }
59576011| S_AUTO {$$ = make1_str(" auto" ); }
59586012| S_BOOL {$$ = make1_str(" bool" ); }
59596013| S_CHAR {$$ = make1_str(" char" ); }