1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-31 10:30:33 +03:00

In psql, save history of backslash commands used in multi-line

statements before the multi-line statement, rather than inside the
multi-line statement.
This commit is contained in:
Bruce Momjian
2006-03-06 04:45:21 +00:00
parent 99114a2473
commit ca8f27998a
3 changed files with 43 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.51 2006/03/05 15:58:51 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.52 2006/03/06 04:45:21 momjian Exp $
*/
#include "postgres_fe.h"
@@ -114,7 +114,7 @@ gets_interactive(const char *prompt)
/* Put the line in the history buffer and also add the trailing \n */
void
pgadd_history(char *s, PQExpBuffer history_buf)
pg_append_history(char *s, PQExpBuffer history_buf)
{
#ifdef USE_READLINE
@@ -134,12 +134,13 @@ pgadd_history(char *s, PQExpBuffer history_buf)
}
/* Feed the contents of the history buffer to readline */
/*
* Feed the string to readline
*/
void
pgflush_history(PQExpBuffer history_buf)
pg_write_history(char *s)
{
#ifdef USE_READLINE
char *s;
#ifdef USE_READLINE
static char *prev_hist;
int slen, i;
@@ -147,7 +148,6 @@ pgflush_history(PQExpBuffer history_buf)
{
enum histcontrol HC;
s = history_buf->data;
prev_hist = NULL;
HC = GetHistControlConfig();
@@ -168,14 +168,12 @@ pgflush_history(PQExpBuffer history_buf)
prev_hist = pg_strdup(s);
add_history(s);
}
resetPQExpBuffer(history_buf);
}
#endif
}
void
pgclear_history(PQExpBuffer history_buf)
pg_clear_history(PQExpBuffer history_buf)
{
#ifdef USE_READLINE
if (useReadline && useHistory)