-
Notifications
You must be signed in to change notification settings - Fork 16
buffers
Each time you create and execute a SQL statement, that statement is saved away into your SQL buffer history. The list of prior SQL statements can be displayed using the '\history' command.
Many jsqsh command allow you to refer to SQL buffers via special syntax, each starting with an exclamation character (!). This syntax allows for the following forms:
-
!.
Refers to the current SQL buffer that you are currently typing in to (but have not yet executed). -
!..
Refers to the most recently executed SQL buffer. -
!!
A synonym for!..
. In addition, typing!!
at the prompt causes the current SQL buffer (!.
) to be appended with the most recently executed SQL statement. This is a useful feature for re-executing the previous statment. For example, to re-execute the most recently executed SQL statement:1> !! ... 5> \go
The
!!
appends the previously executed statement to the current buffer (which was empty) and the \go, obviously, executes the statement. -
!...
Refers to the statement you executed two executions prior. Additional periods may be provided to continue moving back through executions (e.g.!.......
refers to the statement executed 6 executions prior). -
!N
This syntax allows you to refer to SQL statements executed a specific number of executions prior. For example!0
refers to the current buffer (that has not yet been executed),!1
refers to the most recently execute statements,!2
the one before that and so on.
Examples of commands that utilize this syntax are \buf-edit
, \but-copy
,
and \buf-append
. For example:
\buf-edit !!
indicates that the most recently executed statement should be edited.