ua.gradsoft.xwikisql
Interface SqlErrorable

All Known Subinterfaces:
SqlResult
All Known Implementing Classes:
InMemorySqlResult, SqlDatabase

public interface SqlErrorable

Generic interface for objects, which can track sql errors.


Method Summary
 void clearError()
          clear all information about error, so wasError become false.
 java.lang.Exception getLastException()
          get last Exception
 boolean getLogEnabled()
          when this propery is set to true - do logging according with settings in xwiki configurations, otherwise - complete disable one.
 boolean getThrowExceptions()
          when this property is set to true, than engine throws exception on error, otherwise - method usially return null and exceptions are saved for further retrieving.
 java.lang.Exception handleError(java.lang.String message, java.lang.String sql, java.lang.Exception cause)
          also set own last exception and wasError to appropriative values.
 void setLastException(java.lang.Exception ex)
          set last Exception
 void setLogEnabled(boolean value)
          set logEnabled property,
 void setThrowExceptions(boolean value)
          set throwExceptions property,
 boolean wasError()
          true if error was handled (and later not cleared) during some previous operations on this object
 

Method Detail

handleError

java.lang.Exception handleError(java.lang.String message,
                                java.lang.String sql,
                                java.lang.Exception cause)
also set own last exception and wasError to appropriative values. If configuartion parameter throwException is set, throw received exception

Parameters:
message - - message to log (or throw). Can be null if nothing specifcs.
sql - - sql which cause this error. Can be null if unavaible.
cause - - previous exception in chain, if exists.
Returns:
exception, which consists from message and cause.

wasError

boolean wasError()
true if error was handled (and later not cleared) during some previous operations on this object

Returns:
true if one of previous actions cause sql error.

getLastException

java.lang.Exception getLastException()
get last Exception

Returns:
last exception if wasError, otherwise null.

setLastException

void setLastException(java.lang.Exception ex)
set last Exception


clearError

void clearError()
clear all information about error, so wasError become false.


getThrowExceptions

boolean getThrowExceptions()
when this property is set to true, than engine throws exception on error, otherwise - method usially return null and exceptions are saved for further retrieving.

See Also:
SqlPluginConfiguration.getThrowExceptions(), setThrowExceptions(boolean)

setThrowExceptions

void setThrowExceptions(boolean value)
set throwExceptions property,

Parameters:
value - -- value to set
See Also:
getThrowExceptions()

getLogEnabled

boolean getLogEnabled()
when this propery is set to true - do logging according with settings in xwiki configurations, otherwise - complete disable one. Initial value is true (by default) and set from value of parent object. (and for top-level objects can be set via configuration.)

See Also:
SqlPluginConfiguration.getLogEnabled()

setLogEnabled

void setLogEnabled(boolean value)
set logEnabled property,

Parameters:
value - -- value to set
See Also:
getLogEnabled()