CSQL 인터프리터에는 SQL 문 이외에 CSQL 인터프리터를 제어하는 특별한 명령어가 있으며 이를 세션 명령어라고 한다. 모든 세션 명령어는 반드시 세미콜론(;)으로 시작해야 한다.
;help를 입력하여 CSQL 인터프리터에서 지원되는 세션 명령어를 확인할 수 있다. 세션 명령어를 전부 입력하지 않고 대문자로 표시된 글자까지만 입력해도 CSQL 인터프리터는 세션 명령어를 인식한다. 세션 명령어는 대소문자를 구분하지 않는다.
CUBRID SQL Interpreter
Type `;help' for help messages.
csql> ;help
===
<Help: Session Command Summary> ===
All
session commands should be prefixed by `;' and only blanks/tabs
can
precede the prefix. Capitalized characters represent the minimum
abbreviation
that you need to enter to execute the specified command.
;REad
[<file-name>] -
read a file into command buffer.
;Write
[<file-name>] -
(over)write command buffer into a file.
;APpend
[<file-name>] -
append command buffer into a file.
;PRINT
-
print command buffer.
;SHELL
-
invoke shell.
;CD
-
change current working directory.
;EXit
-
exit program.
;CLear
-
clear command buffer.
;EDIT
-
invoke system editor with command buffer.
;List
-
display the content of command buffer.
;RUn
-
execute sql in command buffer.
;Xrun
-
execute sql in command buffer, and clear the command buffer.
;COmmit
-
commit the current transaction.
;ROllback
-
roll back the current transaction.
;AUtocommit
[ON|OFF] -
enable/disable auto commit mode.
;SHELL_Cmd
[shell-cmd] -
set default shell, editor, print and pager
;EDITOR_Cmd
[editor-cmd] command to
new one, or display the current
;PRINT_Cmd
[print-cmd] one,
respectively.
;PAger_cmd
[pager-cmd]
;DATE
-
display the local time, date.
;DATAbase
-
display the name of database being accessed.
;SChema
class-name -
display schema information of a class.
;SYntax
[sql-cmd-name] - display
syntax of a command.
;TRigger
[`*'|trigger-name] - display trigger definition.
;Get
system_parameter -
get the value of a system parameter.
;SEt
system_parameter=value - set the value of a system parameter.
;Info
<command> -
display internal information.
;TIme
[ON/OFF] -
enable/disable to display the query execution time.
;HISTORYList
-
display list of the executed queries.
;HISTORYRead
<history_num> - read entry on the history
number into command buffer.
;HElp
-
display this help message.
csql>
csql>
;r nation.sql
The file has been read into the command buffer.
csql> ;list
insert
into "sport_event" ("event_code", "event_name",
"gender_type", "num_player") values
(20001,
Archery Individual', 'M', 1);
insert
into "sport_event" ("event_code", "event_name",
"gender_type", "num_player") values
20002, 'Archery Individual', 'W', 1);
....
csql>
;w outfile
Command buffer has been saved.
csql>
;ap outfile
Command
buffer has been saved.
csql>
;shell
%
Is -al
total
2088
drwxr-xr-x
16 DBA cubrid 4096 Jul 29 16:51 .
drwxr-xr-x
6 DBA cubrid 4096 Jul 29 16:17 ..
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 02:49 audit
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 16:17 bin
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 16:17 conf
drwxr-xr-x
4 DBA cubrid 4096 Jul 29 16:14 cubridmanager
%
exit
csql>
csql>
;shell_c ls -la
csql>
;shell
total
2088
drwxr-xr-x
16 DBA cubrid 4096 Jul 29 16:51 .
drwxr-xr-x
6 DBA cubrid 4096 Jul 29 16:17 ..
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 02:49 audit
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 16:17 bin
drwxr-xr-x
2 DBA cubrid 4096 Jul 29 16:17 conf
drwxr-xr-x
4 DBA cubrid 4096 Jul 29 16:14 cubridmanager
csql>
csql> ;cd
/home1/DBA/CUBRID
Current directory
changed to /home1/DBA/CUBRID.
csql> ;ex
csql>
;cl
csql>
;list
csql> ;l
csql> ;ru
csql> ;x
csql>
;co
Current
transaction has been committed.
csql>
;ro
Current
transaction has been rolled back.
csql> ;au off
AUTOCOMMIT IS OFF
csql>
;date
Tue July 29 18:58:12 KST 2008
csql> ;data
demodb
csql> ;sc
event
=== <Help:
Schema of a Class> ===
<Class
Name>
event
<Attributes>
code INTEGER
NOT NULL
sports CHARACTER
VARYING(50)
name
CHARACTER VARYING(50)
gender
CHARACTER(1)
players INTEGER
<Constraints>
PRIMARY KEY pk_event_event_code ON event (code)
csql> ;sy
alter
=== <Help:
Command Syntax> ===
<Name>
ALTER
<Description>
Change the definition
of a class or virtual class.
<Syntax>
<alter>
::= ALTER [ <class_type> ] <class_name> <alter_clause>
;
<class_type>
::= CLASS | TABLE | VCLASS | VIEW
<alter_clause>
::= ADD <alter_add> [ INHERIT <resolution_comma_list> ] |
DROP <alter_drop> [ INHERIT <resolution_comma_list> ] |
RENAME <alter_rename> [ INHERIT <resolution_comma_list> ]
|
>
CHANGE <alter_change> |
INHERIT <resolution_comma_list>
<alter_add>
::= [ ATTRIBUTE | COLUMN ] <class_element_comma_list> |
CLASS ATTRIBUTE <attribute_definition_comma_list> |
FILE <file_name_comma_list> |
METHOD <method_definition_comma_list> |
QUERY <select_statement> |
SUPERCLASS <class_name_comma_list>
......
csql> ;tr
=== <Help:
All Triggers> ===
glo_delete_contents
csql>
;g isolation_level
===
Get Param Input ===
isolation_level=4
csql> ;se
block_ddl_statement=1
=== Set Param
Input ===
block_ddl_statement=1
csql> ;i
lock
*** Lock Table
Dump ***
Lock Escalation
at = 100000, Run Deadlock interval = 1
Transaction
(index 0, unknown, unknown@unknown|-1)
Isolation REPEATABLE
CLASSES AND READ UNCOMMITTED INSTANCES
State TRAN_ACTIVE
Timeout_period
-1
......
csql>
;ti ON
csql>
;ti
TIME
IS ON
csql>
;historyl
----<
1 >----
select
* from nation;
----<
2 >----
select
* from athlete;
csql> ;historyr 1
csql> ;edit
csql>
;editor_c emacs
csql>
;edit