# class toConnection

More...

Definition | `#include <toconnection.h>`
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- class exception
- struct objectName
- class connectionImpl

#### Public Methods

- toConnection (const QCString &provider,const QString &user,const QString &password, const QString &host,const QString &database,const std::set<QString> &options, bool cache=true)
- toConnection (const toConnection &conn)
- virtual ~toConnection ()
- const std::set<QString> & options () const
- bool closeWidgets (void)
- const QString & user () const
- const QString & password () const
- void setPassword (const QString &pwd)
- const QString & host () const
- const QString & database () const
- const QCString & version () const
- const QCString & provider () const
- void setDatabase (const QString &database)
- virtual QString description (bool version=true) const
- void setNeedCommit (bool needCommit=true)
- bool needCommit (void) const
- virtual void commit (void)
- virtual void rollback (void)
- void parse (const QString &sql)
- void parse (const toSQL &sql)
- void execute (const toSQL &sql, toQList ¶ms)
- void execute (const QString &sql, toQList ¶ms)
- void execute (const toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- void execute (const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- void allExecute (const toSQL &sql, toQList ¶ms)
- void allExecute (const QString &sql, toQList ¶ms)
- void allExecute (const toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- void allExecute (const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)
- void addWidget (QObject *widget)
- void delWidget (QObject *widget)
- void addInit (const QString &sql)
- void delInit (const QString &sql)
- const std::list<QString> & initStrings () const
- QString quote (const QString &name)
- QString unQuote (const QString &name)
- std::list<objectName> & objects (bool block)
- void addIfNotExists (objectName &object)
- virtual toSyntaxAnalyzer & analyzer ()
- std::map<QString,objectName> & synonyms (bool block)
- toQDescList & columns (const objectName &table,bool nocache=false)
- void rereadCache (void)
- const objectName & realName (const QString &object,bool block)
- const objectName & realName (const QString &object,QString &synonym,bool block)
- bool cacheAvailable (bool synonyms,bool block=false,bool need=true)
- void cancelAll (void)
- bool loadDiskCache (void)
- void writeDiskCache (void)
- std::list<QString> running (void)

#### Public Static Methods

- static QString cacheDir ()

#### Public Members

- friend class toQuery

## Detailed Description

TOra - An Oracle Toolkit for DBA's and developers Copyright (C) 2003-2005 Quest Software, Inc Portions Copyright (C) 2005 Other Contributors

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; only version 2 of the License is valid for this program.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

As a special exception, you have permission to link this program with the Oracle Client libraries and distribute executables, as long as you follow the requirements of the GNU GPL in regard to all of the software in the executable aside from Oracle client libraries.

Specifically you are not permitted to link this program with the Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech. And you are not permitted to distribute binaries compiled against these libraries without written consent from Quest Software, Inc. Observe that this does not disallow linking to the Qt Free Edition.

You may link this product with any GPL'd Qt library such as Qt/Free

All trademarks belong to their respective owners.

***

exception (class)

### exception

Class that could be used to throw exceptions in connection errors. Must use if you want to indicate error offset.

objectName (struct)

### objectName

Contain information about a tablename.

connectionImpl (class)

### connectionImpl

This class is an abstract baseclass to actually implement the comunication with the database. (See also toQuery::queryImpl and toConnectionProvider)

toConnection (const QCString &provider,const QString &user,const QString &password, const QString &host,const QString &database,const std::set<QString> &options, bool cache=true)

### toConnection

Create a new connection.

Parameters:

provider | Which database provider to use for this connection. (See to toDatabaseConnection)
user | User to connect to the database with.
password | Password to connect with.
host | Host to connect to the database with.
database | Database to connect to.
options | Options used to connect to the database with.
cache | Enable object cache for this connection.

toConnection (const toConnection &conn)

### toConnection

Create a copy of a connection. Will not cache objects, so objects will never be available in a subconnection.

Parameters:

conn | Connection to copy.

~toConnection ()

### ~toConnection

[virtual]

Destroy connection.

const std::set<QString> & options ()

### options

[const]

bool closeWidgets (void)

### closeWidgets

Try to close all the widgets associated with this connection.

Returns: True if all widgets agreed to close.

const QString & user ()

### user

[const]

Get username of connection.

const QString & password ()

### password

[const]

Get password of connection.

void setPassword (const QString &pwd)

### setPassword

Change password of connection.

const QString & host ()

### host

[const]

Get host of connection.

const QString & database ()

### database

[const]

Get database of connection.

const QCString & version ()

### version

[const]

Get version of connection.

const QCString & provider ()

### provider

[const]

Get provider of connection.

void setDatabase (const QString &database)

### setDatabase

Change the current database. Observe that this only changes the record of what is the current database. You will still need to change the database oppinion on what database is the current one.

QString description (bool version=true)

### description

[const virtual]

Get a description of this connection.

void setNeedCommit (bool needCommit=true)

### setNeedCommit

Set if this connection needs to be commited.

bool needCommit (void)

### needCommit

[const]

Get information about if the connection has uncommited data.

Returns: Whether uncommited data is available.

void commit (void)

### commit

[virtual]

Commit connection. This will also close all extra connections except one.

void rollback (void)

### rollback

[virtual]

Rollback connection. This will also close all extra connections except one.

void parse (const QString &sql)

### parse

Parse a query on an actual connection and report any syntax problems encountered. Defaults to not implemented.

Parameters:

conn | Connection to execute on.
sql | SQL to parse

void parse (const toSQL &sql)

### parse

Parse a query on an actual connection and report any syntax problems encountered. Defaults to not implemented.

Parameters:

conn | Connection to execute on.
sql | SQL to parse

void execute (const toSQL &sql, toQList ¶ms)

### execute

Execute a statement without caring about the result.

Parameters:

sql | SQL to execute
params | Parameters to pass to query.

void execute (const QString &sql, toQList ¶ms)

### execute

Execute a statement without caring about the result.

Parameters:

sql | SQL to execute
params | Parameters to pass to query.

void execute (const toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

### execute

Execute a statement without caring about the result.

Parameters:

sql | SQL to execute
arg1 | Parameters to pass to query.

void execute (const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

### execute

Execute a statement without caring about the result.

Parameters:

sql | SQL to execute
arg1 | Parameters to pass to query.

void allExecute (const toSQL &sql, toQList ¶ms)

### allExecute

Execute a statement without caring about the result on all open database connections.

Parameters:

sql | SQL to execute
params | Parameters to pass to query.

void allExecute (const QString &sql, toQList ¶ms)

### allExecute

Execute a statement without caring about the result on all open database connections.

Parameters:

sql | SQL to execute
params | Parameters to pass to query.

void allExecute (const toSQL &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

### allExecute

Execute a statement without caring about the result on all open database connections.

Parameters:

sql | SQL to execute
arg1 | Parameters to pass to query.

void allExecute (const QString &sql, const QString &arg1=QString::null,const QString &arg2=QString::null, const QString &arg3=QString::null,const QString &arg4=QString::null, const QString &arg5=QString::null,const QString &arg6=QString::null, const QString &arg7=QString::null,const QString &arg8=QString::null, const QString &arg9=QString::null)

### allExecute

Execute a statement without caring about the result on all open database connections.

Parameters:

sql | SQL to execute
arg1 | Parameters to pass to query.

void addWidget (QObject *widget)

### addWidget

Add a object that uses this connection. This is needed to ensure that all widgets that make use of a connection are destroyed when the connection is closed. Usually tool windows need to call this function.

Parameters:

widget | The widget to add to the connection.

void delWidget (QObject *widget)

### delWidget

Remove a widget from this connection. Should be called by the destructor of the widget that has called addWidget.

Parameters:

widget | Widget to remove from the widget list.

See also: addWidget

void addInit (const QString &sql)

### addInit

Add a statement to be run uppon making new connections.

Parameters:

sql | Statement to run.

void delInit (const QString &sql)

### delInit

Remove a statement that was added using addInit.

const std::list<QString> & initStrings ()

### initStrings

[const]

Get a list of the current init strings.

QString quote (const QString &name)

### quote

Return a string representation to address an object.

Parameters:

name | The name to be quoted.

Returns: String addressing table.

QString unQuote (const QString &name)

### unQuote

Perform the opposite of quote.

Parameters:

name | The name to be un-quoted.

Returns: String addressing table.

std::list<objectName> & objects (bool block)

### objects

Get the objects available for the current user. Do not modify the returned list.

Parameters:

block | Indicate wether or not to block until cached objects are available.

Returns: A list of object available for the current user. The list is sorted in owner and name order.

void addIfNotExists (objectName &object)

### addIfNotExists

Add a new object to the objectlist if it doesn't exist already.

Parameters:

object | The object to add

toSyntaxAnalyzer & analyzer ()

### analyzer

[virtual]

Get syntax analyzer for connection

Returns: A reference to the syntax analyzer to use for the connection.

std::map<QString,objectName> & synonyms (bool block)

### synonyms

Get the synonyms available for objects. Do not modify the returned list.

Parameters:

block | Indicate wether or not to block until cached objects are available.

Returns: A list of synonyms to objects available for the current user.

toQDescList & columns (const objectName &table,bool nocache=false)

### columns

Get a list of the available columns for a table. This function caches the responses and should be fairly fast after the first call. Do not modify the returned list.

Parameters:

table | The table to describe.
nocache | Don't use cached values even if they are available.

Returns: A list of the columns for a table.

void rereadCache (void)

### rereadCache

Reread the object and column cache.

const objectName & realName (const QString &object,bool block)

### realName

Get the real object name of an object.

Parameters:

object | Object name
block | Block if not done caching object.

const objectName & realName (const QString &object,QString &synonym,bool block)

### realName

Get the real object name of a synonym.

Parameters:

object | Object name
synonym | Filled with the synonym used to access the object returned or empty.
block | Block if not done caching object.

bool cacheAvailable (bool synonyms,bool block=false,bool need=true)

### cacheAvailable

Check if cache is available or not.

Parameters:

synonyms | If synonyms are needed or not.
block | Block until cache is done.
true | True if you need the cache, or just checking.

Returns: True if cache is available.

void cancelAll (void)

### cancelAll

Try to stop all running queries.

bool loadDiskCache (void)

### loadDiskCache

load disk cache

void writeDiskCache (void)

### writeDiskCache

write disk cache

std::list<QString> running (void)

### running

Get a list of currently running SQL.

QString cacheDir ()

### cacheDir

[static]

friend class toQuery

### toQuery

Generated by: nneul on skyhawk on Wed Feb 23 19:49:58 2005, using kdoc 2.0a54.