Kexi API Documentation (2.0 alpha)

KexiDB::MySqlConnection Class Reference

#include <mysqlconnection.h>

Inheritance diagram for KexiDB::MySqlConnection:

KexiDB::Connection KexiDB::Object List of all members.

Detailed Description

Should override kexiDB/kexiDB all other members are done by the base class.

Definition at line 40 of file mysqlconnection.h.

Public Member Functions

virtual ~MySqlConnection ()
virtual CursorprepareQuery (const QString &statement=QString::null, uint cursor_options=0)
virtual CursorprepareQuery (QuerySchema &query, uint cursor_options=0)
virtual PreparedStatement::Ptr prepareStatement (PreparedStatement::StatementType type, FieldList &fields)

Protected Member Functions

 MySqlConnection (Driver *driver, ConnectionData &conn_data)
virtual bool drv_connect (KexiDB::ServerVersionInfo &version)
virtual bool drv_disconnect ()
virtual bool drv_getDatabasesList (QStringList &list)
virtual bool drv_createDatabase (const QString &dbName=QString::null)
virtual bool drv_useDatabase (const QString &dbName=QString::null, bool *cancelled=0, MessageHandler *msgHandler=0)
virtual bool drv_closeDatabase ()
virtual bool drv_dropDatabase (const QString &dbName=QString::null)
virtual bool drv_executeSQL (const QString &statement)
virtual Q_ULLONG drv_lastInsertRowID ()
virtual int serverResult ()
virtual QString serverResultName ()
virtual QString serverErrorMsg ()
virtual void drv_clearServerResult ()
virtual bool drv_getTablesList (QStringList &list)
virtual bool drv_containsTable (const QString &tableName)

Protected Attributes

MySqlConnectionInternald
 for future extensions

Friends

class MySqlDriver
class MySqlCursor


Constructor & Destructor Documentation

MySqlConnection::~MySqlConnection  )  [virtual]
 

Definition at line 49 of file mysqlconnection.cpp.

References KexiDB::Connection::destroy().

MySqlConnection::MySqlConnection Driver driver,
ConnectionData conn_data
[protected]
 

Used by driver

Definition at line 43 of file mysqlconnection.cpp.


Member Function Documentation

void MySqlConnection::drv_clearServerResult  )  [protected, virtual]
 

Clears number of last server operation's result stored as a single integer. Formally, this integer should be set to value that means "NO ERRORS" or "OK". This method is called by clearError(). For reimplementation. By default does nothing.

See also:
serverErrorMsg()

Reimplemented from KexiDB::Object.

Definition at line 162 of file mysqlconnection.cpp.

References d.

bool MySqlConnection::drv_closeDatabase  )  [protected, virtual]
 

For reimplemenation: closes previously opened database using connection.

Implements KexiDB::Connection.

Definition at line 131 of file mysqlconnection.cpp.

bool MySqlConnection::drv_connect KexiDB::ServerVersionInfo version  )  [protected, virtual]
 

Todo:
this is hardcoded for now; define api for retrieving variables and use this API...
addLimitTo1

Implements KexiDB::Connection.

Definition at line 53 of file mysqlconnection.cpp.

References d, KexiDB::Connection::data(), KexiDB::ServerVersionInfo::major, KexiDB::ServerVersionInfo::minor, KexiDB::Connection::querySingleString(), KexiDB::ServerVersionInfo::release, KexiDB::ServerVersionInfo::string, and versionString().

bool MySqlConnection::drv_containsTable const QString tableName  )  [protected, virtual]
 

LOW LEVEL METHOD. For reimplemenation: returns true if table with name tableName exists in the database.

Returns:
false if it does not exist or error occurred. The lookup is case insensitive.

Implements KexiDB::Connection.

Definition at line 174 of file mysqlconnection.cpp.

References KexiDB::Connection::driver(), and KexiDB::Connection::resultExists().

bool MySqlConnection::drv_createDatabase const QString dbName = QString::null  )  [protected, virtual]
 

For reimplemenation: creates new database using connection

Implements KexiDB::Connection.

Definition at line 114 of file mysqlconnection.cpp.

References d, drv_executeSQL(), and KexiDBDrvDbg.

bool MySqlConnection::drv_disconnect  )  [protected, virtual]
 

For reimplemenation: disconnects database

Returns:
true on success.

Implements KexiDB::Connection.

Definition at line 83 of file mysqlconnection.cpp.

References d.

bool MySqlConnection::drv_dropDatabase const QString dbName = QString::null  )  [protected, virtual]
 

For reimplemenation: drops database from the server using connection. After drop, database shouldn't be accessible anymore.

Implements KexiDB::Connection.

Definition at line 137 of file mysqlconnection.cpp.

References drv_executeSQL().

bool MySqlConnection::drv_executeSQL const QString statement  )  [protected, virtual]
 

Executes query statement, but without returning resulting rows (used mostly for functional queries). Only use this method if you really need.

Implements KexiDB::Connection.

Definition at line 142 of file mysqlconnection.cpp.

