void whenever_action(int mode) { if ((mode & 1) == 1 && when_nf.code != W_NOTHING) { output_line_number(); fprintf(yyout, "\nif (sqlca.sqlcode == ECPG_NOT_FOUND) "); print_action(&when_nf); } if (when_warn.code != W_NOTHING) { output_line_number(); fprintf(yyout, "\nif (sqlca.sqlwarn[0] == 'W') "); print_action(&when_warn); } if (when_error.code != W_NOTHING) { output_line_number(); fprintf(yyout, "\nif (sqlca.sqlcode < 0) "); print_action(&when_error); } if ((mode & 2) == 2) fputc('}', yyout); output_line_number(); }
void outputter_t::output_str (str s) { if (_mode == OUTPUT_TREADMILL) { static rxx x ("\n"); vec<str> v; split (&v, x, s); for (u_int i = 0; i < v.size (); i++) { output_line_number (); _output_str (v[i], "\n"); } } else { // we might have set up a defered output_line_number from // within switch_to_mode; now is the time to do it. if (s.len () && _do_output_line_number) { output_line_number (); _do_output_line_number = false; } _output_str (s, NULL); if (_mode == OUTPUT_PASSTHROUGH) _lineno += count_newlines (s); } }
void output_simple_statement(char *stmt) { output_escaped_str(stmt, false); output_line_number(); free(stmt); }
void outputter_H_t::output_str (str s) { if (_mode == OUTPUT_TREADMILL) { static rxx x ("\n"); vec<str> v; output_line_number (); split (&v, x, s); for (u_int i = 0; i < v.size (); i++) { // only output a newline on the last line _output_str (v[i], (i == v.size () - 1 ? "\n" : " ")); } } else { outputter_t::output_str (s); } }
void output_simple_statement(char *cmd) { int i, j = strlen(cmd);; /* output this char by char as we have to filter '\"' */ for (i = 0; i < j; i++) { if (cmd[i] != '"') fputc(cmd[i], yyout); else fputs("\\\"", yyout); } output_line_number(); free(cmd); }