class toSQL

This class handles an abstraction of SQL statements used by TOra to extract information and manipulate data. More...

Definition#include <tosql.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Public Members


Detailed Description

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:
nameName of this SQL statement.
sqlStatement to execute for this SQL.
descriptionDescription of this SQL.
verVersion of database this statement is meant for.
providerDatabase provider this string is used for.
modifiedWether 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:
nameName to remove.
verVersion to remove.
providerProvider 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:
nameName of statement.
connConnection 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:
sqlDefSQL to get name of statement from.
connConnection 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:
nameName 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:
sqlDefSQL 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:
nameName of statement.
connConnection 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:
sqlDefSQL to get name of statement from.
connConnection 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:
nameName 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:
startWithThe 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:
fileFilename to save to.
allIf 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:
fileFilename 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:
connConnection to get version from.

Returns: String containing the statement.

const QCStringname (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:
nameName of SQL.
sqlStatement of this SQL.
descriptionDescription of statement.
verVersion this statement applies to.
providerProvider this string is for.