Kexi API Documentation (2.0 alpha)

KexiDB::Object Class Reference

#include <object.h>

Inheritance diagram for KexiDB::Object:

KexiDB::AdminTools KexiDB::AlterTableHandler KexiDB::Connection KexiDB::Cursor KexiDB::DatabaseProperties KexiDB::Driver KexiDB::DriverManager KexiDB::DriverManagerInternal KexiDB::SimpleCommandLineApp KexiMigration::KexiMigrate KexiMigration::MigrateManager KexiMigration::MigrateManagerInternal KexiPart::Manager KexiProject KexiProjectSet List of all members.

Detailed Description

Prototype of KexiDB object, handles result of last operation.

Definition at line 34 of file object.h.

Public Member Functions

bool error () const
const QStringerrorMsg () const
int errorNum () const
int previousServerResult () const
QString previousServerResultName () const
void debugError ()
virtual void clearError ()
virtual QString serverErrorMsg ()
virtual int serverResult ()
virtual QString serverResultName ()
QString msgTitle () const
const QString recentSQLString () const

Protected Member Functions

 Object (MessageHandler *handler=0)
virtual ~Object ()
virtual void setError (int code=ERR_OTHER, const QString &msg=QString::null)
virtual void setError (const QString &msg)
virtual void setError (const QString &title, const QString &msg)
void setError (KexiDB::Object *obj, const QString &prependMessage=QString::null)
virtual void setError (KexiDB::Object *obj, int code, const QString &prependMessage=QString::null)
virtual int askQuestion (const QString &message, KMessageBox::DialogType dlgType, KMessageBox::ButtonCode defaultResult, const KGuiItem &buttonYes=KStdGuiItem::yes(), const KGuiItem &buttonNo=KStdGuiItem::no(), const QString &dontShowAskAgainName=QString::null, int options=KMessageBox::Notify, MessageHandler *msgHandler=0)
virtual void drv_clearServerResult ()

Protected Attributes

QString m_sql
 used to store of actually executed SQL statement
QString m_errorSql
 used to store of actually executed SQL statement
int m_serverResult
QString m_serverResultName
QString m_serverErrorMsg
QString m_errMsg

Friends

class MessageTitle


Constructor & Destructor Documentation

Object::Object MessageHandler handler = 0  )  [protected]
 

Definition at line 32 of file object.cpp.

References clearError().

Object::~Object  )  [protected, virtual]
 

Definition at line 41 of file object.cpp.


Member Function Documentation

int Object::askQuestion const QString message,
KMessageBox::DialogType  dlgType,
KMessageBox::ButtonCode  defaultResult,
const KGuiItem &  buttonYes = KStdGuiItem::yes(),
const KGuiItem &  buttonNo = KStdGuiItem::no(),
const QString dontShowAskAgainName = QString::null,
int  options = KMessageBox::Notify,
MessageHandler msgHandler = 0
[protected, virtual]
 

Interactively asks a question. Console or GUI can be used for this, depending on installed message handler. For GUI version, KMessageBox class is used. See KexiDB::MessageHandler::askQuestion() for details.

Definition at line 174 of file object.cpp.

References KexiDB::MessageHandler::askQuestion().

Referenced by KexiDB::SQLiteConnection::drv_useDatabase().

void Object::clearError  )  [virtual]
 

Clears error flag. Also calls drv_clearServerResult(). You can reimplement this method in subclasses to clear even more members, but remember to also call Object::clearError().

Reimplemented in KexiDB::Connection.

Definition at line 131 of file object.cpp.

References drv_clearServerResult(), m_errMsg, m_errorSql, m_serverErrorMsg, m_serverResult, m_serverResultName, and m_sql.

Referenced by KexiPart::Manager::checkProject(), KexiDB::Connection::clearError(), KexiProject::createConnection(), KexiDB::Driver::createConnection(), KexiProject::createPartItem(), KexiDB::Cursor::deleteAllRows(), KexiDB::Cursor::deleteRow(), KexiMigration::MigrateManagerInternal::driver(), KexiDB::DriverManagerInternal::driver(), KexiProject::findPartFor(), KexiDB::Cursor::insertRow(), KexiProjectSet::KexiProjectSet(), KexiMigration::MigrateManagerInternal::lookupDrivers(), KexiDB::DriverManagerInternal::lookupDrivers(), Object(), KexiProject::openObject(), KexiPart::Manager::part(), KexiDB::Driver::removeConnection(), KexiProject::removeObject(), KexiProject::renameObject(), KexiDB::DriverManager::serviceInfo(), KexiDB::Cursor::updateRow(), SQLiteAdminTools::vacuum(), and KexiDB::AdminTools::vacuum().

