#include <QueryEngine.h>
Public Member Functions | |
ReturnCode | select (int nAttributes, const RelationAttribute attributes[], int nRelations, const char *relations[], int nConditions, const Condition conditions[]) |
Executes a SQL "select-from-where" query. | |
ReturnCode | insert (const char *relName, int nValues, const TypedValue values[]) |
Executes a SQL "insert into" command. | |
ReturnCode | remove (const char *relName, int nConditions, const Condition conditions[]) |
Executes a SQL "delete from" command. | |
ReturnCode | update (const char *relName, const RelationAttribute *left, const AttributeOrValue *right, int nConditions, const Condition conditions[]) |
Executes a SQL "update" command. | |
Static Public Member Functions | |
static QueryEngine * | getInstance () |
Gets the singleton QueryEngine instance. |
The QueryEngine class is used to execute SQL query and update commands in DavisDB. It contains public methods corresponding to the SQL "select," "insert," "delete," and "update" statements supported by the DavisDB command- line shell. Like SystemManager, it is invoked by the command-line shell as a backend component to actually carry out these commands. QueryEngine is a singleton class; a reference to the singleton object is obtained by calling QueryEngine::getInstance.
ReturnCode QueryEngine::select | ( | int | nAttributes, | |
const RelationAttribute | attributes[], | |||
int | nRelations, | |||
const char * | relations[], | |||
int | nConditions, | |||
const Condition | conditions[] | |||
) |
Executes a SQL "select-from-where" query.
nAttributes | The number of attributes in the "select" clause | |
attributes | The list of attributes in the "select" clause | |
nRelations | The number of relations in the "from" clause | |
relations | The list of relation names in the "from" clause | |
nConditions | The number of conditions in the "where" clause | |
conditions | The list of conditions in the "where" clause |
ReturnCode QueryEngine::insert | ( | const char * | relName, | |
int | nValues, | |||
const TypedValue | values[] | |||
) |
Executes a SQL "insert into" command.
relName | The name of the target relation | |
nValues | The number of values to insert | |
TypedValue | The list of values to insert |
ReturnCode QueryEngine::remove | ( | const char * | relName, | |
int | nConditions, | |||
const Condition | conditions[] | |||
) |
Executes a SQL "delete from" command.
relName | The name of the target relation | |
nConditions | The number of "where" conditions | |
conditions | The list of "where" conditions |
ReturnCode QueryEngine::update | ( | const char * | relName, | |
const RelationAttribute * | left, | |||
const AttributeOrValue * | right, | |||
int | nConditions, | |||
const Condition | conditions[] | |||
) |
Executes a SQL "update" command.
relName | The name of the target relation | |
left | The attribute to be updated | |
right | The attribute name or constant whose value should replace that of left | |
nConditions | The number of conditions | |
conditions | The list of conditions |