Sunteți pe pagina 1din 4

ISQL - Firebird Interactive SQL Tool

ISQLisacommandlinetoolforinteractiveSQLaccesstodatabases.Itcanalsobeusedtoperform
administrativetasksincommandlineenvironments(like(metadata)updatesviaabatchfile).

General Syntax
isql <options> [<database>]

or

isql -?

Options
-a(ll)
Extractmetadataincl.legacynonSQLtables

-b(ail)
Bailonerrors(setbailon)

-c(ache) <num>
Numberofcachebuffers

-ch(arset) <charset>
ConnectionCharacterSet(setnames)

-d(atabase) <database>
Databasenametoputinscriptcreation

-e(cho)
Echocommands(setechoon)

-ex(tract)
Extractmetadata

Insteadofpassword:Fetchpasswordfromthefilesoitisnotvisible
-fet[ch_password] <filename>
inthecommandline.When<filename>isstdin,theuserwillbe
promptedforthepassword.[Firebird2.5]
-i(nput) <filename>
ProcessSQLscriptfile(setinput)

-m(erge)
Mergestandarderror

-m2
Mergediagnostic

-n(oautocommit)
NoautocommitDDL(setautoddloff)

-nodbtriggers SuppressesDatabaseTriggersfromrunning.Onlyavailabletothe
databaseownerandSYSDBA[Firebird2.1]
-now(arnings)
Donotshowwarnings

-o(utput) <filename>
Outputfile(setoutput)

-pag(elength) <size>
PageLength

-p(assword) <password>
ConnectionPassword
-q(uiet)
Donotshowthemessage"UseCONNECT..."

-r(ole) <role>
RoleName

-r2 <role>
Role(usesquotedidentifier)

-s(qldialect) <dialect>
SQLDialect(setsqldialect)

-t(erminator) <term>
CommandTerminator(setterm)

-u(ser) <user>
UserName

-x
ExtractMetadata

-z
ShowProgramandServerVersion

Interactive Mode
ISQLentersaninteractivemode.CommandlinesstartwithaSQL>prompt,continuinglineswithaCON>
prompt.
NOTEthateverycommandhastobeterminatedbyasemicolon(;).
C:\Programme\Firebird2\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> connect elias:apqp user sysdba password masterkey;
Database: elias:apqp, User: sysdba
SQL> _

YoucannowenterDDL,DMLorspecialISQLcommands.
Youcanalsospecifythedatabasedirectlyintheisqlcall:
C:\Programme\Firebird2\bin>isql -user SYSDBA -password masterkey elias:apqp
Database: elias:apqp, User: SYSDBA
SQL> exit;

ISQL Commands
YoucangetalistofcommandsbycallingtheHELP;command.
BLOBDUMP <blobid> <file>
DumpBLOBtoafile

BLOBVIEW <blobid>
ViewBLOBintexteditor

EDIT [<filename>]
EditSQLscriptfileandexecute

EDIT
Editcurrentcommandbufferandexecute

HELP
DisplayHelp

HELP SET
DisplayHelpfortheSETcommand
INput <filename>
TakeinputfromthenamedSQLfile

OUTput [<filename>]
Writeoutputtonamedfile

OUTput
Returnoutputtostdout

SET <option>
Setoption.UseHELPSETforacompletelist

SHELL <command>
ExecuteOperatingSystemcommandinsubshell

Displaysysteminformationonadatabaseobject.<object>can
SHOW <object> [<name>] be:CHECK,COLLATIONS[FB2.5],DATABASE,DOMAIN,EXCEPTION,
FILTER,FUNCTION,GENERATOR,GRANT,INDEX,PROCEDURE,
ROLE,SQLDIALECT,SYSTEM,TABLE,TRIGGER,VERSION,VIEW
EXIT
ExitandCommitchanges

QUIT
ExitandRollbackchanges

SET Options
ThereareseveraloptionsthatinfluencethebehaviourofISQL(thislistcanberetrievedbycallingHELP
SET;)
SET
DisplaycurrentSEToptions

SET AUTOddl
ToggleautocommitofDDLstatements

SET BAIL
Togglebailingoutonerrorsinnoninteractivemode

SET BLOB [ALL|<n>]


DisplayBLOBSofsubtype<n>orALL

SET BLOB
TurnoffBLOBdisplay

SET COUNT
Togglecountofselectedrowson/off

SET ECHO
Togglecommandechoon/off

SET HEADING
Toggledisplayofquerycolumntitles

SET LIST
Togglecolumnortabledisplayformat

SET NAMES <csname>


Setnameofruntimecharacterset

SET PLAN
Toggledisplayofqueryaccessplan

SET PLANONLY
Toggledisplayofqueryplanwithoutexecuting

SET SQL DIALECT <n>


SetSQLDialectto<n>

SET STATs
Toggledisplayofperformancestatistics
SET TIME
ToggledisplayoftimestampwithDATEvalues

SET TERM <string>


Changestatementterminatorstring

SET WIDTH <col> [<n>]


Set/unsetprintwidthto<n>forcolumn<col>

ByjustcallingSETwithoutparametersyoucangetalistofallsettings.

SET TERM
SETTERMisspecialinthatitchangesthestatementterminationcharacter.Thedefaultstatement
terminationcharacterisasemicolon.However,ifyouwanttocreateoralteraStoredProcedureorTrigger,
thesemicolonscontainedinthebodywouldalsoterminatethecommandthatdefinetheprocedure.Soto
defineastoredprocedure:
UseSETTERMtochangethestatementterminationtosomethingthatdoesnotoccurinyour
procedure
CreateoralteryourStoredProcedureorTrigger
Terminatethiscommandwiththenewterminationcharacter
ChangetheterminationcharacterbacktoasemicolonusingSETTERM

Example
SQL> set term ^ ;
SQL> create procedure Mul (a integer, b integer)
CON> returns (Result integer)
CON> as begin
CON> Result = a * b;
CON> suspend;
CON> end ^
SQL> set term ; ^

Notethattheendstatementoftheprocedureisterminatedwithacaret(^)insteadofasemicolon(;).The
carethasbeendefinedasthenewterminationcharacterbythefirstSETTERMstatement.

Running SQL Scripts


YoucanrunanSQLscriptbyusingthe-icommandlineoption.Tofurthersuppressthe"UseCONNECTor
CREATEDATABASEtospecifyadatabase"messagethatappearseverytimewhenISQLstarts,usethe-q
option.
C:\Programme\Firebird2\bin>isql -q -i c:\Scripts\CreateScript.sql

C:\Programme\Firebird2\bin>

Inthiscase,thescriptmustcontainaCONNECTorCREATEDATABASEcommand.
ScriptsshouldalsouseSETNAMEStodefinetheClientCharacterSettheyuse.

StefanHeymann,lastedit20091120
Thisdocumentationislicensedunder(chooseyourfavorite):GPL,LGPL,CC,IDPL,GFDL,BSD,(didIforgetone?)

S-ar putea să vă placă și