void Object::debugError  ) 
 

Sends errorMsg() to debug output.

Definition at line 159 of file object.cpp.

References error(), errorMsg(), KexiDBDbg, serverErrorMsg(), serverResult(), and serverResultName().

Referenced by KexiSimplePrintingEngine::init(), KexiMigration::KexiMigrate::performImport(), and KexiTableDesignerView::storeData().

virtual void KexiDB::Object::drv_clearServerResult  )  [inline, 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 in KexiDB::Cursor, KexiDB::DriverManager, KexiDB::MySqlConnection, KexiDB::MySqlCursor, KexiDB::pqxxSqlConnection, KexiDB::pqxxSqlCursor, KexiDB::SQLiteConnection, KexiDB::SQLiteCursor, and KexiMigration::MigrateManager.

Definition at line 158 of file object.h.

Referenced by clearError().

bool KexiDB::Object::error  )  const [inline]
 

Returns:
true if there was error during last operation on the object.

Reimplemented in KexiProject.

Definition at line 38 of file object.h.

Referenced by KexiDB::Connection::beginAutoCommitTransaction(), KexiMigration::KexiMigrate::checkIfDestinationDatabaseOverwritingNeedsAccepting(), KexiDB::Connection::commitTransaction(), debugError(), KexiMigration::MigrateManager::driver(), KexiDB::DriverManager::driver(), KexiDB::DriverManager::driverInfo(), KexiDB::DriverManagerInternal::driverInfo(), KexiMigration::MigrateManager::driverNames(), KexiDB::DriverManager::driverNames(), KexiDB::Connection::drv_databaseExists(), KexiDB::SQLiteConnection::drv_getTablesList(), KexiDB::pqxxSqlConnection::drv_getTablesList(), KexiDB::MySqlConnection::drv_getTablesList(), KexiProject::error(), KexiSimplePrintingEngine::init(), KexiCSVExport::exportData(), KexiProjectSet::KexiProjectSet(), KexiMigration::ImportWizard::next(), KexiDB::Cursor::open(), KexiPart::Manager::part(), KexiDB::Connection::querySingleRecordInternal(), KexiDB::Connection::querySingleString(), KexiDB::Connection::queryStringList(), KexiDB::Connection::resultExists(), KexiDB::Connection::rollbackTransaction(), KexiProjectSelectorWidget::setProjectSet(), KexiDB::Connection::setupTableSchema(), SimpleCommandLineApp::openDatabase(), and KexiDB::Connection::useDatabase().

const QString& KexiDB::Object::errorMsg  )  const [inline]
 

Returns:
(localized) error message if there was error during last operation on the object, else: 0.

Definition at line 42 of file object.h.

Referenced by KexiProject::createConnection(), debugError(), KexiMigration::MigrateManager::driver(), KexiMigration::MigrateManager::driverNames(), KexiStartupHandler::init(), internalReason(), and KexiDB::Connection::loadExtendedTableSchemaData().

int KexiDB::Object::errorNum  )  const [inline]
 

Returns:
error number of if there was error during last operation on the object, else: 0.

Definition at line 46 of file object.h.

Referenced by setError(), and KexiDB::Connection::useTemporaryDatabaseIfNeeded().

QString KexiDB::Object::msgTitle  )  const [inline]
 

Returns:
message title that sometimes is provided and prepended to the main warning/error message. Used by MessageHandler.

Definition at line 100 of file object.h.

int KexiDB::Object::previousServerResult  )  const [inline]
 

Returns:
previous server result number, for error displaying purposes.

Definition at line 49 of file object.h.

QString KexiDB::Object::previousServerResultName  )  const [inline]
 

Definition at line 51 of file object.h.

const QString KexiDB::Object::recentSQLString  )  const [inline]
 

Returns:
sql string of actually executed SQL statement, usually using drv_executeSQL(). If there was error during executing SQL statement, before, that string is returned instead.

Definition at line 105 of file object.h.

