org.mmbase.storage.database
Class RelationalDatabaseStorage

java.lang.Object
  extended byorg.mmbase.module.database.support.BaseJdbc2Node
      extended byorg.mmbase.storage.database.Support2Storage
          extended byorg.mmbase.storage.database.AbstractDatabaseStorage
              extended byorg.mmbase.storage.database.SQL92DatabaseStorage
                  extended byorg.mmbase.storage.database.RelationalDatabaseStorage
All Implemented Interfaces:
DatabaseStorage, MMJdbc2NodeInterface, SearchQueryHandler, Storage
Direct Known Subclasses:
HSqlStorage, MySqlStorage

Deprecated. This code is scheduled for removal once MMBase has been fully converted to the new StorageManager implementation.

public class RelationalDatabaseStorage
extends SQL92DatabaseStorage
implements DatabaseStorage, MMJdbc2NodeInterface

RelationalDatabaseStorage implements the DatabaseStorage interface and the MMJdbc2NodeInterface for Ansi SQL 92 relational databases. This class extends AbstractDatabaseStorage to include methods for retrieving data from a relational database systems. It overrides the various update methods to allow for recursive updates on parent tables, the methods for storing and retrieving huge texts and bytefields, and teh methods for determining database key (for the object 'number' field).

Since:
MMBase-1.6
Version:
$Id: RelationalDatabaseStorage.java,v 1.12.2.1 2004/06/15 21:38:37 robmaris Exp $
Author:
Pierre van Rooden
To Do:
This function contains a lot of methods which do not seem specific for a 'relational' database. They should perhaps be moved to 'abstract' databasestorage

Field Summary
 
Fields inherited from class org.mmbase.storage.database.AbstractDatabaseStorage
mmb
 
Fields inherited from interface org.mmbase.storage.database.DatabaseStorage
KEY_FOREIGN, KEY_NONE, KEY_NOTNULL, KEY_PRIMARY, KEY_SECONDARY
 
Fields inherited from interface org.mmbase.storage.search.SearchQueryHandler
FEATURE_MAX_NUMBER, FEATURE_OFFSET, SUPPORT_NONE, SUPPORT_NORMAL, SUPPORT_OPTIMAL, SUPPORT_WEAK
 
Constructor Summary
RelationalDatabaseStorage()
          Deprecated. Constructs the Ansi SQL database layer support class
 
