summaryrefslogtreecommitdiff
path: root/src/bin/psql/mainloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/mainloop.c')
-rw-r--r--src/bin/psql/mainloop.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index dadbd293971..bade35139b3 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -8,7 +8,6 @@
#include "postgres_fe.h"
#include "mainloop.h"
-
#include "command.h"
#include "common.h"
#include "input.h"
@@ -17,6 +16,13 @@
#include "mb/pg_wchar.h"
+/* callback functions for our flex lexer */
+const PsqlScanCallbacks psqlscan_callbacks = {
+ psql_get_variable,
+ psql_error
+};
+
+
/*
* Main processing loop for reading lines of input
* and sending them to the backend.
@@ -61,7 +67,7 @@ MainLoop(FILE *source)
pset.stmt_lineno = 1;
/* Create working state */
- scan_state = psql_scan_create();
+ scan_state = psql_scan_create(&psqlscan_callbacks);
query_buf = createPQExpBuffer();
previous_buf = createPQExpBuffer();
@@ -233,7 +239,8 @@ MainLoop(FILE *source)
/*
* Parse line, looking for command separators.
*/
- psql_scan_setup(scan_state, line, strlen(line));
+ psql_scan_setup(scan_state, line, strlen(line),
+ pset.encoding, standard_strings());
success = true;
line_saved_in_history = false;
@@ -373,7 +380,8 @@ MainLoop(FILE *source)
resetPQExpBuffer(query_buf);
/* reset parsing state since we are rescanning whole line */
psql_scan_reset(scan_state);
- psql_scan_setup(scan_state, line, strlen(line));
+ psql_scan_setup(scan_state, line, strlen(line),
+ pset.encoding, standard_strings());
line_saved_in_history = false;
prompt_status = PROMPT_READY;
}