QString Object::serverErrorMsg  )  [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 in KexiDB::Cursor, KexiDB::DriverManager, KexiDB::MySqlConnection, KexiDB::MySqlCursor, KexiDB::pqxxSqlConnection, KexiDB::SQLiteConnection, KexiDB::SQLiteCursor, and KexiMigration::MigrateManager.

Definition at line 144 of file object.cpp.

References m_serverErrorMsg.

Referenced by debugError(), and KexiDB::SQLiteConnection::serverErrorMsg().

int Object::serverResult  )  [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 in KexiDB::Cursor, KexiDB::DriverManager, KexiDB::MySqlConnection, KexiDB::MySqlCursor, KexiDB::pqxxSqlConnection, KexiDB::SQLiteConnection, KexiDB::SQLiteCursor, and KexiMigration::MigrateManager.

Definition at line 149 of file object.cpp.

References m_serverResult.

Referenced by debugError(), and KexiDB::SQLiteConnection::serverResult().

QString Object::serverResultName  )  [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 in KexiDB::Cursor, KexiDB::DriverManager, KexiDB::MySqlConnection, KexiDB::MySqlCursor, KexiDB::pqxxSqlConnection, KexiDB::SQLiteConnection, KexiDB::SQLiteCursor, and KexiMigration::MigrateManager.

Definition at line 154 of file object.cpp.

References m_serverResultName.

Referenced by debugError(), and KexiDB::SQLiteConnection::serverResultName().

void Object::setError KexiDB::Object obj,
int  code,
const QString prependMessage = QString::null
[protected, virtual]
 

Copies the (localized) error message and code from other KexiDB::Object with custom error code.

Definition at line 96 of file object.cpp.

References ERR_OTHER, ERRMSG, m_errMsg, m_errorSql, m_serverErrorMsg, m_serverResult, m_serverResultName, m_sql, setError(), and STORE_PREV_ERR.

void Object::setError KexiDB::Object obj,
const QString prependMessage = QString::null
[protected]
 

Copies the (localized) error message and code from other KexiDB::Object.

Definition at line 91 of file object.cpp.

References ERR_OTHER, errorNum(), and setError().

void Object::setError const QString title,
const QString msg
[protected, virtual]
 

Definition at line 74 of file object.cpp.

References ERR_OTHER, ERRMSG, m_errMsg, m_errorSql, m_sql, and STORE_PREV_ERR.

void KexiDB::Object::setError const QString msg  )  [protected, virtual]
 

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

Also sets title.

Definition at line 69 of file object.cpp.

References ERR_OTHER, and setError().

void KexiDB::Object::setError int  code = ERR_OTHER,
const QString msg = QString::null
[protected, virtual]
 

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

Sets error code to ERR_OTHER. Use this if you don't care about setting error code.

Definition at line 53 of file object.cpp.

References ERR_NONE, ERR_OTHER, ERRMSG, m_errMsg, m_errorSql, m_sql, and STORE_PREV_ERR.

