Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef PSQLSCAN_H
00009 #define PSQLSCAN_H
00010
00011 #include "pqexpbuffer.h"
00012
00013 #include "prompt.h"
00014
00015
00016
00017 typedef struct PsqlScanStateData *PsqlScanState;
00018
00019
00020 typedef enum
00021 {
00022 PSCAN_SEMICOLON,
00023 PSCAN_BACKSLASH,
00024 PSCAN_INCOMPLETE,
00025 PSCAN_EOL
00026 } PsqlScanResult;
00027
00028
00029 enum slash_option_type
00030 {
00031 OT_NORMAL,
00032 OT_SQLID,
00033 OT_SQLIDHACK,
00034 OT_FILEPIPE,
00035 OT_WHOLE_LINE,
00036 OT_NO_EVAL
00037 };
00038
00039
00040 extern PsqlScanState psql_scan_create(void);
00041 extern void psql_scan_destroy(PsqlScanState state);
00042
00043 extern void psql_scan_setup(PsqlScanState state,
00044 const char *line, int line_len);
00045 extern void psql_scan_finish(PsqlScanState state);
00046
00047 extern PsqlScanResult psql_scan(PsqlScanState state,
00048 PQExpBuffer query_buf,
00049 promptStatus_t *prompt);
00050
00051 extern void psql_scan_reset(PsqlScanState state);
00052
00053 extern bool psql_scan_in_quote(PsqlScanState state);
00054
00055 extern char *psql_scan_slash_command(PsqlScanState state);
00056
00057 extern char *psql_scan_slash_option(PsqlScanState state,
00058 enum slash_option_type type,
00059 char *quote,
00060 bool semicolon);
00061
00062 extern void psql_scan_slash_command_end(PsqlScanState state);
00063
00064 #endif