org.mmbase.module.database.support
Interface MMJdbc2NodeInterface

All Known Implementing Classes:
MMInformix42Node, MMMckoiNode, MMMysql42Node, MMOORel2Node, MMOracle, MMPostgres42Node, MMSQL92Node, PostgreSQL71, Support2Storage, RelationalDatabaseStorage

public interface MMJdbc2NodeInterface

MMJdbc2NodeInterface interface needs to be implemented to support a new database It is used to abstract the query's needed for mmbase for each database.

Version:
$Id: MMJdbc2NodeInterface.java,v 1.18 2002/09/16 15:07:29 pierre Exp $
Author:
Vpro, Pierre van Rooden

Method Summary
 boolean addField(MMObjectBuilder bul, java.lang.String dbname)
           
 boolean changeField(MMObjectBuilder bul, java.lang.String dbname)
           
 boolean commit(MMObjectBuilder bul, MMObjectNode node)
           
 boolean create(MMObjectBuilder bul)
           
 boolean created(java.lang.String tableName)
          Tells if a table already exists
 boolean createObjectTable(java.lang.String baseName)
           
 MMObjectNode decodeDBnodeField(MMObjectNode node, java.lang.String fieldname, java.sql.ResultSet rs, int i)
           
 MMObjectNode decodeDBnodeField(MMObjectNode node, java.lang.String fieldname, java.sql.ResultSet rs, int i, java.lang.String prefix)
           
 boolean drop(MMObjectBuilder bul)
           
 java.lang.String getAllowedField(java.lang.String disallowedfield)
           
 MultiConnection getConnection(JDBCInterface jdbc)
           
 byte[] getDBByte(java.sql.ResultSet rs, int idx)
           
 int getDBKey()
          Gives an unique number for a node to be inserted.
 java.lang.String getDBText(java.sql.ResultSet rs, int idx)
           
 java.lang.String getDisallowedField(java.lang.String allowedfield)
           
 java.lang.String getMMNodeSearch2SQL(java.lang.String where, MMObjectBuilder bul)
           
 java.lang.String getNumberString()
           
 java.lang.String getOTypeString()
           
 java.lang.String getOwnerString()
           
 byte[] getShortedByte(java.lang.String tableName, java.lang.String fieldname, int number)
           
 java.lang.String getShortedText(java.lang.String tableName, java.lang.String fieldname, int number)
           
 void init(MMBase mmb, XMLDatabaseReader parser)
           
 int insert(MMObjectBuilder bul, java.lang.String owner, MMObjectNode node)
           
 boolean isAllowedParentBuilder(MMObjectBuilder builder)
          Returns whether this database support layer allows for buidler to be a parent builder (that is, other builders can 'extend' this builder and its database tables).
 void registerParentBuilder(MMObjectBuilder parent, MMObjectBuilder child)
          Registers a builder as a parent builder (that is, other buidlers can 'extend' this builder and its database tables).
 boolean removeField(MMObjectBuilder bul, java.lang.String dbname)
           
 void removeNode(MMObjectBuilder bul, MMObjectNode node)
           
 void setDBByte(int i, java.sql.PreparedStatement stmt, byte[] bytes)
           
 boolean updateTable(MMObjectBuilder bul)
           
 

Method Detail

isAllowedParentBuilder

public boolean isAllowedParentBuilder(MMObjectBuilder builder)
Returns whether this database support layer allows for buidler to be a parent builder (that is, other builders can 'extend' this builder and its database tables).
Parameters:
builder - the builder to test
Returns:
true if the builder can be extended
Since:
MMBase-1.6

registerParentBuilder

public void registerParentBuilder(MMObjectBuilder parent,
                                  MMObjectBuilder child)
                           throws StorageException
Registers a builder as a parent builder (that is, other buidlers can 'extend' this builder and its database tables). At the least, this code should check whether the builder is allowed as a parent builder, and throw an exception if this is not possible. This method can be overridden to allow for optimization of code regarding such builders.
Parameters:
parent - the parent builder to register
child - the builder to register as the parent's child
Throws:
UnsupportedDatabaseOperationException - when the databse layer does not allow extension of this builder
Since:
MMBase-1.6

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldname,
                                      java.sql.ResultSet rs,
                                      int i)

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldname,
                                      java.sql.ResultSet rs,
                                      int i,
                                      java.lang.String prefix)

getMMNodeSearch2SQL

public java.lang.String getMMNodeSearch2SQL(java.lang.String where,
                                            MMObjectBuilder bul)

getShortedText

public java.lang.String getShortedText(java.lang.String tableName,
                                       java.lang.String fieldname,
                                       int number)

getShortedByte

public byte[] getShortedByte(java.lang.String tableName,
                             java.lang.String fieldname,
                             int number)

getDBByte

public byte[] getDBByte(java.sql.ResultSet rs,
                        int idx)

getDBText

public java.lang.String getDBText(java.sql.ResultSet rs,
                                  int idx)

insert

public int insert(MMObjectBuilder bul,
                  java.lang.String owner,
                  MMObjectNode node)

commit

public boolean commit(MMObjectBuilder bul,
                      MMObjectNode node)

removeNode

public void removeNode(MMObjectBuilder bul,
                       MMObjectNode node)

getDBKey

public int getDBKey()
Gives an unique number for a node to be inserted. This method should be implemneted to work with multiple mmbase instances working on the same storage.
Returns:
unique number

init

public void init(MMBase mmb,
                 XMLDatabaseReader parser)

setDBByte

public void setDBByte(int i,
                      java.sql.PreparedStatement stmt,
                      byte[] bytes)

created

public boolean created(java.lang.String tableName)
Tells if a table already exists
Returns:
true if table exists, false if table doesn't exists

create

public boolean create(MMObjectBuilder bul)

createObjectTable

public boolean createObjectTable(java.lang.String baseName)

getConnection

public MultiConnection getConnection(JDBCInterface jdbc)
                              throws java.sql.SQLException

getDisallowedField

public java.lang.String getDisallowedField(java.lang.String allowedfield)

getAllowedField

public java.lang.String getAllowedField(java.lang.String disallowedfield)

getNumberString

public java.lang.String getNumberString()

getOwnerString

public java.lang.String getOwnerString()

getOTypeString

public java.lang.String getOTypeString()

drop

public boolean drop(MMObjectBuilder bul)

updateTable

public boolean updateTable(MMObjectBuilder bul)

addField

public boolean addField(MMObjectBuilder bul,
                        java.lang.String dbname)

removeField

public boolean removeField(MMObjectBuilder bul,
                           java.lang.String dbname)

changeField

public boolean changeField(MMObjectBuilder bul,
                           java.lang.String dbname)


MMBase build 1.6.5.20030923