identifier: NAMED | QUESTION_MARK | ENVVAR | USINGVAR ; fetch_cursor_name_p: NAMED { $$=A4GL_new_expr_simple_string(A4GL_get_clobbered_from($$), ET_EXPR_IDENTIFIER); } ; real_number : NUMBER_VALUE | KW_DOT INT_VALUE { sprintf($$,".%s",$2); } ; var_ident_qchar : NAMED | CHAR_VALUE {strcpy($$, A4GL_strip_quotes ($1));} | QUESTION_MARK | ENVVAR | USINGVAR ; opt_into_sel: {$$=0;} ; char_or_var : CHAR_VALUE | variable { if ((scan_variable($1)&15)!=0) {a4gl_yyerror("Variable must be of type charr..");YYERROR;} } | QUESTION_MARK | ENVVAR | USINGVAR ; opt_use : {strcpy($$,"");} | USE_SESSION conn_id KW_FOR { print_use_session($3); strcpy($$,A4GL_get_undo_use()); } ; conn_id : var_ident ; variable : NOT_USED_1 ; obind_var_list: NOT_USED_2 ; fgl_sql_statement: NOT_USED_3 ; var_ident: identifier ; ident_or_var: identifier | QUESTION_MARK { if (A4GL_isyes(acl_getenv("DOING_CM"))) { strcpy($$,"?@@PARAM@@?"); } else { strcpy($$,"?"); } } | ENVVAR | USINGVAR ; sql_statement : individual_sql_statement {set_Cmd($1);} ; sql_bound_commands : insert_statement_c { $$=new_command (E_CMD_INSERT_CMD); memcpy(&$$->cmd_data.command_data_u.insert_cmd, $1, sizeof($$->cmd_data.command_data_u.insert_cmd)); $$->cmd_data.command_data_u.insert_cmd.connid=0; } | update_statement_c { $$=new_command (E_CMD_UPDATE_CMD); memcpy(&$$->cmd_data.command_data_u.update_cmd, $1, sizeof($$->cmd_data.command_data_u.update_cmd)); $$->cmd_data.command_data_u.update_cmd.connid=0; } | delete_statement_c { $$=new_command (E_CMD_DELETE_CMD); memcpy(&$$->cmd_data.command_data_u.delete_cmd, $1, sizeof($$->cmd_data.command_data_u.delete_cmd)); $$->cmd_data.command_data_u.delete_cmd.connid=0; } ; individual_sql_statement : | set_database_cmd | sql_commands { $$=new_sql_cmd(0,$1); } | select_statement_ss_select { $$=new_select_cmd(0,$1,""); } | set_cmd { $$=$1; } | sql_bound_commands { $$=$1; } | sql_transact_commands { $$=new_sql_transact_cmd(0, $1); } | execute_procedure_cmd {$$=$1;} | error { $$=0;} ; var_ident_vl : var_ident ; curs_forupdate : {strcpy($$,"");} | FOR_UPDATE { strcpy($$,A4GLSQLCV_get_forupdate(NULL)); } | FOR_UPDATE_OF cur_update_list { strcpy($$,A4GLSQLCV_get_forupdate($2)); } ; cur_update_list : colident { strcpy($$,$1); } | cur_update_list KW_COMMA colident { sprintf($$,"%s,%s",$1,$3); } ; colident: identifier | identifier KW_DOT identifier {sprintf($$,"%s.%s",A4GLSQLCV_ownerize_tablename(NULL, $1),$3);} | CHAR_VALUE KW_DOT identifier KW_DOT identifier { sprintf($$,"%s.%s", A4GLSQLCV_ownerize_tablename($1, $3), $5); } ; set_cmd : SQLSEOFF { $$=new_sql_cmd(NULL,$1); } | SQLSEON { $$=new_sql_cmd(NULL,$1); } | SQLSLMW op_fgl_expr { sprintf($$,"%s %s",$1,$2); $$=new_sql_cmd(NULL,$$); } | SQLSLMNW { $$=new_sql_cmd(NULL,$1); } | SQLSIDR { $$=new_sql_cmd(NULL,$1); } | SQLSIRR { $$=new_sql_cmd(NULL,$1); } | SQLSICS { $$=new_sql_cmd(NULL,$1); } | SQLSICR { $$=new_sql_cmd(NULL,$1); } ; var_ident_ibind_sli : column_name_x { char *s; s=acl_strdup($1); $$=new_select_list_item_column_from_transform(s); acl_free(s); } | QUESTION_MARK { $$=new_select_list_item_builtin_const(E_SLI_QUERY_PLACEHOLDER);} | replace_with_variable { $$=new_select_list_item_replace_var($1); } ; var_ident_ibind_ss : column_name_x { $$=acl_strdup($1);} | QUESTION_MARK { if (A4GL_isyes(acl_getenv("DOING_CM"))) { $$=acl_strdup("?@@PARAM@@?"); } else { $$=acl_strdup("?"); } } | replace_with_variable { $$=$1; } ; set_database_cmd : DATABASE var_ident_qchar op_db_exclusive { add_feature("DATABASE_USED"); $$=new_set_database_cmd($2,$3,NULL); } ; replace_with_variable : MARK_VAR CHAR_VALUE END_MARK_VAR { $$=acl_strdup($2); } ; arr_expr : OPEN_BRACKET arr_expr CLOSE_BRACKET {sprintf($$,"(%s)",$2);} | arr_expr arr_next_math arr_expr { sprintf($$,"%s%s%s",$1,$2,$3);} | INT_VALUE {sprintf($$,"%d",atoi($1));} | arr_int_sign INT_VALUE {sprintf($$,"(%s%s)",$1,$2);} ; arr_next_math: KW_PLUS {strcpy($$,"+");} | KW_MINUS {strcpy($$,"-");} | KW_MULTIPLY {strcpy($$,"*");} | KW_DIVIDE {strcpy($$,"/");} | KW_MOD {strcpy($$,"%");} ; arr_int_sign : KW_PLUS {strcpy($$,"+");} | KW_MINUS {strcpy($$,"-");} ; op_substr : {strcpy($$,"");} | OPEN_SQUARE arr_expr CLOSE_SQUARE { sprintf($$,"[%s]", $2); } | OPEN_SQUARE arr_expr KW_COMMA arr_expr CLOSE_SQUARE { sprintf($$,"[%s,%s]", $2,$4); } ; column_name_x: identifier {sprintf($$,"%s", A4GLSQLCV_check_tablename($1));} | KW_TODAY KW_DOT identifier {sprintf($$,"today.%s", $3);} | identifier KW_DOT KW_MULTIPLY {sprintf($$,"%s.*", A4GLSQLCV_ownerize_tablename(NULL,$1));} | identifier KW_DOT KW_ROWID {sprintf($$,"%s.%s", $1,A4GLSQLCV_get_sqlconst ("rowid"));} | identifier KW_DOT identifier {sprintf($$,"%s.%s", A4GLSQLCV_ownerize_tablename(NULL,$1),$3);} | identifier KW_DOT identifier KW_DOT identifier {sprintf($$,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3),$5);} | CHAR_VALUE KW_DOT identifier KW_DOT identifier {sprintf($$,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3),$5);} | identifier OPEN_SQUARE arr_expr CLOSE_SQUARE {sprintf($$,"%s", $1); strcpy($$, A4GLSQLCV_make_substr_s($1, 1,$3,0));} | identifier KW_DOT identifier OPEN_SQUARE arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename(NULL,$1),$3); strcpy($$, A4GLSQLCV_make_substr_s(buff,1,$5,0));} | identifier KW_DOT identifier KW_DOT identifier OPEN_SQUARE arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3), $5); strcpy($$, A4GLSQLCV_make_substr_s(buff,1,$7,0)); } | CHAR_VALUE KW_DOT identifier KW_DOT identifier OPEN_SQUARE arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3), $5); strcpy($$, A4GLSQLCV_make_substr_s(buff,1,$7,0)); } | identifier OPEN_SQUARE arr_expr KW_COMMA arr_expr CLOSE_SQUARE {sprintf($$,"%s", $1); strcpy($$, A4GLSQLCV_make_substr_s($1, 2,$3,$5));} | identifier KW_DOT identifier OPEN_SQUARE arr_expr KW_COMMA arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename(NULL,$1),$3); strcpy($$, A4GLSQLCV_make_substr_s(buff,2,$5,$7));} | identifier KW_DOT identifier KW_DOT identifier OPEN_SQUARE arr_expr KW_COMMA arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3), $5); strcpy($$, A4GLSQLCV_make_substr_s(buff,2,$7,$9)); } | CHAR_VALUE KW_DOT identifier KW_DOT identifier OPEN_SQUARE arr_expr KW_COMMA arr_expr CLOSE_SQUARE {char buff[256]; sprintf(buff,"%s.%s", A4GLSQLCV_ownerize_tablename($1,$3), $5); strcpy($$, A4GLSQLCV_make_substr_s(buff,2,$7,$9)); } ; value_expression_initial_sli: value_expression_initial_sli_nocast { $$=$1; } | value_expression_initial_sli_nocast DOUBLE_COLON data_type { $$=new_select_list_item_cast($1, $3); } ; value_expression_initial_sli_nocast : value_expression_complex_sli { $1=$1; } | var_ident_ibind_sli {$1=$1;} | subquery_sli { $$=new_select_list_item_sq(E_SQE_DONT_CARE,$1); } | ALL subquery_sli { $$=new_select_list_item_sq(E_SQE_ALL,$2); } | ANY subquery_sli { $$=new_select_list_item_sq(E_SQE_ANY,$2); } | SOME subquery_sli { $$=new_select_list_item_sq(E_SQE_SOME,$2); } ; op_fgl_expr : {strcpy($$,"");} | INT_VALUE {strcpy($$,$1);} ; opt_use2_p: ; spl_proc_name: identifier {strcpy($$,$1);} | identifier COLON identifier {sprintf($$,"%s:%s",$1,$3);} ;