Method Summary
protected  boolean commitObjectTable(MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Commit this node to the object table.
 boolean commitToTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Commit this node to the specified builder table.
 int createKey(Transaction trans)
          Deprecated. Gives an unique number for a node to be inserted.
 boolean deleteFromTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Remove a node from the specified builder table.
protected  boolean deleteObjectTable(MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Remove a node from the object table.
 java.lang.String getText(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Get text from blob
 int insertIntoTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. This method inserts a new object in a specified builder table.
protected  int insertObjectTable(MMObjectNode node, DatabaseTransaction trans)
          Deprecated. This method inserts a new object in the object table.
protected  void prepare()
          Deprecated. Prepares the database layer.
 boolean supportsExtendedTables()
          Deprecated. Returns whether this storage layer supports extended tables.
 
Methods inherited from class org.mmbase.storage.database.SQL92DatabaseStorage
addField, applyCreateScheme, changeField, commit, create, created, created, createObjectStorage, createSQL, delete, deleteSQL, drop, dropSQL, getBinaryFile, getBytes, getFieldsOrderCreate, getNode, getNodeType, getParentBuilder, getParentTableName, getText, init, insert, insertSQL, isAllowedParentBuilder, isParentField, loadExistingTables, loadFieldFromTable, loadSupportInformation, readBytesFromFile, removeField, selectSQL, setValuePreparedStatement, size, size, supportsRollback, updateSQL, updateStorage, writeBytesToFile
 
Methods inherited from class org.mmbase.storage.database.AbstractDatabaseStorage
applyForeignKeyScheme, applyKeyScheme, applyNotNullScheme, applyPrimaryKeyScheme, applyScheme, commit, constructFieldDefinition, constructFieldDefinition, create, createDatabaseTransaction, createDatabaseTransaction, createKey, createObjectStorage, createSQL, createTransaction, delete, deployDatabaseReader, getBinaryFilePath, getBytes, getCreateExtendedScheme, getCreateScheme, getDBByte, getDBByteBinaryStream, getDBText, getFieldNameMap, getForeignKeyScheme, getFullTableName, getFullTableName, getJDBC, getKeyScheme, getMaxDropSize, getNode, getNodeType, getNotNullScheme, getNumberString, getPrimaryKeyScheme, getStoreBinaryAsFile, getTableName, getTypeMap, insert, mapToMMBaseFieldName, mapToTableFieldName, matchType, registerChanged, registerParentBuilder, selectSQL, selectSQL, selectSQL, setBinaryFilePath, setCreateExtendedScheme, setCreateScheme, setDBByte, setDBText, setFieldNameMap, setForeignKeyScheme, setKeyScheme, setMaxDropSize, setNotNullScheme, setPrimaryKeyScheme, setStoreBinaryAsFile, setTypeMap
 
Methods inherited from class org.mmbase.storage.database.Support2Storage
commit, createObjectTable, decodeDBnodeField, decodeDBnodeField, getAllowedField, getConnection, getDBKey, getDisallowedField, getMMNodeSearch2SQL, getOTypeString, getOwnerString, getShortedByte, getShortedText, insert, removeNode, updateTable
 
Methods inherited from class org.mmbase.module.database.support.BaseJdbc2Node
getNodes, getSupportLevel, getSupportLevel, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mmbase.storage.database.DatabaseStorage
getBinaryFilePath, getCreateExtendedScheme, getCreateScheme, getFieldNameMap, getForeignKeyScheme, getJDBC, getKeyScheme, getMaxDropSize, getNotNullScheme, getPrimaryKeyScheme, getStoreBinaryAsFile, getTypeMap, init, loadFieldFromTable, mapToMMBaseFieldName, mapToTableFieldName, registerChanged, setBinaryFilePath, setCreateExtendedScheme, setCreateScheme, setFieldNameMap, setForeignKeyScheme, setKeyScheme, setMaxDropSize, setNotNullScheme, setPrimaryKeyScheme, setStoreBinaryAsFile, setTypeMap, setValuePreparedStatement
 
Methods inherited from interface org.mmbase.storage.Storage
addField, changeField, commit, commit, create, create, created, createKey, createObjectStorage, createObjectStorage, createTransaction, delete, delete, drop, getBytes, getNode, getNode, getNodeType, getNodeType, getText, insert, insert, isAllowedParentBuilder, registerParentBuilder, removeField, size, supportsRollback, updateStorage
 
Methods inherited from interface org.mmbase.storage.search.SearchQueryHandler
getNodes, getSupportLevel, getSupportLevel
 
Methods inherited from interface org.mmbase.module.database.support.MMJdbc2NodeInterface
addField, changeField, commit, create, created, createObjectTable, decodeDBnodeField, decodeDBnodeField, drop, getAllowedField, getConnection, getDBByte, getDBKey, getDBText, getDisallowedField, getMMNodeSearch2SQL, getNumberString, getOTypeString, getOwnerString, getShortedByte, getShortedText, init, insert, isAllowedParentBuilder, registerParentBuilder, removeField, removeNode, setDBByte, updateTable
 

Constructor Detail

RelationalDatabaseStorage

public RelationalDatabaseStorage()
Deprecated. 
Constructs the Ansi SQL database layer support class

Method Detail

supportsExtendedTables

public boolean supportsExtendedTables()
Deprecated. 
Description copied from interface: DatabaseStorage
Returns whether this storage layer supports extended tables.

Specified by:
supportsExtendedTables in interface DatabaseStorage
Specified by:
supportsExtendedTables in class AbstractDatabaseStorage
Returns:
boolean true if extended tables are supported

prepare

protected void prepare()
Deprecated. 
Prepares the database layer. This code creates a 'numbertable' for MMBase to track number generation by the createKey(org.mmbase.storage.Transaction) method. Override this method if you use a different way of generating keys, or if you need to make other preparations for your database.

Overrides:
prepare in class SQL92DatabaseStorage

getText

public java.lang.String getText(java.lang.String tableName,
                                java.lang.String fieldName,
                                int number)
Deprecated. 
Get text from blob

Specified by:
getText in class SQL92DatabaseStorage
Warning: No Java Documentation Available.

createKey

public int createKey(Transaction trans)
              throws StorageException
Deprecated. 
Description copied from interface: Storage
Gives an unique number for a node to be inserted. This method should work with multiple mmbases

Specified by:
createKey in interface Storage
Specified by:
createKey in class AbstractDatabaseStorage
Parameters:
trans - the transaction to use for obtaining the key
Returns:
unique number
Throws:
StorageException - if an error occurred while obtaining the key

insertIntoTable

public int insertIntoTable(MMObjectBuilder builder,
                           MMObjectNode node,
                           DatabaseTransaction trans)
                    throws StorageException
Deprecated. 
This method inserts a new object in a specified builder table. Only fields with states of DBSTATE_PERSISTENT or DBSTATE_SYSTEM are stored in the database tables.

Overrides:
insertIntoTable in class SQL92DatabaseStorage
Parameters:
builder - the builder to store teh node in. This can be a parentbuilder of the node's actual builder
node - The node to insert
trans - the transaction to perform the insert in
Returns:
The (new) number for this node, or -1 if an error occurs.
Throws:
StorageException - if an error occurred during insert

insertObjectTable

protected int insertObjectTable(MMObjectNode node,
                                DatabaseTransaction trans)
                         throws StorageException
Deprecated. 
This method inserts a new object in the object table. Called by SQL92DatabaseStorage.insert(org.mmbase.module.core.MMObjectNode, org.mmbase.storage.Transaction) to maintain consistency.

Parameters:
node - The node to insert
trans - the transaction to perform the insert in
Returns:
The (new) number for this node, or -1 if an error occurs.
Throws:
StorageException - if an error occurred during insert

commitToTable

public boolean commitToTable(MMObjectBuilder builder,
                             MMObjectNode node,
                             DatabaseTransaction trans)
                      throws StorageException
Deprecated. 
Commit this node to the specified builder table.

Overrides:
commitToTable in class SQL92DatabaseStorage
Parameters:
builder - the builder to commit the node to. This can be a parentbuilder of the node's actual builder
node - The node to insert
trans - the transaction to perform the insert in
Returns:
true of succesful, false otherwise
Throws:
StorageException - if an error occurred during commit

commitObjectTable

protected boolean commitObjectTable(MMObjectNode node,
                                    DatabaseTransaction trans)
                             throws StorageException
Deprecated. 
Commit this node to the object table.

Parameters:
node - The node to insert
trans - the transaction to perform the insert in
Returns:
true of succesful, false otherwise
Throws:
StorageException - if an error occurred during commit

deleteFromTable

public boolean deleteFromTable(MMObjectBuilder builder,
                               MMObjectNode node,
                               DatabaseTransaction trans)
                        throws StorageException
Deprecated. 
Remove a node from the specified builder table.

Overrides:
deleteFromTable in class SQL92DatabaseStorage
Parameters:
builder - the builder to remove the node from. This can be a parentbuilder of the node's actual builder
node - The node to delete
trans - the transaction to perform the insert in
Returns:
true if succesful, false otherwise
Throws:
StorageException - if an error occurred during delete

deleteObjectTable

protected boolean deleteObjectTable(MMObjectNode node,
                                    DatabaseTransaction trans)
                             throws StorageException
Deprecated. 
Remove a node from the object table.

Parameters:
node - The node to delete
trans - the transaction to perform the insert in
Throws:
StorageException - if an error occurred during delete


MMBase build 1.7.4.20050922