PostgreSQL Source Code git master
|
#include "postgres_fe.h"
#include "common/logging.h"
#include "fe_utils/psqlscan.h"
#include "libpq-fe.h"
#include "fe_utils/psqlscan_int.h"
Go to the source code of this file.
Macros | |
#define | LEXRES_EOL 0 /* end of input */ |
#define | LEXRES_SEMI 1 /* command-terminating semicolon found */ |
#define | LEXRES_BACKSLASH 2 /* backslash command start */ |
#define | ECHO psqlscan_emit(cur_state, yytext, yyleng) |
Typedefs | |
typedef int | YYSTYPE |
#define ECHO psqlscan_emit(cur_state, yytext, yyleng) |
Definition at line 62 of file psqlscan.l.
#define LEXRES_BACKSLASH 2 /* backslash command start */ |
Definition at line 59 of file psqlscan.l.
#define LEXRES_EOL 0 /* end of input */ |
Definition at line 57 of file psqlscan.l.
#define LEXRES_SEMI 1 /* command-terminating semicolon found */ |
Definition at line 58 of file psqlscan.l.
typedef int YYSTYPE |
Definition at line 53 of file psqlscan.l.
PsqlScanResult psql_scan | ( | PsqlScanState | state, |
PQExpBuffer | query_buf, | ||
promptStatus_t * | prompt | ||
) |
Definition at line 1117 of file psqlscan.l.
References Assert, exit(), fprintf, PQExpBufferData::len, LEXRES_BACKSLASH, LEXRES_EOL, LEXRES_SEMI, PROMPT_COMMENT, PROMPT_CONTINUE, PROMPT_DOLLARQUOTE, PROMPT_DOUBLEQUOTE, PROMPT_PAREN, PROMPT_READY, PROMPT_SINGLEQUOTE, PSCAN_BACKSLASH, PSCAN_EOL, PSCAN_INCOMPLETE, PSCAN_SEMICOLON, and yylex().
Referenced by MainLoop(), and ParseScript().
PsqlScanState psql_scan_create | ( | const PsqlScanCallbacks * | callbacks | ) |
Definition at line 1001 of file psqlscan.l.
References pg_malloc0(), and psql_scan_reset().
Referenced by main(), MainLoop(), and ParseScript().
void psql_scan_destroy | ( | PsqlScanState | state | ) |
Definition at line 1022 of file psqlscan.l.
References free, psql_scan_finish(), and psql_scan_reset().
Referenced by main(), MainLoop(), and ParseScript().
void psql_scan_finish | ( | PsqlScanState | state | ) |
Definition at line 1240 of file psqlscan.l.
References free, and psqlscan_pop_buffer_stack().
Referenced by MainLoop(), ParseScript(), and psql_scan_destroy().
bool psql_scan_in_quote | ( | PsqlScanState | state | ) |
Definition at line 1308 of file psqlscan.l.
Referenced by MainLoop().
void psql_scan_reselect_sql_lexer | ( | PsqlScanState | state | ) |
Definition at line 1295 of file psqlscan.l.
Referenced by expr_lex_one_word(), expr_scanner_finish(), psql_scan_slash_command(), psql_scan_slash_command_end(), and psql_scan_slash_option().
void psql_scan_reset | ( | PsqlScanState | state | ) |
Definition at line 1267 of file psqlscan.l.
References free.
Referenced by exec_command_reset(), exec_command_watch(), MainLoop(), psql_scan_create(), and psql_scan_destroy().
void psql_scan_set_passthrough | ( | PsqlScanState | state, |
void * | passthrough | ||
) |
Definition at line 1041 of file psqlscan.l.
Referenced by main(), and MainLoop().
void psql_scan_setup | ( | PsqlScanState | state, |
const char * | line, | ||
int | line_len, | ||
int | encoding, | ||
bool | std_strings | ||
) |
Definition at line 1059 of file psqlscan.l.
References Assert, encoding, pg_valid_server_encoding_id, and psqlscan_prepare_buffer().
Referenced by main(), MainLoop(), and ParseScript().
void psqlscan_emit | ( | PsqlScanState | state, |
const char * | txt, | ||
int | len | ||
) |
Definition at line 1463 of file psqlscan.l.
References appendBinaryPQExpBuffer(), appendPQExpBufferChar(), i, and len.
Referenced by psqlscan_escape_variable(), and psqlscan_test_variable().
void psqlscan_escape_variable | ( | PsqlScanState | state, |
const char * | txt, | ||
int | len, | ||
PsqlScanQuoteType | quote | ||
) |
Definition at line 1531 of file psqlscan.l.
References appendPQExpBufferStr(), free, len, psqlscan_emit(), psqlscan_extract_substring(), and value.
char * psqlscan_extract_substring | ( | PsqlScanState | state, |
const char * | txt, | ||
int | len | ||
) |
Definition at line 1495 of file psqlscan.l.
References i, len, and pg_malloc().
Referenced by psqlscan_escape_variable(), and psqlscan_test_variable().
void psqlscan_pop_buffer_stack | ( | PsqlScanState | state | ) |
Definition at line 1359 of file psqlscan.l.
References StackElem::buf, StackElem::bufstring, free, StackElem::next, StackElem::origstring, and StackElem::varname.
Referenced by psql_scan_finish().
YY_BUFFER_STATE psqlscan_prepare_buffer | ( | PsqlScanState | state, |
const char * | txt, | ||
int | len, | ||
char ** | txtcopy | ||
) |
Definition at line 1422 of file psqlscan.l.
References i, len, pg_malloc(), and PQmblen().
Referenced by psql_scan_setup(), and psqlscan_push_new_buffer().
void psqlscan_push_new_buffer | ( | PsqlScanState | state, |
const char * | newstr, | ||
const char * | varname | ||
) |
Definition at line 1320 of file psqlscan.l.
References StackElem::buf, StackElem::bufstring, StackElem::next, StackElem::origstring, pg_malloc(), pg_strdup(), psqlscan_prepare_buffer(), and StackElem::varname.
void psqlscan_select_top_buffer | ( | PsqlScanState | state | ) |
Definition at line 1377 of file psqlscan.l.
References StackElem::buf, StackElem::bufstring, and StackElem::origstring.
void psqlscan_test_variable | ( | PsqlScanState | state, |
const char * | txt, | ||
int | len | ||
) |
Definition at line 1560 of file psqlscan.l.
References free, len, PQUOTE_PLAIN, psqlscan_emit(), psqlscan_extract_substring(), and value.
bool psqlscan_var_is_current_source | ( | PsqlScanState | state, |
const char * | varname | ||
) |
Definition at line 1400 of file psqlscan.l.
References StackElem::next, and StackElem::varname.
Definition at line 385 of file psqlscan.l.
Referenced by psql_scan().