public class SqlLine extends Object
TODO:
Modifier and Type | Class and Description |
---|---|
static class |
SqlLine.Status
Exit status returned to the operating system.
|
Modifier and Type | Field and Description |
---|---|
static String |
COMMAND_PREFIX |
static String |
SQLLINE_BASE_DIR |
Constructor and Description |
---|
SqlLine() |
Modifier and Type | Method and Description |
---|---|
SqlLine.Status |
begin(String[] args,
InputStream inputStream,
boolean saveHistory)
Runs SqlLine, accepting input from the given input stream,
dispatching it to the appropriate
CommandHandler until the global variable exit is
true. |
jline.console.completer.Completer |
getCommandCompleter() |
List<String> |
getConnectionURLExamples() |
jline.console.ConsoleReader |
getConsoleReader(InputStream inputStream,
jline.console.history.FileHistory fileHistory) |
List<String> |
getIsolationLevels() |
Set<String> |
getMetadataMethodNames() |
sqlline.SqlLineOpts |
getOpts() |
sqlline.Reflector |
getReflector() |
static String |
getSeparator() |
boolean |
isExit() |
static void |
main(String[] args)
Starts the program.
|
static SqlLine.Status |
mainWithInputRedirection(String[] args,
InputStream inputStream)
Starts the program with redirected input.
|
int |
runCommands(List<String> cmds,
DispatchCallback callback) |
void |
setErrorStream(PrintStream errorStream) |
void |
setExit(boolean exit) |
void |
setOutputStream(PrintStream outputStream) |
String[][] |
splitCompound(String line)
Splits the line into an array of possibly-compound identifiers, observing
the database's quoting syntax.
|
static SqlLine.Status |
start(String[] args,
InputStream inputStream,
boolean saveHistory)
Backwards compatibility method to allow
mainWithInputRedirection(String[], java.io.InputStream) proxied
calls to keep method signature but add in new behavior of not saving
queries. |
public static final String COMMAND_PREFIX
public static final String SQLLINE_BASE_DIR
public static void main(String[] args) throws IOException
args
- Arguments specified on the command-lineIOException
- on errorpublic static SqlLine.Status mainWithInputRedirection(String[] args, InputStream inputStream) throws IOException
For redirected output, use setOutputStream(java.io.PrintStream)
and
setErrorStream(java.io.PrintStream)
.
Exits with 0 on success, 1 on invalid arguments, and 2 on any other error.
args
- same as main()inputStream
- redirected input, or null to use standard inputIOException
- on errorpublic static SqlLine.Status start(String[] args, InputStream inputStream, boolean saveHistory) throws IOException
mainWithInputRedirection(String[], java.io.InputStream)
proxied
calls to keep method signature but add in new behavior of not saving
queries.args
- args[] passed in directly from main(String[])
inputStream
- Stream to read sql commands from (stdin or a file) or
null for an interactive shellsaveHistory
- whether or not the commands issued will be saved to
sqlline's history fileIOException
- on errorpublic SqlLine.Status begin(String[] args, InputStream inputStream, boolean saveHistory) throws IOException
CommandHandler
until the global variable exit
is
true.
Before you invoke this method, you can redirect output by
calling setOutputStream(PrintStream)
and/or setErrorStream(PrintStream)
.
IOException
public jline.console.ConsoleReader getConsoleReader(InputStream inputStream, jline.console.history.FileHistory fileHistory) throws IOException
IOException
public String[][] splitCompound(String line)
For example, on Oracle, which uses double-quote (") as quote character,
!tables "My Schema"."My Table"
returns
{ {"!tables"}, {"My Schema", "My Table"} }
line
- the line to break uppublic int runCommands(List<String> cmds, DispatchCallback callback)
public sqlline.SqlLineOpts getOpts()
public boolean isExit()
public void setExit(boolean exit)
public static String getSeparator()
public void setOutputStream(PrintStream outputStream)
public void setErrorStream(PrintStream errorStream)
public sqlline.Reflector getReflector()
public jline.console.completer.Completer getCommandCompleter()
Copyright © 2015–2016 Julian Hyde. All rights reserved.