FSQL |
FSQL is simple command line tool for working with Firebird databases.
It is very similar to Firebird's standard ISQL, it implements most of it's functionality,
plus some extra features, like possibility to insert file contents into blob,
export data in csv format, gfix functionality accessible in sql script (e.g. shutdown database),
show connected users, better indication of errors in script, etc.
Currently SHOW commands use simpler formatting than ISQL
(because there is no special code so far, they are just predefined selects),
and few SHOW commands are not fully implemented yet.
@ <command> (suppress echo for current command)
CD [<directory>] (display or change working directory)
DISCONNECT
ECHO [<message>] - display message, can use variables %TIMER% %CURRENT_TIMESTAMP% %CURRENT_TIME% %CURRENT_DATE%
IMPORT {CSV|DBF} [FILE] <input-file> '<insert-command>' [NOATOMIC]
EXPORT CSV {'<select-command>' | TABLE <table>} [[FILE] <output-file>]
SLEEP [<sec> [MS | MIN]]
SET BAIL [ON|OFF] (leave script on error)
SET HEADing [ON|OFF|<number>] (print columnnames)
SET TALK [ON|OFF] (ON=show result, OFF=do dummy fetches)
SET ROWCOUNT <number> (max. number of fetched rows, 0=OFF)
SET SQLDA_DISPLAY [ON|OFF] (show datatypes of output parameters)
SET TIMER [<name>] (set timer variable %TIMER% or %TIMER_name%)
SET VALUE[S] [<value>,...] (set values for parametrized queries)
SET EXPORT [DATE 'format'] [TIME {'format' | DEFAULT}] [DMY | MDY | YMD]
SET STAT[S] [ON|OFF] [STATS|COUNTERS|ALL] [FULL|SHORT] [[NO|SEPARATE|ONLY] PREPARE] [[NO] SYSTEM]
SET STAT[S] START|END
SHOW CONNECTION[S] (show list of connected users)
SHOW TRANSACTION[S]
SHOW SUMMARY (show number of db objects)
SHOW COLLATION[S] [<collation> | <charset>]
SHOW VALUE[S] (show values set by SET VALUES command
EXPORT and IMPORT can handle blob fields, but IMPORT
currently does not like binary values (limitation of Delphi's Readln() function).
CONNECT '<dbspec>' [USER 'username'] [PASSWORD 'password'] [ROLE 'rolename']
[CACHE int] [SWEEP] [PASSWORD_ENCRYPTED 'password']
[SWEEP_INTERVAL <n>] [PAGE_BUFFERS <n>] [SET_SQL_DIALECT <n>]
[[NO] FORCE_WRITE] [[NO] RESERVE] [READ {WRITE|ONLY}]
[ONLINE [NORMAL|MULTI|SINGLE] ]
[SHUTDOWN [MULTI|SINGLE|FULL] {ATTACHMENT|CONNECTION|TRANSACTION|FORCE} <sec>]
[[NO] GARBAGE_COLLECT] [ACTIVATE_SHADOW] [DELETE_SHADOW]
[VALIDATE [FULL] [NO_UPDATE] [IGNORE] [MEND]]
[[NO] DB_TRIGGERS] [PROCESS_NAME 'name']
SHOW DATABASE [FULL]
SHOW INDEX [<index> | <table> | SYSTEM | ALL]
HELP [SET | SHOW | SERVICE]
BLOBDUMP <blobid> <file> [FILTER <num1> <num2>] (export using blob-filter)
EXIT [<exitcode>] (without <exitcode>, fsql's exit-code will contain number of errors)
QUIT [<exitcode>]
INPUT command automatically changes current directory when called on upper level
and full path is used. This is useful for commands
INPUT, CREATE DATABASE, BLOBDUMP, @'blob', IMPORT, EXPORT
Note that not all parameters of CONNECT can be used together, however FSQL does not currently make any checking.
@'filename'Example:
INSERT INTO tab(id, blobfield) VALUES (1, @'c:\f.txt');
SHOW commands are not fully implemented yet, in some cases they will show
more informations than ISQL, e.g.:
SHOW INDEX ... will show index type (PRIMARY KEY,FOREIGN KEY,UNIQUE) and selectivity SHOW PROC ... will display procedure owner SHOW ROLE ... will display role owner, and possibly WITH ADMIN OPTION flag SHOW TABLE ... will display table owner and highest format number SHOW DATABASE will display creation date, number of buffer pages, ReadOnly and Reserve flags
HELP SERVICE).
CONNECT SERVICE 'service_name' [USER 'username'] [PASSWORD 'password']
DISCONNECT SERVICE
SWEEP 'dbname'
BACKUP 'dbname' 'backupfile' [<length> 'backup2' ...]
[VERBOSE] [CONVERT] [METADATA[_ONLY]] [NO GARBAGE[_COLLECT]]
[IGNORE_CHECKSUMS] [IGNORE_LIMBO] [NO DB_TRIGGERS]
RESTORE 'backupfile' ['backup2' ...] 'dbfile' [<length> 'dbfile2' ...]
[VERBOSE] [PAGE_BUFFERS <num>] [PAGE_SIZE <num>] [READ_ONLY|READ_WRITE]
[INACTIVE] [KILL] [NO_VALIDITY] [ONE_AT_A_TIME] [USE_ALL_SPACE] [REPLACE]
[FIX_FSS_DATA '<charset>'] [FIX_FSS_METADATA '<charset>']
NBACKUP 'dbfile' 'backupfile' [LEVEL <n>] [[NO] DB_TRIGGERS]
NRESTORE 'dbfile' 'backupfile' ['backupfile' ...]
SVC_MGR CREATE USER 'username' [PASSWORD 'password'] [FIRSTNAME '...'] [MIDDLENAME '...'] [LASTNAME '...']
SVC_MGR ALTER USER 'username' [PASSWORD 'password'] [FIRSTNAME '...'] [MIDDLENAME '...'] [LASTNAME '...']
SVC_MGR DROP USER 'username'
SVC_MGR SHOW USER[S] ['username']
SHOW SERVICE
SHOW ATTACHMENTS
SHOW STATS 'dbname' [HEADER | [DATA] [INDEX] [ALL] [SYSTEM]] [RECORD[_VERSIONS]] [TABLE <tab>,...]
SHOW LOG
SHOW commands and -X,-A command line switches. SHOW commands, but they will just execute simple predefined SELECT commands,
so the result is usually not as complex and not as nicely formatted as that of ISQL)
fbclient library. (i.e. registry entry is not used)
FSQL does not copy ISQL's bugs, instead it implements its own bugs :)
FSQL parses command line from left to right,
ISQL from right to left.
It means:SET TERM
command if it fits into one line, like CREATE PROCEDURE P AS BEGIN POST_EVENT 'STOP'; END; SET ECHO OFF; EXECUTE PROCEDURE P; COMMIT;
| Download FSQL v1.8.2 |
| Download GUI version WFSQL v1.8.2 |
Some changes in the latest version (FSQL v1.8.2, 2009-12-10):