Referenced by KexiDB::Connection::alterTable(), KexiDB::Connection::alterTableName(), KexiDB::Connection::beginTransaction(), KexiDB::DatabaseProperties::caption(), KexiDB::Connection::checkConnected(), KexiDB::Connection::checkIfColumnExists(), KexiDB::Connection::checkIsDatabaseUsed(), KexiPart::Manager::checkProject(), KexiProject::checkWritable(), KexiProject::closeConnection(), KexiDB::Connection::commitTransaction(), KexiDB::Connection::connect(), KexiProject::create(), KexiProject::createConnection(), KexiDB::Driver::createConnection(), KexiDB::Connection::createDatabase(), KexiProject::createPartItem(), KexiDB::Connection::createTable(), KexiDB::Connection::databaseExists(), KexiDB::Connection::deleteAllRows(), KexiDB::Connection::deleteRow(), KexiMigration::MigrateManager::driver(), KexiMigration::MigrateManagerInternal::driver(), KexiDB::DriverManager::driver(), KexiDB::DriverManagerInternal::driver(), KexiMigration::MigrateManager::driverForMimeType(), KexiDB::DriverManager::driverInfo(), KexiDB::DriverManagerInternal::driverInfo(), KexiDB::Connection::dropDatabase(), KexiDB::Connection::dropQuery(), KexiDB::Connection::dropTable(), KexiDB::SQLiteConnection::drv_closeDatabase(), KexiDB::pqxxSqlConnection::drv_commitTransaction(), KexiDB::Connection::drv_databaseExists(), KexiDB::SQLiteConnection::drv_dropDatabase(), KexiDB::pqxxSqlCursor::drv_open(), KexiDB::MySqlCursor::drv_open(), KexiDB::SQLiteConnection::drv_useDatabase(), KexiDB::AlterTableHandler::execute(), KexiDB::Connection::executeQuery(), KexiDB::Connection::executeSQL(), KexiProject::findPartFor(), KexiDB::Cursor::getNextRecord(), KexiPart::Manager::infoForMimeType(), KexiProject::initProject(), KexiDB::Connection::insertRow(), KexiMigration::KexiMigrate::isValid(), KexiProjectSet::KexiProjectSet(), KexiDB::DriverManager::lookupByMime(), KexiMigration::MigrateManagerInternal::lookupDrivers(), KexiDB::DriverManagerInternal::lookupDrivers(), KexiDB::DatabaseProperties::names(), KexiDB::Cursor::open(), KexiProject::openInternal(), KexiProject::openObject(), KexiPart::Manager::part(), KexiDB::Connection::querySingleRecordInternal(), KexiDB::Connection::queryStringList(), KexiProject::removeObject(), KexiDB::Connection::removeObject(), KexiProject::renameObject(), KexiDB::Connection::resultExists(), KexiDB::Connection::rollbackTransaction(), KexiDB::DriverManager::serviceInfo(), KexiDB::DatabaseProperties::setCaption(), setError(), KexiDB::Connection::setupField(), KexiDB::Connection::setupObjectSchemaData(), KexiDB::Connection::setupQuerySchema(), KexiDB::Connection::setupTableSchema(), KexiDB::DatabaseProperties::setValue(), SimpleCommandLineApp::closeDatabase(), SimpleCommandLineApp::openDatabase(), KexiDB::Connection::updateRow(), KexiDB::Connection::useDatabase(), KexiDB::Connection::useTemporaryDatabaseIfNeeded(), and SQLiteAdminTools::vacuum().


Friends And Related Function Documentation

friend class MessageTitle [friend]
 

Definition at line 181 of file object.h.


Member Data Documentation

QString KexiDB::Object::m_errMsg [protected]
 

Definition at line 164 of file object.h.

Referenced by clearError(), KexiDB::Connection::executeSQL(), and setError().

QString KexiDB::Object::m_errorSql [protected]
 

used to store of actually executed SQL statement

Definition at line 158 of file object.h.

Referenced by clearError(), KexiDB::Connection::executeSQL(), and setError().

QString KexiDB::Object::m_serverErrorMsg [protected]
 

Definition at line 163 of file object.h.

Referenced by clearError(), serverErrorMsg(), and setError().

int KexiDB::Object::m_serverResult [protected]
 

Definition at line 162 of file object.h.

Referenced by clearError(), serverResult(), and setError().

QString KexiDB::Object::m_serverResultName [protected]
 

Reimplemented in KexiDB::DriverManagerInternal, and KexiMigration::MigrateManagerInternal.

Definition at line 163 of file object.h.

Referenced by clearError(), serverResultName(), and setError().

QString KexiDB::Object::m_sql [protected]
 

used to store of actually executed SQL statement

Definition at line 158 of file object.h.

Referenced by clearError(), KexiDB::Connection::clearError(), KexiDB::Connection::Connection(), KexiDB::Connection::deleteAllRows(), KexiDB::Connection::deleteRow(), KexiDB::Connection::drv_beginTransaction(), KexiDB::Connection::drv_createTable(), KexiDB::Connection::drv_dropTable(), KexiDB::SQLiteConnection::drv_getTablesList(), KexiDB::pqxxSqlConnection::drv_getTablesList(), KexiDB::MySqlConnection::drv_getTablesList(), KexiDB::SQLiteCursor::drv_open(), KexiDB::pqxxSqlCursor::drv_open(), KexiDB::MySqlCursor::drv_open(), KexiDB::Connection::executeSQL(), KexiDB::Connection::insertRecord(), KexiDB::Connection::insertRow(), KexiDB::Cursor::open(), KexiDB::Connection::querySingleRecordInternal(), KexiDB::Connection::querySingleString(), KexiDB::Connection::queryStringList(), KexiDB::Connection::resultExists(), setError(), and KexiDB::Connection::updateRow().


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:46 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003