~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/bin/psql/psqlscan.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * psql - the PostgreSQL interactive terminal
 
3
 *
 
4
 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
 
5
 *
 
6
 * $PostgreSQL: pgsql/src/bin/psql/psqlscan.h,v 1.5 2005-01-01 05:43:08 momjian Exp $
 
7
 */
 
8
#ifndef PSQLSCAN_H
 
9
#define PSQLSCAN_H
 
10
 
 
11
#include "pqexpbuffer.h"
 
12
 
 
13
#include "prompt.h"
 
14
 
 
15
 
 
16
/* Abstract type for lexer's internal state */
 
17
typedef struct PsqlScanStateData *PsqlScanState;
 
18
 
 
19
/* Termination states for psql_scan() */
 
20
typedef enum
 
21
{
 
22
        PSCAN_SEMICOLON,                        /* found command-ending semicolon */
 
23
        PSCAN_BACKSLASH,                        /* found backslash command */
 
24
        PSCAN_INCOMPLETE,                       /* end of line, SQL statement incomplete */
 
25
        PSCAN_EOL                                       /* end of line, SQL possibly complete */
 
26
} PsqlScanResult;
 
27
 
 
28
/* Different ways for scan_slash_option to handle parameter words */
 
29
enum slash_option_type
 
30
{
 
31
        OT_NORMAL,                                      /* normal case */
 
32
        OT_SQLID,                                       /* treat as SQL identifier */
 
33
        OT_SQLIDHACK,                           /* SQL identifier, but don't downcase */
 
34
        OT_FILEPIPE,                            /* it's a filename or pipe */
 
35
        OT_WHOLE_LINE,                          /* just snarf the rest of the line */
 
36
        OT_VERBATIM                                     /* literal (no backticks or variables) */
 
37
};
 
38
 
 
39
 
 
40
extern PsqlScanState psql_scan_create(void);
 
41
extern void psql_scan_destroy(PsqlScanState state);
 
42
 
 
43
extern void psql_scan_setup(PsqlScanState state,
 
44
                                const char *line, int line_len);
 
45
extern void psql_scan_finish(PsqlScanState state);
 
46
 
 
47
extern PsqlScanResult psql_scan(PsqlScanState state,
 
48
                  PQExpBuffer query_buf,
 
49
                  promptStatus_t *prompt);
 
50
 
 
51
extern void psql_scan_reset(PsqlScanState state);
 
52
 
 
53
extern bool psql_scan_in_quote(PsqlScanState state);
 
54
 
 
55
extern char *psql_scan_slash_command(PsqlScanState state);
 
56
 
 
57
extern char *psql_scan_slash_option(PsqlScanState state,
 
58
                                           enum slash_option_type type,
 
59
                                           char *quote,
 
60
                                           bool semicolon);
 
61
 
 
62
extern void psql_scan_slash_command_end(PsqlScanState state);
 
63
 
 
64
extern void psql_scan_slash_pushback(PsqlScanState state, const char *str);
 
65
 
 
66
#endif   /* PSQLSCAN_H */