KDbResult

Search for usage in LXR

#include <KDbResult.shared.h>

Public Member Functions

 KDbResult (const QString &message)
 
 KDbResult (int code, const QString &message)
 
void clearSql ()
 
bool isError () const
 
void prependMessage (const QString &message)
 
void prependMessage (int code, const QString &message)
 
virtual KDbEscapedString recentSqlString () const
 
void setServerErrorCode (int errorCode)
 

Public Attributes

int code
 
KDbEscapedString errorSql
 
QString message
 
QString messageTitle
 
int serverErrorCode
 
bool serverErrorCodeSet
 
QString serverMessage
 
KDbEscapedString sql
 

Protected Member Functions

void init (int code, const QString &message)
 

Detailed Description

Stores detailed information about result of recent operation.

Definition at line 34 of file KDbResult.shared.h.

Member Function Documentation

◆ clearSql()

void KDbResult::clearSql ( )
inline

Efficient clearing of the sql attribute, equivalent of setSql(QString()).

Definition at line 110 of file KDbResult.shared.h.

◆ init()

void KDbResult::init ( int  code,
const QString message 
)
protected
Todo:

Definition at line 51 of file KDbResult.cpp.

◆ isError()

bool KDbResult::isError ( ) const
Returns
true if there is an error i.e. a nonempty message, error code other than ERR_NONE or server result has been set.

Definition at line 64 of file KDbResult.cpp.

◆ prependMessage() [1/2]

void KDbResult::prependMessage ( const QString message)

Prepends message to an existing message.

Definition at line 98 of file KDbResult.cpp.

◆ prependMessage() [2/2]

void KDbResult::prependMessage ( int  code,
const QString message 
)

Sets result code and prepends message to an existing message.

Todo:
IMPORTANT: ERRMSG(this);

Definition at line 80 of file KDbResult.cpp.

◆ recentSqlString()

virtual KDbEscapedString KDbResult::recentSqlString ( ) const
inlinevirtual
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 117 of file KDbResult.shared.h.

◆ setServerErrorCode()

void KDbResult::setServerErrorCode ( int  errorCode)

Sets an implementation-specific error code of server-side operation.

Use this to give users more precise information. Implies isError() == true. The only way to clear already set server result code is to create a new KDbResult object.

Definition at line 74 of file KDbResult.cpp.

Member Data Documentation

◆ code

int KDbResult::code

@getter

Returns
result code, default is ERR_NONE (0). @setter Sets the result code if there was error.

Definition at line 44 of file KDbResult.shared.h.

◆ message

QString KDbResult::message

@getter

Returns
(localized) message if there was error. @setter Sets (localized) message to message.

Definition at line 63 of file KDbResult.shared.h.

◆ messageTitle

QString KDbResult::messageTitle

@getter

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

Definition at line 70 of file KDbResult.shared.h.

◆ serverErrorCode

int KDbResult::serverErrorCode

@getter

Returns
an implementation-specific last server-side operation result number. Use this to give users more precise information about the result.

For example, use this for your driver - default implementation just returns 0. Note that this value is not the same as the one returned by code().

See also
serverMessage()

Definition at line 55 of file KDbResult.shared.h.

◆ serverMessage

QString KDbResult::serverMessage

@getter

Returns
message from server. KDb framework offers detailed result numbers using resultCode() and detailed result i18n-ed messages using message(). These both are (almost) not engine-dependent. Use setServerMessage() to users more information on the result of operation that is non-i18n-ed and engine-specific, usually coming from the server server side. @setter Sets message from the server.

Definition at line 86 of file KDbResult.shared.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Dec 8 2022 04:10:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.