www.element4solution.com

e4s.db
Class E4DBModifyCommon

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.db.E4DBFilter
          extended by e4s.db.E4DBFilterAnd
              extended by e4s.db.E4DBModifyCommon
All Implemented Interfaces:
E4DBFilter_Intf, E4DBFilterAnd_Intf
Direct Known Subclasses:
E4DBModify, E4DBModifyFreefields, T_E4S_CLIENT_Mod, T_E4S_CLIENT_VAL_Mod, T_E4S_FREEFIELD_DEF_Mod, T_E4S_FREEFIELD_VAL_Mod, T_E4S_HINT_Mod, T_E4S_HINT_READ_Mod, T_E4S_LOGIN_HISTORY_Mod, T_E4S_MAIL_SENT_Mod, T_E4S_OVERVIEW_Mod, T_E4S_PERMISSION_COMPANY_Mod, T_E4S_PERMISSION_GROUP_Mod, T_E4S_PERMISSION_USER_Mod, T_E4S_QUERY_CLIENTS_Mod, T_E4S_QUERY_Mod, T_E4S_QUERY_PARAMS_Mod, T_E4S_TRANS_APP_Mod, T_E4S_TRANS_DATA_Mod, T_E4S_TRANS_SYS_Mod, T_E4S_USER_VAL_Mod

public abstract class E4DBModifyCommon
extends E4DBFilterAnd

Base class for UPDATE, INSERT and DELETE SQL commands.


Field Summary
static int AUTOINCREMENT_MODE_DATABASE_AUTO
          Autoincremental values are handled by the DBMS.
static int AUTOINCREMENT_MODE_DATABASE_SELECT
          Autoincremental values are handled by the e4s framework, each time a record will be inserted into the table a select max(column) statement will be performed.
static int AUTOINCREMENT_MODE_ON_CLIENT
          Autoincremental values are handled by the e4s framework on client level.
static int AUTOINCREMENT_MODE_ON_TABLE
          Autoincremental values are handled by the e4s framework on table level.
protected  java.util.Hashtable m_assign
           
protected static int m_AutoincrMode
           
protected static java.util.Hashtable m_AutoincrValues
           
 
Fields inherited from class e4s.db.E4DBFilter
COMP_EMPTY, COMP_EQUALS, COMP_GREATER, COMP_GREATER_EQUAL, COMP_IN, COMP_IS_NOT_NULL, COMP_IS_NULL, COMP_LESS, COMP_LESS_EQUAL, COMP_LIKE, COMP_NOT_EMPTY, COMP_NOT_EQUALS, COMP_NOT_IN, COMP_NOT_LIKE
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
  E4DBModifyCommon(E4DBConnection_Intf con, E4DBTableName tableName)
           
  E4DBModifyCommon(E4DBConnection_Intf con, E4DBTableName tableName, E4ApplObj_Intf applobj)
           
  E4DBModifyCommon(E4DBModifyCommon modify, boolean copy_where)
           
protected E4DBModifyCommon(E4DBSelect select, boolean copy_where)
           
protected E4DBModifyCommon(E4DBSelect select, boolean copy_where, char dummy)
          Deprecated.  