References d.

Referenced by drv_createDatabase(), and drv_dropDatabase().

bool MySqlConnection::drv_getDatabasesList QStringList &  list  )  [protected, virtual]
 

For reimplemenation: loads list of databases' names available for this connection and adds these names to list. If your server is not able to offer such a list, consider reimplementing drv_databaseExists() instead. The method should return true only if there was no error on getting database names list from the server. Default implementation puts empty list into list and returns true.

Reimplemented from KexiDB::Connection.

Definition at line 95 of file mysqlconnection.cpp.

References d, and KexiDBDrvDbg.

bool MySqlConnection::drv_getTablesList QStringList &  list  )  [protected, virtual]
 

LOW LEVEL METHOD. For reimplemenation: loads low-level list of table names available for this connection. The names are in lower case. The method should return true only if there was no error on getting database names list from the server.

Implements KexiDB::Connection.

Definition at line 181 of file mysqlconnection.cpp.

References KexiDB::Connection::deleteCursor(), KexiDB::Cursor::eof(), KexiDB::Object::error(), KexiDB::Connection::executeQuery(), KexiDBDbg, KexiDB::Object::m_sql, KexiDB::Cursor::moveFirst(), KexiDB::Cursor::moveNext(), and KexiDB::Cursor::value().

Q_ULLONG MySqlConnection::drv_lastInsertRowID  )  [protected, virtual]
 

Todo:

Implements KexiDB::Connection.

Definition at line 146 of file mysqlconnection.cpp.

References d.

bool MySqlConnection::drv_useDatabase const QString dbName = QString::null,
bool *  cancelled = 0,
MessageHandler msgHandler = 0
[protected, virtual]
 

For reimplemenation: opens existing database using connection

Returns:
true on success, false on failure and cancelled if user has cancelled this action.

Implements KexiDB::Connection.

Definition at line 123 of file mysqlconnection.cpp.

References d.

Cursor * MySqlConnection::prepareQuery QuerySchema query,
uint  cursor_options = 0
[virtual]
 

Implements KexiDB::Connection.

Definition at line 91 of file mysqlconnection.cpp.

References MySqlCursor.

Cursor * MySqlConnection::prepareQuery const QString statement = QString::null,
uint  cursor_options = 0
[virtual]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Statement is build from data provided by table schema, it is like "select * from table_name".

Implements KexiDB::Connection.

Definition at line 87 of file mysqlconnection.cpp.

References MySqlCursor.

PreparedStatement::Ptr MySqlConnection::prepareStatement PreparedStatement::StatementType  type,
FieldList fields
[virtual]
 

Prepare a SQL statement and return a PreparedStatement instance.

Implements KexiDB::Connection.

Definition at line 202 of file mysqlconnection.cpp.

References d.

QString MySqlConnection::serverErrorMsg  )  [protected, virtual]
 

KexiDB library offers detailed error numbers using errorNum() and detailed error i18n'd messages using errorMsg() - this information is not engine-dependent (almost). Use this in your application to give users more information on what's up.

This method returns (non-i18n'd !) engine-specific error message, if there was any error during last server-side operation, otherwise null string. Reimplement this for your driver

Reimplemented from KexiDB::Object.

Definition at line 169 of file mysqlconnection.cpp.

References d.

int MySqlConnection::serverResult  )  [protected, virtual]
 

Returns:
engine-specific last server-side operation result number. Use this in your application to give users more information on what's up.
Reimplement this for your driver - default implementation just returns 0. Note that this result value is not the same as the one returned by errorNum() (Object::m_errno member)
See also:
serverErrorMsg(), drv_clearServerResult()

Reimplemented from KexiDB::Object.

Definition at line 152 of file mysqlconnection.cpp.

References d.

QString MySqlConnection::serverResultName  )  [protected, virtual]
 

Returns:
engine-specific last server-side operation result name, (name for serverResult()). Use this in your application to give users more information on what's up.
Reimplement this for your driver - default implementation just returns null string. Note that this result name is not the same as the error message returned by serverErorMsg() or erorMsg()
See also:
serverErrorMsg(), drv_clearServerResult()

Reimplemented from KexiDB::Object.

Definition at line 157 of file mysqlconnection.cpp.


Friends And Related Function Documentation

friend class MySqlCursor [friend]
 

Definition at line 82 of file mysqlconnection.h.

Referenced by prepareQuery().

friend class MySqlDriver [friend]
 

Definition at line 81 of file mysqlconnection.h.


Member Data Documentation

MySqlConnectionInternal* KexiDB::MySqlConnection::d [protected]
 

for future extensions

Reimplemented from KexiDB::Connection.

Definition at line 79 of file mysqlconnection.h.

Referenced by drv_clearServerResult(), drv_connect(), drv_createDatabase(), drv_disconnect(), drv_executeSQL(), drv_getDatabasesList(), drv_lastInsertRowID(), drv_useDatabase(), prepareStatement(), serverErrorMsg(), and serverResult().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:50:41 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003