|
|
This class handles an abstraction of SQL statements used by TOra to extract information and manipulate data. This is usefull in two ways, first off you can edit the strings using a handy editor inside TOra if you find bugs. Also you can use different statements for different Oracle versions. You can also add support for new versions of Oracle without any need for recompilation or programming knowledge.
All information about SQL statements are stored in one global static map which contains a name, a description and one or several statements connected to one Oracle version.
To determine which SQL to use the statement with the highest version not above the current connection is used. If no statements below or equal to the current version is available the lowest available is used.
All strings are specific for a given database provider. No attempt to use strings from other providers will be made.
version (struct) | version |
Contains a statement with it's version.
definition (struct) | definition |
Definition of one toSQL statement with its description and versions.
typedef std::map<QCString,definition> sqlMap | sqlMap |
Type of map of statement names to statement definitions.
static const char * const TOSQL_USERLIST | TOSQL_USERLIST |
static const char * const TOSQL_CREATEPLAN | TOSQL_CREATEPLAN |
bool updateSQL (const QCString &name,
const QString &sql,
const QString &description,
const QCString &ver="8.1",
const QCString &provider="Oracle",
bool modified=true)
| updateSQL |
[static]
Update the map with new information.
Parameters:
name | Name of this SQL statement. |
sql | Statement to execute for this SQL. |
description | Description of this SQL. |
ver | Version of database this statement is meant for. |
provider | Database provider this string is used for. |
modified | Wether this is a modification or an addition to the map. |
Returns: True if a new statement was saved, otherwise false.
bool deleteSQL (const QCString &name,
const QCString &ver,
const QCString &provider="Oracle")
| deleteSQL |
[static]
Remove an SQL statement from a map. If the last version is removed from a statement it's definition is also removed.
Parameters:
name | Name to remove. |
ver | Version to remove. |
provider | Provider to delete. |
Returns: True if a version was found to be removed.
QString string (const QCString &name,const toConnection &conn)
| string |
[static]
Get the statement of an SQL.
Parameters:
name | Name of statement. |
conn | Connection to get version from. |
Returns: String containing the statement.
Throws: QString, with, description, of, problem, fetching, string.
QString string (const toSQL &sqldef,const toConnection &conn)
| string |
[static]
Get the statement of an SQL.
Parameters:
sqlDef | SQL to get name of statement from. |
conn | Connection to get version from. |
Returns: String containing the statement.
Throws: QString, with, description, of, problem, fetching, string.
QString description (const QCString &name)
| description |
[static]
Get description of an SQL.
Parameters:
name | Name of SQL to get name from.. |
Returns: String containing description.
Throws: QString, with, description, of, problem, fetching, string.
QString description (const toSQL &sql)
| description |
[static]
Get description of an SQL.
Parameters:
sqlDef | SQL to get name of statement from. |
Returns: String containing description.
Throws: QString, with, description, of, problem, fetching, string.
QCString sql (const QCString &name,const toConnection &conn)
| sql |
[static]
Get the statement of an SQL.
Parameters:
name | Name of statement. |
conn | Connection to get version from. |
Returns: String containing the statement.
Throws: QString, with, description, of, problem, fetching, string.
QCString sql (const toSQL &sqldef,const toConnection &conn)
| sql |
[static]
Get the statement of an SQL.
Parameters:
sqlDef | SQL to get name of statement from. |
conn | Connection to get version from. |
Returns: String containing the statement.
Throws: QString, with, description, of, problem, fetching, string.
toSQL sql (const QCString &name)
| sql |
[static]
Get an SQL from a specified name.
Parameters:
name | Name to get SQL for. |
Returns: a toSQL object for given name.
std::list<QCString> range (const QCString &startWith)
| range |
[static]
Get all defined names that start with a given substring.
Parameters:
startWith | The string that the name should start with. |
Returns: A list of names available.
bool saveSQL (const QString &file,bool all=false)
| saveSQL |
[static]
Save SQL definitions to file.
Parameters:
file | Filename to save to. |
all | If true all statements will be saved, otherwised only modified are saved. |
Returns: True if saved successfully.
void loadSQL (const QString &file)
| loadSQL |
[static]
Load definitions from file.
Parameters:
file | Filename to load from. |
Throws: s, QString, describing, the, problem, loading.
const sqlMap & definitions (void)
| definitions |
[static]
Get the entire map of SQL definitions
Returns: A reference to the map of definitions.
const QString operator () (const toConnection &conn)
| operator () |
[const]
Get the statement of an SQL.
Parameters:
conn | Connection to get version from. |
Returns: String containing the statement.
const QCString & name (void)
| name |
[const]
Get name of this SQL.
Returns: Name.
toSQL (const QCString &name,
const QString &sql,
const QString &description="",
const QCString &ver="8.1",
const QCString &provider="Oracle")
| toSQL |
Create a new SQL. Observe that the only thing this does is insert the supplied information into the definition map, deleting the SQL will not the information from the defitinion map. Only one description can be made for each statement name.
Parameters:
name | Name of SQL. |
sql | Statement of this SQL. |
description | Description of statement. |
ver | Version this statement applies to. |
provider | Provider this string is for. |