kexi

#include <object.h>

Inheritance diagram for KexiDB::Object:
KexiDB::AdminTools KexiDB::AlterTableHandler KexiDB::Connection KexiDB::Cursor KexiDB::DatabaseProperties KexiDB::Driver KexiDB::DriverManager KexiDB::SimpleCommandLineApp KexiMigration::KexiMigrate KexiMigration::MigrateManager KexiPart::Manager KexiProject KexiProjectSet

Public Member Functions

bool error () const
const TQString & errorMsg () const
int errorNum () const
int previousServerResult () const
TQString previousServerResultName () const
void debugError ()
virtual void clearError ()
virtual TQString serverErrorMsg ()
virtual int serverResult ()
virtual TQString serverResultName ()
TQString msgTitle () const
const TQString recentSQLString () const

Protected Member Functions

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

Protected Attributes

TQString m_sql
TQString m_errorSql
int m_serverResult
TQString m_serverResultName
TQString m_serverErrorMsg
TQString m_errMsg

Friends

class MessageTitle

Detailed Description

Prototype of KexiDB object, handles result of last operation.

Definition at line 34 of file object.h.

Constructor & Destructor Documentation

◆ Object()

Object::Object ( MessageHandler * handler = 0)
protected

Definition at line 32 of file object.cpp.

◆ ~Object()

Object::~Object ( )
protectedvirtual

Definition at line 41 of file object.cpp.

Member Function Documentation

◆ askQuestion()

int Object::askQuestion ( const TQString & message,
KMessageBox::DialogType dlgType,
KMessageBox::ButtonCode defaultResult,
const KGuiItem & buttonYes = KStdGuiItem::yes(),
const KGuiItem & buttonNo = KStdGuiItem::no(),
const TQString & dontShowAskAgainName = TQString(),
int options = KMessageBox::Notify,
MessageHandler * msgHandler = 0 )
protectedvirtual

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.

◆ clearError()

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.

◆ debugError()

void Object::debugError ( )

Sends errorMsg() to debug output.

Definition at line 159 of file object.cpp.

◆ drv_clearServerResult()

virtual void KexiDB::Object::drv_clearServerResult ( )
inlineprotectedvirtual

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::pqxxSqlConnection, KexiDB::SQLiteConnection, and KexiMigration::MigrateManager.

Definition at line 158 of file object.h.

◆ error()

bool KexiDB::Object::error ( ) const
inline
Returns
true if there was error during last operation on the object.

Definition at line 38 of file object.h.

◆ errorMsg()

const TQString & 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.

◆ errorNum()

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.

◆ msgTitle()

TQString 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.

◆ previousServerResult()

int KexiDB::Object::previousServerResult ( ) const
inline
Returns
previous server result number, for error displaying purposes.

Definition at line 49 of file object.h.

◆ previousServerResultName()

TQString KexiDB::Object::previousServerResultName ( ) const
inline

Definition at line 51 of file object.h.

◆ recentSQLString()

const TQString 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.

◆ serverErrorMsg()

TQString 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::pqxxSqlConnection, KexiDB::SQLiteConnection, and KexiMigration::MigrateManager.

Definition at line 144 of file object.cpp.

◆ serverResult()

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::pqxxSqlConnection, KexiDB::SQLiteConnection, and KexiMigration::MigrateManager.

Definition at line 149 of file object.cpp.

◆ serverResultName()

TQString 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::pqxxSqlConnection, KexiDB::SQLiteConnection, and KexiMigration::MigrateManager.

Definition at line 154 of file object.cpp.

◆ setError() [1/5]

void Object::setError ( const TQString & msg)
protectedvirtual

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.

◆ setError() [2/5]

void Object::setError ( const TQString & title,
const TQString & msg )
protectedvirtual

Definition at line 74 of file object.cpp.

◆ setError() [3/5]

void Object::setError ( int code = ERR_OTHER,
const TQString & msg = TQString() )
protectedvirtual

Sets the (localized) error code to code and message to msg. You have to set at least nonzero error code code, although it is also adviced to set descriptive message msg. Eventually, if you omit all parameters, ERR_OTHER code will be set and default message for this will be set. Use this in KexiDB::Object subclasses to informa the world about your object's state.

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.

◆ setError() [4/5]

void Object::setError ( KexiDB::Object * obj,
const TQString & prependMessage = TQString() )
protected

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

Definition at line 91 of file object.cpp.

◆ setError() [5/5]

void Object::setError ( KexiDB::Object * obj,
int code,
const TQString & prependMessage = TQString() )
protectedvirtual

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

Definition at line 96 of file object.cpp.

◆ MessageTitle

friend class MessageTitle
friend

Definition at line 181 of file object.h.

Member Data Documentation

◆ m_errMsg

TQString KexiDB::Object::m_errMsg
protected

Definition at line 164 of file object.h.

◆ m_errorSql

TQString KexiDB::Object::m_errorSql
protected

Definition at line 161 of file object.h.

◆ m_serverErrorMsg

TQString KexiDB::Object::m_serverErrorMsg
protected

Definition at line 163 of file object.h.

◆ m_serverResult

int KexiDB::Object::m_serverResult
protected

Definition at line 162 of file object.h.

◆ m_serverResultName

TQString KexiDB::Object::m_serverResultName
protected

Definition at line 163 of file object.h.

◆ m_sql

TQString KexiDB::Object::m_sql
protected

used to store of actually executed SQL statement

Definition at line 161 of file object.h.


The documentation for this class was generated from the following files: