org.mmbase.storage.database
Class SQL92DatabaseStorage

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
All Implemented Interfaces:
DatabaseStorage, MMJdbc2NodeInterface, SearchQueryHandler, Storage
Direct Known Subclasses:
OODatabaseStorage, RelationalDatabaseStorage

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

public abstract class SQL92DatabaseStorage
extends AbstractDatabaseStorage
implements DatabaseStorage

SQL92DatabaseStorage extends AbstractDatabaseStorage to implement the basic functionality for creating and updating databse tables, using SQL. Most statements created here are ANSI SQL 92, with the exception of statements for creating extended tables (see create(org.mmbase.module.core.MMObjectBuilder, org.mmbase.storage.Transaction)). It does not take into account db-specific effects of inheritance - as various databases have their own methods, it may be necessary to override the create(org.mmbase.module.core.MMObjectBuilder, org.mmbase.storage.Transaction), insertIntoTable(org.mmbase.module.core.MMObjectBuilder, org.mmbase.module.core.MMObjectNode, org.mmbase.storage.database.DatabaseTransaction), commitToTable(org.mmbase.module.core.MMObjectBuilder, org.mmbase.module.core.MMObjectNode, org.mmbase.storage.database.DatabaseTransaction), and deleteFromTable(org.mmbase.module.core.MMObjectBuilder, org.mmbase.module.core.MMObjectNode, org.mmbase.storage.database.DatabaseTransaction) methods. The basic implementation of these methods assumes an OO-database that does not require the use of specific database routines (i.e. alternate SQL syntax). Furthermore, most sql statements are now contained in their own wrapper methods: createSQL(java.lang.String, java.lang.String, java.lang.String, java.lang.String), insertSQL(java.lang.String, java.lang.String, java.lang.String), updateSQL(java.lang.String, java.lang.String, int), deleteSQL(java.lang.String, int) and various methods for returning SQL SELECT statements. You can override these method to change the sql statements used by the database layer.

Since:
MMBase-1.6
Version:
$Id: SQL92DatabaseStorage.java,v 1.19 2004/01/27 12:04:46 pierre Exp $
Author:
Pierre van Rooden

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
protected SQL92DatabaseStorage()
          Deprecated. Constructs the AbstractDatabaseSupport database layer support class
 
Method Summary
 boolean addField(MMObjectBuilder builder, java.lang.String fieldname)
          Deprecated. Adds a field to the table of this builder.
protected  java.lang.String applyCreateScheme(java.lang.String tableName, java.lang.String fieldDefinitions, java.lang.String parentTableName)
          Deprecated. Applies the create scheme (if available), and returns the result (a field type defintiton string)
 boolean changeField(MMObjectBuilder builder, java.lang.String fieldname)
          Deprecated. Changes a field to the table of this builder.
 boolean commit(MMObjectNode node, Transaction trans)
          Deprecated. Commit this node to the specified builder table within a transaction.
protected  boolean commitToTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Commit the changes to this node to the specified builder table.
 boolean create(MMObjectBuilder builder, Transaction trans)
          Deprecated. Create a database table for the specified builder.
 boolean created(MMObjectBuilder builder)
          Deprecated. Tells if a table for the builder already exists
 boolean created(java.lang.String tableName)
          Deprecated. Tells if a table already exists
 boolean createObjectStorage(Transaction trans)
          Deprecated. Create the object table (the basic table for all objects) within a transaction
protected  java.lang.String createSQL(java.lang.String tableName, java.lang.String fields, java.lang.String parentTableName, java.lang.String parentFields)
          Deprecated. Returns the SQL command to use for creating a specified table, optionally extending another supplied table.
 boolean delete(MMObjectNode node, Transaction trans)
          Deprecated. Delete a node within a transaction
 boolean deleteFromTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. Remove a node from the specified builder table.
protected  java.lang.String deleteSQL(java.lang.String tableName, int number)
          Deprecated. Returns the SQL command to use for deleting an object in a table.
 boolean drop(MMObjectBuilder builder)
          Deprecated. Drops the table of this builder.
protected  java.lang.String dropSQL(java.lang.String tableName)
          Deprecated. Returns the SQL command to use for dropping a specified table Overide this method to add a database-specific syntax or optimalization
protected  java.io.File getBinaryFile(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Defines how binary (blob) files must look like.
 byte[] getBytes(MMObjectNode node, java.lang.String fieldName)
          Deprecated. retrieves bytes from file or database depending on if getStoreBinayAsFIle is true
protected  java.util.List getFieldsOrderCreate(MMObjectBuilder builder)
          Deprecated. Returns the fields of a builder in the order in which they should be created.
 MMObjectNode getNode(MMObjectBuilder builder, int number, Transaction trans)
          Deprecated. Select a node from a specified builder
 int getNodeType(int number, Transaction trans)
          Deprecated. Returns the nodetype for a specified nodereference
protected  MMObjectBuilder getParentBuilder(MMObjectBuilder builder)
          Deprecated. Returns the parent builder of the specifed builder.
protected  java.lang.String getParentTableName(MMObjectBuilder builder)
          Deprecated. Returns the name of the parent table of the specifed builder.
 java.lang.String getText(MMObjectNode node, java.lang.String fieldname)
          Deprecated. Get text from blob
protected abstract  java.lang.String getText(java.lang.String tableName, java.lang.String fieldname, int number)
          Deprecated. Get text from blob
 void init(MMBase mmb, XMLDatabaseReader document)
          Deprecated. Initializes the database layer.
 int insert(MMObjectNode node, Transaction trans)
          Deprecated. This method inserts a new object within a transaction, and registers the change.
protected  int insertIntoTable(MMObjectBuilder builder, MMObjectNode node, DatabaseTransaction trans)
          Deprecated. This method inserts a new object in a specified builder table.
protected  java.lang.String insertSQL(java.lang.String tableName, java.lang.String fieldNames, java.lang.String fieldValues)
          Deprecated. Returns the SQL command to use for inserting an object in a table.
 boolean isAllowedParentBuilder(MMObjectBuilder builder)
          Deprecated. Returns whether this database support layer allows for builder to be a parent builder (that is, other builders can 'extend' this builder and its database tables).
protected  boolean isParentField(MMObjectBuilder builder, java.lang.String fieldName)
          Deprecated. Tests whether the specified field is a member of the parent table of the specifed builder.
protected  void loadExistingTables()
          Deprecated. Load the names of the existing tables for this MMBase instance in memory.
 void loadFieldFromTable(MMObjectNode node, java.lang.String fieldName, java.sql.ResultSet rs, int i)
          Deprecated. Stores a field in a table ResultSet in a MMObjectNode.
protected  void loadSupportInformation()
          Deprecated. Load information on database support (i.e support of rollback).
protected  void prepare()
          Deprecated. Prepares the database layer.
protected  byte[] readBytesFromFile(java.lang.String tableName, java.lang.String fieldName, int number)
          Deprecated. Reads a byte array from a file.
 boolean removeField(MMObjectBuilder builder, java.lang.String fieldname)
          Deprecated. Deletes a field from the table of this builder.
protected  java.lang.String selectSQL(java.lang.String tableName, java.lang.String fieldNames, java.lang.String where, java.lang.String orderby, int offset, int max)
          Deprecated. Returns the SQL command to use for selecting data from a table.
 boolean setValuePreparedStatement(java.sql.PreparedStatement stmt, MMObjectNode node, java.lang.String fieldName, int i)
          Deprecated. Set prepared statement field i with value of key from node
 int size(MMObjectBuilder builder)
          Deprecated. Return number of objects in a builder
 int size(java.lang.String tableName)
          Deprecated. Return number of entries consisting in given table.
 boolean supportsRollback()
          Deprecated. Returns whether rollback on storage level is supported.
protected  java.lang.String updateSQL(java.lang.String tableName, java.lang.String setFields, int number)
          Deprecated. Returns the SQL command to use for updating an object in a table.
 boolean updateStorage(MMObjectBuilder builder)
          Deprecated. Changes the storage of a builder to match its new configuration.
protected  boolean writeBytesToFile(java.lang.String tableName, java.lang.String fieldName, int number, byte[] value)
          Deprecated. Writes a byte array to a file.
 
Methods inherited from class org.mmbase.storage.database.AbstractDatabaseStorage
applyForeignKeyScheme, applyKeyScheme, applyNotNullScheme, applyPrimaryKeyScheme, applyScheme, commit, constructFieldDefinition, constructFieldDefinition, create, createDatabaseTransaction, createDatabaseTransaction, createKey, 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, supportsExtendedTables
 
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, mapToMMBaseFieldName, mapToTableFieldName, registerChanged, setBinaryFilePath, setCreateExtendedScheme, setCreateScheme, setFieldNameMap, setForeignKeyScheme, setKeyScheme, setMaxDropSize, setNotNullScheme, setPrimaryKeyScheme, setStoreBinaryAsFile, setTypeMap, supportsExtendedTables
 
Methods inherited from interface org.mmbase.storage.Storage
commit, create, createKey, createKey, createObjectStorage, createTransaction, delete, getNode, getNodeType, insert, registerParentBuilder
 
Methods inherited from interface org.mmbase.storage.search.SearchQueryHandler
getNodes, getSupportLevel, getSupportLevel
 

Constructor Detail

SQL92DatabaseStorage

protected SQL92DatabaseStorage()
Deprecated. 
Constructs the AbstractDatabaseSupport database layer support class

Method Detail

init

public void init(MMBase mmb,
                 XMLDatabaseReader document)
Deprecated. 
Initializes the database layer. This reads database specific content from the database configuration document.

Specified by:
init in interface DatabaseStorage
Overrides:
init in class AbstractDatabaseStorage
Parameters:
mmb - the MBase instance that uses this database layer
document - the database configuration document

loadExistingTables

protected void loadExistingTables()
Deprecated. 
Load the names of the existing tables for this MMBase instance in memory.


loadSupportInformation

protected void loadSupportInformation()
Deprecated. 
Load information on database support (i.e support of rollback).


prepare

protected void prepare()
Deprecated. 
Prepares the database layer. Override this method if you need to make preparations for your database.


supportsRollback

public boolean supportsRollback()
Deprecated. 
Returns whether rollback on storage level is supported.

Specified by:
supportsRollback in interface Storage
Specified by:
supportsRollback in class AbstractDatabaseStorage
Returns:
true if transactions are supported

applyCreateScheme

protected java.lang.String applyCreateScheme(java.lang.String tableName,
                                             java.lang.String fieldDefinitions,
                                             java.lang.String parentTableName)
Deprecated. 
Applies the create scheme (if available), and returns the result (a field type defintiton string)

Overrides:
applyCreateScheme in class AbstractDatabaseStorage
Parameters:
tableName - the table to create
fieldDefinitions - comma separated list of field definitions
parentTableName - the parent table (only used in OO databases)
Returns:
the applied scheme

createSQL

protected java.lang.String createSQL(java.lang.String tableName,
                                     java.lang.String fields,
                                     java.lang.String parentTableName,
                                     java.lang.String parentFields)
Deprecated. 
Returns the SQL command to use for creating a specified table, optionally extending another supplied table. Overide this method to add a database-specific syntax or optimalization Note that the default implementation uses Ansi SQL and ignores the parentTableName parameter, instead using parentFields to complete the table creation command.

Specified by:
createSQL in class AbstractDatabaseStorage
Parameters:
tableName - the name of the table to create
fields - the definitions of the fields
parentTableName - the name of the parent table. this value is null if the table to be created has no parent table. The table is assumed to exist.
parentFields - the definitions of the fields of the parent table (for use by relational databases)
Returns:
the sql query

dropSQL

protected java.lang.String dropSQL(java.lang.String tableName)
Deprecated. 
Returns the SQL command to use for dropping a specified table Overide this method to add a database-specific syntax or optimalization

Parameters:
tableName - the name of the table to drop
Returns:
the sql query

insertSQL

protected java.lang.String insertSQL(java.lang.String tableName,
                                     java.lang.String fieldNames,
                                     java.lang.String fieldValues)
Deprecated. 
Returns the SQL command to use for inserting an object in a table. Overide this method to add a database-specific syntax or optimalization

Specified by:
insertSQL in class AbstractDatabaseStorage
Parameters:
tableName - the name of the table where to insert
fieldNames - the names of the fields to insert
fieldValues - the values (generally '?' tokens that will be replaced) of the fields to insert
Returns:
the sql query

updateSQL

protected java.lang.String updateSQL(java.lang.String tableName,
                                     java.lang.String setFields,
                                     int number)
Deprecated. 
Returns the SQL command to use for updating an object in a table. Overide this method to add a database-specific syntax or optimalization

Specified by:
updateSQL in class AbstractDatabaseStorage
Parameters:
tableName - the name of the table where to update
number - the number of the object to update
Returns:
the sql query

deleteSQL

protected java.lang.String deleteSQL(java.lang.String tableName,
                                     int number)
Deprecated. 
Returns the SQL command to use for deleting an object in a table. Overide this method to add a database-specific syntax or optimalization

Specified by:
deleteSQL in class AbstractDatabaseStorage
Parameters:
tableName - the name of the table where to delete
number - the number of the object to delete
Returns:
the sql query

selectSQL

protected java.lang.String selectSQL(java.lang.String tableName,
                                     java.lang.String fieldNames,
                                     java.lang.String where,
                                     java.lang.String orderby,
                                     int offset,
                                     int max)
Deprecated. 
Returns the SQL command to use for selecting data from a table. Overide this method to add a database-specific syntax or optimalization

Specified by:
selectSQL in class AbstractDatabaseStorage
Parameters:
tableName - the name of the table where to update
fieldNames - commaseparated list of fieldnames to retrieve, can be null (retrieve all fields)
where - constraints, can be null (no constraints)
orderby - optional fields to order by, can be null (no order)
offset - offset from where to select records. Note: if you specify an offset larger than 0, you have to specify max
max - maximum number of records, can be -1 (no max)
Returns:
the sql query
To Do:
Should use SQLHANDLER!

isAllowedParentBuilder

public boolean isAllowedParentBuilder(MMObjectBuilder builder)
Deprecated. 
Returns whether this database support layer allows for builder to be a parent builder (that is, other builders can 'extend' this builder and its database tables). The default behavior is to disallow any object other than "object" or "insrel". Database layers that support other builders should override this mnethod.

Specified by:
isAllowedParentBuilder in interface Storage
Specified by:
isAllowedParentBuilder in class AbstractDatabaseStorage
Parameters:
builder - the builder to test
Returns:
true if the builder can be extended
Since:
MMBase-1.6

setValuePreparedStatement

public boolean setValuePreparedStatement(java.sql.PreparedStatement stmt,
                                         MMObjectNode node,
                                         java.lang.String fieldName,
                                         int i)
                                  throws java.sql.SQLException
Deprecated. 
Description copied from interface: DatabaseStorage
Set prepared statement field i with value of key from node

Specified by:
setValuePreparedStatement in interface DatabaseStorage
Specified by:
setValuePreparedStatement in class AbstractDatabaseStorage
Returns:
true if actual set a value. false if somewhy this did not happen (stored blob to disk e.g.)
Throws:
java.sql.SQLException - if an error occurred while filling in the fields

loadFieldFromTable

public void loadFieldFromTable(MMObjectNode node,
                               java.lang.String fieldName,
                               java.sql.ResultSet rs,
                               int i)
Deprecated. 
Description copied from interface: DatabaseStorage
Stores a field in a table ResultSet in a MMObjectNode.

Specified by:
loadFieldFromTable in interface DatabaseStorage
Specified by:
loadFieldFromTable in class AbstractDatabaseStorage

getText

protected abstract java.lang.String getText(java.lang.String tableName,
                                            java.lang.String fieldname,
                                            int number)
Deprecated. 
Get text from blob

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

getText

public java.lang.String getText(MMObjectNode node,
                                java.lang.String fieldname)
Deprecated. 
Get text from blob

Specified by:
getText in interface Storage
Specified by:
getText in class AbstractDatabaseStorage
Warning: No Java Documentation Available.

getBytes

public final byte[] getBytes(MMObjectNode node,
                             java.lang.String fieldName)
Deprecated. 
retrieves bytes from file or database depending on if getStoreBinayAsFIle is true

Specified by:
getBytes in interface Storage
Specified by:
getBytes in class AbstractDatabaseStorage
Warning: No Java Documentation Available.

insert

public int insert(MMObjectNode node,
                  Transaction trans)
           throws StorageException
Deprecated. 
This method inserts a new object within a transaction, and registers the change. Only fields with states of DBSTATE_PERSISTENT or DBSTATE_SYSTEM are stored in the database tables.

Specified by:
insert in interface Storage
Specified by:
insert in class AbstractDatabaseStorage
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

insertIntoTable

protected int insertIntoTable(MMObjectBuilder builder,
                              MMObjectNode node,
                              DatabaseTransaction trans)
                       throws StorageException
Deprecated. 
This method inserts a new object in a specified builder table. It performs a simple insert statement (obtained with insertSQL(java.lang.String, java.lang.String, java.lang.String), using the name and fields of the specified builder. Override this method to add required code, such as recursive updates for relational databases. Only fields with states of DBSTATE_PERSISTENT or DBSTATE_SYSTEM are stored in the database tables.

Parameters:
builder - the builder to store the 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

commit

public boolean commit(MMObjectNode node,
                      Transaction trans)
               throws StorageException
Deprecated. 
Commit this node to the specified builder table within a transaction.

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

commitToTable

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

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

delete

public boolean delete(MMObjectNode node,
                      Transaction trans)
               throws StorageException
Deprecated. 
Delete a node within a transaction

Specified by:
delete in interface Storage
Specified by:
delete in class AbstractDatabaseStorage
Parameters:
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

deleteFromTable

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

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

getNode

public MMObjectNode getNode(MMObjectBuilder builder,
                            int number,
                            Transaction trans)
                     throws StorageException
Deprecated. 
Select a node from a specified builder

Specified by:
getNode in interface Storage
Specified by:
getNode in class AbstractDatabaseStorage
Parameters:
builder - The builder to select from
number - the number of the node
trans - the transaction to perform the insert in
Returns:
the MMObjectNode that was found, or null f it doesn't exist
Throws:
StorageException - if an error occurred during selection

getNodeType

public int getNodeType(int number,
                       Transaction trans)
                throws StorageException
Deprecated. 
Returns the nodetype for a specified nodereference

Specified by:
getNodeType in interface Storage
Specified by:
getNodeType in class AbstractDatabaseStorage
Parameters:
number - the number of the node
trans - the transaction to perform the insert in
Returns:
int the object type or -1 if not found
Throws:
StorageException - if an error occurred during selection

getFieldsOrderCreate

protected java.util.List getFieldsOrderCreate(MMObjectBuilder builder)
Deprecated. 
Returns the fields of a builder in the order in which they should be created.
Note: order is not of import with this particular database layer, which refers to fields by name (not index). However, older databases DO rely on a specific order of the fields, specifically when inserting data. Also, some older routines in MMBase that still execute SQL on their own (shudder!) access fields on index. Therefor, this supportclass (and extending classes) should make sure the desired order is maintained.

Parameters:
builder - the buidler whose fields to retrieve and sort
Returns:
a list of fields.

getParentBuilder

protected MMObjectBuilder getParentBuilder(MMObjectBuilder builder)
Deprecated. 
Returns the parent builder of the specifed builder. If the value is null, the builder either has no parent, or its builder is the "object" table, but there was no builder created for this low-level table.

Parameters:
builder - the buidler to find the parent of
Returns:
the parent buidler or null if it cannot be determined

getParentTableName

protected java.lang.String getParentTableName(MMObjectBuilder builder)
Deprecated. 
Returns the name of the parent table of the specifed builder. If the value is null, the builder has no parent table.

Parameters:
builder - the builder to find the parent of
Returns:
the parent table or null if it has no parent

isParentField

protected boolean isParentField(MMObjectBuilder builder,
                                java.lang.String fieldName)
Deprecated. 
Tests whether the specified field is a member of the parent table of the specifed builder.

Parameters:
builder - the builder to find the parent of
Returns:
true if the field belongs to the parent table

create

public boolean create(MMObjectBuilder builder,
                      Transaction trans)
               throws StorageException
Deprecated. 
Create a database table for the specified builder.

Specified by:
create in interface Storage
Specified by:
create in class AbstractDatabaseStorage
Parameters:
builder - the builder to create the table for\
trans - the transaction to perform the insert in
Returns:
true if the table was succesfully created
Throws:
StorageException - if an error occurred during create

createObjectStorage

public boolean createObjectStorage(Transaction trans)
                            throws StorageException
Deprecated. 
Create the object table (the basic table for all objects) within a transaction

Specified by:
createObjectStorage in interface Storage
Specified by:
createObjectStorage in class AbstractDatabaseStorage
Parameters:
trans - the transaction to perform the insert in
Returns:
true if the table was succesfully created
Throws:
StorageException - if an error occurred during create

created

public boolean created(MMObjectBuilder builder)
Deprecated. 
Tells if a table for the builder already exists

Specified by:
created in interface Storage
Specified by:
created in class AbstractDatabaseStorage
Parameters:
builder - the builder to check
Returns:
true if table exists, false if table doesn't exists

created

public boolean created(java.lang.String tableName)
Deprecated. 
Tells if a table already exists

Specified by:
created in interface MMJdbc2NodeInterface
Parameters:
tableName - name of the table to check
Returns:
true if table exists, false if table doesn't exists
Warning: Scope will be changed to:
protected

size

public int size(MMObjectBuilder builder)
Deprecated. 
Return number of objects in a builder

Specified by:
size in interface Storage
Specified by:
size in class AbstractDatabaseStorage
Parameters:
builder - the builder whose objects to count
Returns:
the number of objects the builder has, or -1 if the builder does not exist.

size

public int size(java.lang.String tableName)
Deprecated. 
Return number of entries consisting in given table. If the table does not exist, the function returns -1.

Parameters:
tableName - the table whose records to counted
Returns:
the number of items the table has, or -1 if the table does not exist.
Warning: Scope will be changed to:
protected

getBinaryFile

protected java.io.File getBinaryFile(java.lang.String tableName,
                                     java.lang.String fieldName,
                                     int number)
Deprecated. 
Defines how binary (blob) files must look like.

Parameters:
tableName -
fieldName -
number -
Returns:
The File which should represent the (byte[]) value of field fieldName of node number of table tableName
Since:
MMBase-1.7

writeBytesToFile

protected boolean writeBytesToFile(java.lang.String tableName,
                                   java.lang.String fieldName,
                                   int number,
                                   byte[] value)
Deprecated. 
Writes a byte array to a file.

Parameters:
value - the value to write
Returns:
true if succesful, false otherwise

readBytesFromFile

protected byte[] readBytesFromFile(java.lang.String tableName,
                                   java.lang.String fieldName,
                                   int number)
Deprecated. 
Reads a byte array from a file.

Specified by:
readBytesFromFile in class Support2Storage
Returns:
value the value read

drop

public boolean drop(MMObjectBuilder builder)
Deprecated. 
Drops the table of this builder.

Specified by:
drop in interface Storage
Specified by:
drop in class AbstractDatabaseStorage
Parameters:
builder - the builder whose table to drop
Returns:
true if succesful

addField

public boolean addField(MMObjectBuilder builder,
                        java.lang.String fieldname)
Deprecated. 
Adds a field to the table of this builder.

Specified by:
addField in interface Storage
Specified by:
addField in class AbstractDatabaseStorage
Parameters:
builder - the builder whose table to change
fieldname - the name fo the field to add
Returns:
true if succesful

removeField

public boolean removeField(MMObjectBuilder builder,
                           java.lang.String fieldname)
Deprecated. 
Deletes a field from the table of this builder.

Specified by:
removeField in interface Storage
Specified by:
removeField in class AbstractDatabaseStorage
Parameters:
builder - the builder whose table to change
fieldname - the name fo the field to delete
Returns:
true if succesful

changeField

public boolean changeField(MMObjectBuilder builder,
                           java.lang.String fieldname)
Deprecated. 
Changes a field to the table of this builder.

Specified by:
changeField in interface Storage
Specified by:
changeField in class AbstractDatabaseStorage
Parameters:
builder - the builder whose table to change
fieldname - the name fo the field to change
Returns:
true if succesful

updateStorage

public boolean updateStorage(MMObjectBuilder builder)
Deprecated. 
Changes the storage of a builder to match its new configuration.

Specified by:
updateStorage in interface Storage
Specified by:
updateStorage in class AbstractDatabaseStorage
Parameters:
builder - the builder whose table to change
Returns:
true if succesful


MMBase build 1.7.1.20041002