- Direct Known Subclasses:
public abstract class Command extends java.lang.ObjectAbstract base-class for all commands that NanoDB supports. Command classes contain both the arguments and configuration details for the command being executed, as well as the code for actually performing the command. Databases tend to have large switch statements controlling how various commands are handled, and this really isn't a very pretty way to do things. So, NanoDB uses a class-hierarchy for command representation and execution.
The command class is subclassed into various command categories that relate to various operations in the database. For example, the
QueryCommandclass represents all SELECT, INSERT, UPDATE, and DELETE operations.
Nested Class Summary
Nested Classes Modifier and Type Class Description
Command.TypeCommands are either Data-Definition Language (DDL), Data-Manipulation Language (DML), or utility commands.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
execute(NanoDBServer server)Actually performs the command.
getCommandType()Returns the general type or category of this command.
private Command.Type cmdTypeThe type of this command.
protected java.io.PrintStream outThis is the output stream for the current session, so that command output goes to the appropriate client.
protected Command(Command.Type cmdType)Create a new command instance, of the specified command-type. The constructor is protected, but that is redundant with the fact that the class is abstract anyways, so this class cannot be constructed directly.
cmdType- the general category of command
public Command.Type getCommandType()Returns the general type or category of this command.