edit

Syntax

edit [ file | !history_search_command ]

Description

You can use the edit command to edit a file or edit in a text editor. The edit command starts a text editor such as emacs, gedit, or vi.

If TimesTen does not find an exact file match for the specified file parameter, it searches for file.sql. If neither file exists, ttIsql starts the editor with the file file.

You can edit a SQL statement that is stored in the history list of the current ttIsql session. When calling the edit command specify the ! character followed by the number of the command or a search string.

If you run the edit command with a history_search_command parameter, ttIsql runs the contents of the file after you exit the text editor. The contents of the file are run as a single ttIsql command. If you do not want to run the contents of the file, delete the contents of the file and save the file before you exit the editor.

You can only use one parameter at a time. The history_search_command parameter is defined as the ! character followed by the number of the command or a search string. If you do not specify a ! character, the edit command interprets the parameter as file. If you do not specify a parameter or specify !!, the last ttIsql command is edited.

You can specify the default editor by defining the ttIsql _EDITOR define alias. The following example sets the default editor to vi:

Command> DEFINE _EDITOR=vi

If you do not define the _EDITOR define alias, ttIsql uses the editor specified by the VISUAL environment variable. If the _EDITOR define alias and the VISUAL environment variables are not set, ttIsql uses the editor specified by the EDITOR environment variable. When _EDITOR, VISUAL, and EDITOR are not set, vi is used for UNIX and Linux systems and notepad.exe is used for Windows.