protected E4DBModifyCommon(E4DBSelect select, boolean copy_where, E4ApplObj_Intf applobj)
           
  E4DBModifyCommon(E4DBTableName tableName)
           
  E4DBModifyCommon(E4DBTableName tableName, E4ApplObj_Intf applobj)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 void close()
          Close the database connection (if pooling is enabled #e4s.db.E4DBConnection_Intf#connectionIsPooled).
 void disableLogging()
          Disables logging explicit - overrides E4DBLogging default settings based on general .ini settings.
 void enableLogging()
          Enables logging explicit - overrides E4DBLogging default settings based on general .ini settings.
 void executeDelete()
           
 long executeInsert(E4DBColumnName autoincrName)
          Performs an INSERT SQL statement.
static void executeSQL(E4ApplObj_Intf applobj, java.lang.String sql)
          Executes the specified SQL statement directly using the specified connection.
static void executeSQL(E4DBConnection_Intf con, E4ApplObj_Intf applobj, java.lang.String sql)
          Executes the specified SQL statement directly using the specified connection.
static void executeSQL(E4DBConnection_Intf con, java.lang.String sql)
          Executes the specified SQL statement directly using the specified connection.
 void executeSQL(java.lang.String sql)
          Executes the specified SQL statement directly using the connection specified during instanciating.
 void executeUpdate()
           
 void finalize()
           
 int get_AutoincrMode()
           
 E4DBConnection_Intf getConnection()
          Get the database connection.
static long getNextAutoincr(E4ApplObj_Intf applobj, E4DBTableName table, E4DBColumnName column, E4DBConnection_Intf con)
           
 E4DBReference[] getReferenceDelete(E4DBColumnName dummy)
          Return null.
 E4DBReference[] getReferenceLookup(E4DBColumnName dummy)
          Return null.
 E4DBTableName getTableName()
           
 boolean isLogging()
          Get the logging state of this E4DBSelect.
 boolean isSet(E4DBColumnName name)
           
 boolean isSetAny()
           
static boolean isUnicodeEnabled()
          Determine, if UNICODE is enabled.
 void removeNullValues()
          This function removes all null values, it is intended to use it in the case an #executeInsert() will be performed next.
 void reset()
           
static void resetNextAutoincr(E4ApplObj_Intf applobj, E4DBTableName table, E4DBColumnName column)
          Reset Auto-Increment index (highest index will be checked on next insert)
 void set_AutoincrMode(int mode)
           
 void set(E4DBColumnName name, boolean val)
           
 void set(E4DBColumnName name, java.util.Calendar val)
           
 void set(E4DBColumnName name, CHECKBOX val)
           
 void set(E4DBColumnName name, java.util.Date val)
           
 void set(E4DBColumnName name, DATEFIELD val)
           
 void set(E4DBColumnName name, E4Long val)
           
 void set(E4DBColumnName name, E4String val)
           
 void set(E4DBColumnName name, float val)
           
 void set(E4DBColumnName name, FLOATFIELD val)
           
 void set(E4DBColumnName name, int val)
           
 void set(E4DBColumnName name, long val)
           
 void set(E4DBColumnName name, LONGFIELD val)
           
 void set(E4DBColumnName name, java.lang.String val)
           
 void set(E4DBColumnName name, TEXTAREA val)
           
 void set(E4DBColumnName name, TEXTFIELD val)
           
 void setNull(E4DBColumnName name)
          Set the value of the field (name) to null.
 java.lang.String toString()
          Last SQL statement executed.
 
Methods inherited from class e4s.db.E4DBFilterAnd
getWhere, isEmpty, isNotEmpty, isNotNull, isNull, OR, setFilter_NOT, setFilter_NOT, setFilter_NOT, setFilter_NOT, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter
 
Methods inherited from class e4s.db.E4DBFilter
Escape, Escape, getApplObj, getClient, getSession, getWhere, isWhereDefined, OP, resetWhere, setFilter_IN, setFilter_IN, setFilter_IN, setFilter_IN, setFilter_IN, setFilter_NOT_IN, setFilter_NOT_IN, setFilter_NOT_IN, setFilter_NOT_IN, setFilter_NOT_IN, setFilter, setFilter, setWhere, toString
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface e4s.db.E4DBFilter_Intf
isWhereDefined, resetWhere
 

Field Detail

AUTOINCREMENT_MODE_DATABASE_AUTO

public static final int AUTOINCREMENT_MODE_DATABASE_AUTO
Autoincremental values are handled by the DBMS.

See Also:
set_AutoincrMode(int), get_AutoincrMode(), Constant Field Values

AUTOINCREMENT_MODE_DATABASE_SELECT

public static final int AUTOINCREMENT_MODE_DATABASE_SELECT
Autoincremental values are handled by the e4s framework, each time a record will be inserted into the table a select max(column) statement will be performed.

See Also:
set_AutoincrMode(int), get_AutoincrMode(), Constant Field Values

AUTOINCREMENT_MODE_ON_TABLE

public static final int AUTOINCREMENT_MODE_ON_TABLE
Autoincremental values are handled by the e4s framework on table level. The first time a record will be inserted into the table a select max(column) statement will be performed, this value will be remembered for subsequent inserts and will only be incremented.

See Also:
set_AutoincrMode(int), get_AutoincrMode(), Constant Field Values

AUTOINCREMENT_MODE_ON_CLIENT

public static final int AUTOINCREMENT_MODE_ON_CLIENT
Autoincremental values are handled by the e4s framework on client level. The first time a record will be inserted into the table a select max(column) statement will be performed, this value will be remembered for subsequent inserts and will only be incremented. This value will be used as default value.

See Also:
set_AutoincrMode(int), get_AutoincrMode(), Constant Field Values

m_AutoincrMode

protected static int m_AutoincrMode

m_AutoincrValues

protected static java.util.Hashtable m_AutoincrValues

m_assign

protected java.util.Hashtable m_assign
Constructor Detail

E4DBModifyCommon

public E4DBModifyCommon(E4DBModifyCommon modify,
                        boolean copy_where)
                 throws E4DBException
Throws:
E4DBException

E4DBModifyCommon

protected E4DBModifyCommon(E4DBSelect select,
                           boolean copy_where,
                           E4ApplObj_Intf applobj)
                    throws E4DBException
Throws:
E4DBException

E4DBModifyCommon

protected E4DBModifyCommon(E4DBSelect select,
                           boolean copy_where)
                    throws E4DBException
Throws:
E4DBException

E4DBModifyCommon

protected E4DBModifyCommon(E4DBSelect select,
                           boolean copy_where,
                           char dummy)
                    throws E4DBException
Deprecated. 

Throws:
E4DBException

E4DBModifyCommon

public E4DBModifyCommon(E4DBConnection_Intf con,
                        E4DBTableName tableName,
                        E4ApplObj_Intf applobj)

E4DBModifyCommon

public E4DBModifyCommon(E4DBConnection_Intf con,
                        E4DBTableName tableName)

E4DBModifyCommon

public E4DBModifyCommon(E4DBTableName tableName)
                 throws E4DBException
Throws:
E4DBException

E4DBModifyCommon

public E4DBModifyCommon(E4DBTableName tableName,
                        E4ApplObj_Intf applobj)
                 throws E4DBException
Throws:
E4DBException
Method Detail

reset

public void reset()

isUnicodeEnabled

public static boolean isUnicodeEnabled()
Determine, if UNICODE is enabled. Uses the static return value from E4DBSelect.

Returns:
true, if Unicode is enabled
See Also:
E4DBSelect.enableUnicode(boolean), E4DBSelect.isUnicodeEnabled(), HTML.isUTF8enabled(), HTML.enableUTF8(boolean)

executeInsert

public long executeInsert(E4DBColumnName autoincrName)
                   throws E4DBException
Performs an INSERT SQL statement. If a column is specified, this column is treatened as an auto increment value. This means, that an incremental counter will be updated and automatically assigned to that column.

Parameters:
autoincrName - the column dedicated for auto incremental, or null if none
Returns:
the new created auto-increment id or -1 if no column specified
Throws:
E4DBException
See Also:
executeUpdate(), executeDelete(), #executeInsert(), removeNullValues()

executeUpdate

public void executeUpdate()
                   throws E4DBException
Throws:
E4DBException

executeSQL

public void executeSQL(java.lang.String sql)
                throws E4DBException
Executes the specified SQL statement directly using the connection specified during instanciating. IMPORTANT NOTE - E4Client (client) distinction mechanism will not be availabe here! When using this function, take care of client distinction on your own, otherwise loss of data can be the result! Use #executeInsert(), executeUpdate() or executeDelete() if possible instead!

Parameters:
sql - your SQL statement (DROP, ALTER, CREATE VIEW, INSERT, UPDATE or DELETE)
Throws:
E4DBException
See Also:
#executeSQL(e4s.db.E4DBConnection_Intf,java.util.String), #executeInsert(), executeUpdate(), executeDelete()

executeSQL

public static void executeSQL(E4DBConnection_Intf con,
                              java.lang.String sql)
                       throws E4DBException
Executes the specified SQL statement directly using the specified connection. IMPORTANT NOTE - E4Client (client) distinction mechanism will not be availabe here! When using this function, take care of client distinction on your own, otherwise loss of data can be the result! Use #executeInsert(), executeUpdate() or executeDelete() if possible instead!

Parameters:
con - your database connection
sql - your SQL statement (DROP, ALTER, CREATE VIEW, INSERT, UPDATE or DELETE)
Throws:
E4DBException
See Also:
#executeSQL(java.util.String)

executeSQL

public static void executeSQL(E4DBConnection_Intf con,
                              E4ApplObj_Intf applobj,
                              java.lang.String sql)
                       throws E4DBException
Executes the specified SQL statement directly using the specified connection. IMPORTANT NOTE - E4Client (client) distinction mechanism will not be availabe here! When using this function, take care of client distinction on your own, otherwise loss of data can be the result! Use #executeInsert(), executeUpdate() or executeDelete() if possible instead!

Parameters:
con - your database connection
applobj - the application object holding necessary client data
sql - your SQL statement (DROP, ALTER, CREATE VIEW, INSERT, UPDATE or DELETE)
Throws:
E4DBException
See Also:
#executeSQL(java.util.String)

executeSQL

public static void executeSQL(E4ApplObj_Intf applobj,
                              java.lang.String sql)
                       throws E4DBException
Executes the specified SQL statement directly using the specified connection. IMPORTANT NOTE - E4Client (client) distinction mechanism will not be availabe here! When using this function, take care of client distinction on your own, otherwise loss of data can be the result! Use #executeInsert(), executeUpdate() or executeDelete() if possible instead! Uses the default connection E4DBConnectionDefault.getInstance().

Parameters:
applobj - the application object holding necessary client data
sql - your SQL statement (DROP, ALTER, CREATE VIEW, INSERT, UPDATE or DELETE)
Throws:
E4DBException
See Also:
#executeSQL(java.util.String)

executeDelete

public void executeDelete()
                   throws E4DBException
Throws:
E4DBException

isSetAny

public boolean isSetAny()

isSet

public boolean isSet(E4DBColumnName name)

set

public void set(E4DBColumnName name,
                java.lang.String val)

set

public void set(E4DBColumnName name,
                int val)

set

public void set(E4DBColumnName name,
                long val)

set

public void set(E4DBColumnName name,
                float val)

set

public void set(E4DBColumnName name,
                boolean val)

set

public void set(E4DBColumnName name,
                java.util.Date val)

set

public void set(E4DBColumnName name,
                java.util.Calendar val)

set

public void set(E4DBColumnName name,
                E4String val)

set

public void set(E4DBColumnName name,
                E4Long val)

set

public void set(E4DBColumnName name,
                LONGFIELD val)

set

public void set(E4DBColumnName name,
                FLOATFIELD val)

set

public void set(E4DBColumnName name,
                DATEFIELD val)

set

public void set(E4DBColumnName name,
                TEXTFIELD val)

set

public void set(E4DBColumnName name,
                TEXTAREA val)

set

public void set(E4DBColumnName name,
                CHECKBOX val)

setNull

public void setNull(E4DBColumnName name)
Set the value of the field (name) to null.

Parameters:
name - columnname

toString

public java.lang.String toString()
Last SQL statement executed.

Overrides:
toString in class E4DBFilterAnd
Returns:
the last executed SQL String

getTableName

public E4DBTableName getTableName()

getNextAutoincr

public static long getNextAutoincr(E4ApplObj_Intf applobj,
                                   E4DBTableName table,
                                   E4DBColumnName column,
                                   E4DBConnection_Intf con)
                            throws E4DBException
Throws:
E4DBException

resetNextAutoincr

public static void resetNextAutoincr(E4ApplObj_Intf applobj,
                                     E4DBTableName table,
                                     E4DBColumnName column)
Reset Auto-Increment index (highest index will be checked on next insert)

Parameters:
applobj - a valid application object
table - the database table
column - the autoincrement column

get_AutoincrMode

public int get_AutoincrMode()

set_AutoincrMode

public void set_AutoincrMode(int mode)
                      throws E4DBException
Throws:
E4DBException

getConnection

public E4DBConnection_Intf getConnection()
Get the database connection.


getReferenceDelete

public E4DBReference[] getReferenceDelete(E4DBColumnName dummy)
                                   throws E4DBException
Return null.

Throws:
E4DBException

getReferenceLookup

public E4DBReference[] getReferenceLookup(E4DBColumnName dummy)
                                   throws E4DBException
Return null.

Throws:
E4DBException

enableLogging

public void enableLogging()
Enables logging explicit - overrides E4DBLogging default settings based on general .ini settings.

See Also:
disableLogging(), E4DBLogging

disableLogging

public void disableLogging()
Disables logging explicit - overrides E4DBLogging default settings based on general .ini settings.

See Also:
disableLogging(), E4DBLogging

isLogging

public boolean isLogging()
Get the logging state of this E4DBSelect.

Returns:
true if enableLogging() was called or E4DBLogging.isWriting() returns true and disableLogging() was not called explicit.
See Also:
e4s.db.E4DBLogging.isWriting(), enableLogging(), disableLogging()

close

public void close()
           throws E4DBException
Close the database connection (if pooling is enabled #e4s.db.E4DBConnection_Intf#connectionIsPooled).

Throws:
E4DBException

finalize

public void finalize()
Overrides:
finalize in class E4DBFilter

removeNullValues

public void removeNullValues()
This function removes all null values, it is intended to use it in the case an #executeInsert() will be performed next. The reason, why this is not automatically done is to avoid empty insert statements.


_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com