PostgreSQL Source Code  git master
psqlscan.h File Reference
#include "pqexpbuffer.h"
Include dependency graph for psqlscan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PsqlScanCallbacks
 

Typedefs

typedef struct PsqlScanStateDataPsqlScanState
 
typedef enum _promptStatus promptStatus_t
 
typedef struct PsqlScanCallbacks PsqlScanCallbacks
 

Enumerations

enum  PsqlScanResult { PSCAN_SEMICOLON, PSCAN_BACKSLASH, PSCAN_INCOMPLETE, PSCAN_EOL }
 
enum  _promptStatus {
  PROMPT_READY, PROMPT_CONTINUE, PROMPT_COMMENT, PROMPT_SINGLEQUOTE,
  PROMPT_DOUBLEQUOTE, PROMPT_DOLLARQUOTE, PROMPT_PAREN, PROMPT_COPY
}
 
enum  PsqlScanQuoteType { PQUOTE_PLAIN, PQUOTE_SQL_LITERAL, PQUOTE_SQL_IDENT, PQUOTE_SHELL_ARG }
 

Functions

PsqlScanState psql_scan_create (const PsqlScanCallbacks *callbacks)
 
void psql_scan_destroy (PsqlScanState state)
 
void psql_scan_set_passthrough (PsqlScanState state, void *passthrough)
 
void psql_scan_setup (PsqlScanState state, const char *line, int line_len, int encoding, bool std_strings)
 
void psql_scan_finish (PsqlScanState state)
 
PsqlScanResult psql_scan (PsqlScanState state, PQExpBuffer query_buf, promptStatus_t *prompt)
 
void psql_scan_reset (PsqlScanState state)
 
void psql_scan_reselect_sql_lexer (PsqlScanState state)
 
bool psql_scan_in_quote (PsqlScanState state)
 

Typedef Documentation

◆ promptStatus_t

◆ PsqlScanCallbacks

◆ PsqlScanState

Definition at line 27 of file psqlscan.h.

Enumeration Type Documentation

◆ _promptStatus

Enumerator
PROMPT_READY 
PROMPT_CONTINUE 
PROMPT_COMMENT 
PROMPT_SINGLEQUOTE 
PROMPT_DOUBLEQUOTE 
PROMPT_DOLLARQUOTE 
PROMPT_PAREN 
PROMPT_COPY 

Definition at line 39 of file psqlscan.h.

◆ PsqlScanQuoteType

Enumerator
PQUOTE_PLAIN 
PQUOTE_SQL_LITERAL 
PQUOTE_SQL_IDENT 
PQUOTE_SHELL_ARG 

Definition at line 52 of file psqlscan.h.

53 {
54  PQUOTE_PLAIN, /* just return the actual value */
55  PQUOTE_SQL_LITERAL, /* add quotes to make a valid SQL literal */
56  PQUOTE_SQL_IDENT, /* quote if needed to make a SQL identifier */
57  PQUOTE_SHELL_ARG /* quote if needed to be safe in a shell cmd */
PsqlScanQuoteType
Definition: psqlscan.h:52

◆ PsqlScanResult

Enumerator
PSCAN_SEMICOLON 
PSCAN_BACKSLASH 
PSCAN_INCOMPLETE 
PSCAN_EOL 

Definition at line 30 of file psqlscan.h.

31 {
32  PSCAN_SEMICOLON, /* found command-ending semicolon */
33  PSCAN_BACKSLASH, /* found backslash command */
34  PSCAN_INCOMPLETE, /* end of line, SQL statement incomplete */
35  PSCAN_EOL /* end of line, SQL possibly complete */
PsqlScanResult
Definition: psqlscan.h:30

Function Documentation

◆ psql_scan()

PsqlScanResult psql_scan ( PsqlScanState  state,
PQExpBuffer  query_buf,
promptStatus_t prompt 
)

Referenced by MainLoop(), and ParseScript().

◆ psql_scan_create()

PsqlScanState psql_scan_create ( const PsqlScanCallbacks callbacks)

Referenced by main(), MainLoop(), and ParseScript().

◆ psql_scan_destroy()

void psql_scan_destroy ( PsqlScanState  state)

Referenced by main(), MainLoop(), and ParseScript().

◆ psql_scan_finish()

void psql_scan_finish ( PsqlScanState  state)

Referenced by MainLoop(), and ParseScript().

◆ psql_scan_in_quote()

bool psql_scan_in_quote ( PsqlScanState  state)

Referenced by MainLoop().

◆ psql_scan_reselect_sql_lexer()

void psql_scan_reselect_sql_lexer ( PsqlScanState  state)

◆ psql_scan_reset()

void psql_scan_reset ( PsqlScanState  state)

◆ psql_scan_set_passthrough()

void psql_scan_set_passthrough ( PsqlScanState  state,
void *  passthrough 
)

Referenced by main(), and MainLoop().

◆ psql_scan_setup()

void psql_scan_setup ( PsqlScanState  state,
const char *  line,
int  line_len,
int  encoding,
bool  std_strings 
)

Referenced by main(), MainLoop(), and ParseScript().