Package net.hydromatic.quidem
Class Quidem
- java.lang.Object
-
- net.hydromatic.quidem.Quidem
-
public class Quidem extends Object
Runs a SQL script.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceQuidem.ConfigThe information needed to start Quidem.static classQuidem.ConfigBuilderBuilds aQuidem.Config.static interfaceQuidem.ConnectionFactoryCreates a connection for a given name.static interfaceQuidem.PropertyHandlerCalled whenever a property's value is changed.static classQuidem.SqlCommandCommand that executes a SQL statement.
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGstatic CommandHandlerEMPTY_COMMAND_HANDLERA command handler that defines no commands.static Quidem.ConnectionFactoryEMPTY_CONNECTION_FACTORYThe empty environment.static Function<String,Object>EMPTY_ENVThe empty environment.static Quidem.PropertyHandlerEMPTY_PROPERTY_HANDLERA property handler that does nothing.
-
Constructor Summary
Constructors Constructor Description Quidem(Reader reader, Writer writer)Creates a Quidem interpreter with an empty environment and empty connection factory.Quidem(Quidem.Config config)Creates a Quidem interpreter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Quidem.ConfigBuilderconfigBuilder()Creates aQuidem.ConfigBuilderwith the default settings.voidexecute()Executes the commands from the input, writing to the output, then closing both input and output.booleanisProbablyDeterministic(String sql)Returns whether a SQL query is likely to produce results always in the same order.static voidmain(String[] args)Entry point from the operating system command line.
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
-
EMPTY_ENV
public static final Function<String,Object> EMPTY_ENV
The empty environment. Returns null for all variables.
-
EMPTY_CONNECTION_FACTORY
public static final Quidem.ConnectionFactory EMPTY_CONNECTION_FACTORY
The empty environment. Returns null for all database names.
-
EMPTY_COMMAND_HANDLER
public static final CommandHandler EMPTY_COMMAND_HANDLER
A command handler that defines no commands.
-
EMPTY_PROPERTY_HANDLER
public static final Quidem.PropertyHandler EMPTY_PROPERTY_HANDLER
A property handler that does nothing.
-
-
Constructor Detail
-
Quidem
public Quidem(Reader reader, Writer writer)
Creates a Quidem interpreter with an empty environment and empty connection factory.
-
Quidem
public Quidem(Quidem.Config config)
Creates a Quidem interpreter.
-
-
Method Detail
-
configBuilder
public static Quidem.ConfigBuilder configBuilder()
Creates aQuidem.ConfigBuilderwith the default settings.
-
main
public static void main(String[] args)
Entry point from the operating system command line.Calls
System.exit(int)with the following status codes:- 0: success
- 1: invalid arguments
- 2: help
- Parameters:
args- Command-line arguments
-
execute
public void execute()
Executes the commands from the input, writing to the output, then closing both input and output.
-
isProbablyDeterministic
public boolean isProbablyDeterministic(String sql)
Returns whether a SQL query is likely to produce results always in the same order.If Quidem believes that the order is deterministic, it does not sort the rows before comparing them.
The result is just a guess. Quidem does not understand the finer points of SQL semantics.
- Parameters:
sql- SQL query- Returns:
- Whether the order is likely to be deterministic
-
-