org.mmbase.module.database.support
Class MMSQL92Node

java.lang.Object
  |
  +--org.mmbase.module.database.support.MMSQL92Node
All Implemented Interfaces:
MMJdbc2NodeInterface
Direct Known Subclasses:
MMHsqldb2Node, MMHypersonic2Node, MMInformix42Node, MMMysql42Node, MMOORel2Node, MMOracle, MMPostgres42Node

public class MMSQL92Node
extends java.lang.Object
implements MMJdbc2NodeInterface

MMSQL92Node implements the MMJdbc2NodeInterface for sql92 types of database this is the class used to abstact the query's needed for mmbase for each database.

Version:
$Id: MMSQL92Node.java,v 1.53.2.1 2002/02/25 13:55:23 kees Exp $
Author:
Daniel Ockeloen, Pierre van Rooden

Field Summary
 java.lang.String name
           
 
Constructor Summary
MMSQL92Node()
           
 
Method Summary
 boolean addField(MMObjectBuilder bul, java.lang.String fieldname)
           
 boolean changeField(MMObjectBuilder bul, java.lang.String fieldname)
           
 boolean commit(MMObjectBuilder bul, MMObjectNode node)
          Commit this node to the database
 java.lang.String convertXMLType(FieldDefs def)
           
 boolean create_real(MMObjectBuilder bul, java.lang.String tableName)
          Will be removed once the xml setup system is done (?)
 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_real(MMObjectBuilder bul, java.lang.String tableName)
          Will be removed once the xml setup system is done (?)
 boolean drop(MMObjectBuilder bul)
           
 java.lang.String getAllowedField(java.lang.String disallowedfield)
           
 MultiConnection getConnection(JDBCInterface jdbc)
           
 byte[] getDBByte(java.sql.ResultSet rs, int idx)
          Get byte of a database blob
 int getDBKey()
          Gives an unique number This method will work with multiple mmbases
 int getDBKeyOld()
           
 java.lang.String getDBText(java.sql.ResultSet rs, int idx)
          Get text of a database blob
 java.lang.String getDisallowedField(java.lang.String allowedfield)
           
 java.lang.String getMatchCREATE(java.lang.String tableName)
          gets the sytax of the create statement for current database.
 java.lang.String getMMNodeSearch2SQL(java.lang.String where, MMObjectBuilder bul)
           
 java.lang.String getNumberString()
           
 java.lang.String getOTypeString()
           
 java.lang.String getOwnerString()
           
 java.util.Hashtable getReverseHash(java.util.Hashtable in)
           
 byte[] getShortedByte(java.lang.String tableName, java.lang.String fieldname, int number)
          Get byte of a database blob
 java.lang.String getShortedText(java.lang.String tableName, java.lang.String fieldname, int number)
          Get text from blob
 void init(MMBase mmb, XMLDatabaseReader parser)
           
 int insert_real(MMObjectBuilder bul, java.lang.String owner, MMObjectNode node, java.lang.String tableName)
           
 int insert(MMObjectBuilder bul, java.lang.String owner, MMObjectNode node)
          Insert: This method inserts a new object, normally not used (only subtables are used) Only fields with DBState value = DBSTATE_PERSISTENT or DBSTATE_SYSTEM are inserted.
 java.lang.String parseFieldPart(java.lang.String fieldname, int dbtype, java.lang.String part)
           
 boolean removeField(MMObjectBuilder bul, java.lang.String fieldname)
           
 void removeNode(MMObjectBuilder bul, MMObjectNode node)
          removeNode
 void setDBByte(int i, java.sql.PreparedStatement stmt, byte[] bytes)
          Set byte array in database
 void setDBText(int i, java.sql.PreparedStatement stmt, java.lang.String body)
          Set text array in database
 int size(java.lang.String tableName)
          Return number of entries consisting in given table
 boolean tableSizeProtection(MMObjectBuilder bul)
           
 boolean updateTable(MMObjectBuilder bul)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
Constructor Detail

MMSQL92Node

public MMSQL92Node()
Method Detail

init

public void init(MMBase mmb,
                 XMLDatabaseReader parser)
Specified by:
init in interface MMJdbc2NodeInterface

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldname,
                                      java.sql.ResultSet rs,
                                      int i)
Specified by:
decodeDBnodeField in interface MMJdbc2NodeInterface

decodeDBnodeField

public MMObjectNode decodeDBnodeField(MMObjectNode node,
                                      java.lang.String fieldname,
                                      java.sql.ResultSet rs,
                                      int i,
                                      java.lang.String prefix)
Specified by:
decodeDBnodeField in interface MMJdbc2NodeInterface

getMMNodeSearch2SQL

public java.lang.String getMMNodeSearch2SQL(java.lang.String where,
                                            MMObjectBuilder bul)
Specified by:
getMMNodeSearch2SQL in interface MMJdbc2NodeInterface

parseFieldPart

public java.lang.String parseFieldPart(java.lang.String fieldname,
                                       int dbtype,
                                       java.lang.String part)

getShortedText

public java.lang.String getShortedText(java.lang.String tableName,
                                       java.lang.String fieldname,
                                       int number)
Get text from blob
Specified by:
getShortedText in interface MMJdbc2NodeInterface

getShortedByte

public byte[] getShortedByte(java.lang.String tableName,
                             java.lang.String fieldname,
                             int number)
Get byte of a database blob
Specified by:
getShortedByte in interface MMJdbc2NodeInterface

getDBByte

public byte[] getDBByte(java.sql.ResultSet rs,
                        int idx)
Get byte of a database blob
Specified by:
getDBByte in interface MMJdbc2NodeInterface

getDBText

public java.lang.String getDBText(java.sql.ResultSet rs,
                                  int idx)
Get text of a database blob
Specified by:
getDBText in interface MMJdbc2NodeInterface

insert

public int insert(MMObjectBuilder bul,
                  java.lang.String owner,
                  MMObjectNode node)
Insert: This method inserts a new object, normally not used (only subtables are used) Only fields with DBState value = DBSTATE_PERSISTENT or DBSTATE_SYSTEM are inserted. Fields with DBstate values = DBSTATE_VIRTUAL or any other value are skipped.
Specified by:
insert in interface MMJdbc2NodeInterface
Parameters:
bul - The MMObjectBuilder.
owner - The nodes' owner.
node - The current node that's to be inserted.
Returns:
The DBKey number for this node, or -1 if an error occurs.

insert_real

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

setDBText

public void setDBText(int i,
                      java.sql.PreparedStatement stmt,
                      java.lang.String body)
Set text array in database

setDBByte

public void setDBByte(int i,
                      java.sql.PreparedStatement stmt,
                      byte[] bytes)
Set byte array in database
Specified by:
setDBByte in interface MMJdbc2NodeInterface

commit

public boolean commit(MMObjectBuilder bul,
                      MMObjectNode node)
Commit this node to the database
Specified by:
commit in interface MMJdbc2NodeInterface

removeNode

public void removeNode(MMObjectBuilder bul,
                       MMObjectNode node)
removeNode
Specified by:
removeNode in interface MMJdbc2NodeInterface

getDBKey

public int getDBKey()
Gives an unique number This method will work with multiple mmbases
Specified by:
getDBKey in interface MMJdbc2NodeInterface
Returns:
unique number

getDBKeyOld

public int getDBKeyOld()

created

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

size

public int size(java.lang.String tableName)
Return number of entries consisting in given table
Parameters:
tableName - the table that has to be counted
Returns:
the number of items the table has

create

public boolean create(MMObjectBuilder bul)
Specified by:
create in interface MMJdbc2NodeInterface

create_real

public boolean create_real(MMObjectBuilder bul,
                           java.lang.String tableName)
Will be removed once the xml setup system is done (?)

drop

public boolean drop(MMObjectBuilder bul)
Specified by:
drop in interface MMJdbc2NodeInterface

drop_real

public boolean drop_real(MMObjectBuilder bul,
                         java.lang.String tableName)
Will be removed once the xml setup system is done (?)

addField

public boolean addField(MMObjectBuilder bul,
                        java.lang.String fieldname)
Specified by:
addField in interface MMJdbc2NodeInterface

removeField

public boolean removeField(MMObjectBuilder bul,
                           java.lang.String fieldname)
Specified by:
removeField in interface MMJdbc2NodeInterface

changeField

public boolean changeField(MMObjectBuilder bul,
                           java.lang.String fieldname)
Specified by:
changeField in interface MMJdbc2NodeInterface

updateTable

public boolean updateTable(MMObjectBuilder bul)
Specified by:
updateTable in interface MMJdbc2NodeInterface

createObjectTable

public boolean createObjectTable(java.lang.String baseName)
Specified by:
createObjectTable in interface MMJdbc2NodeInterface

convertXMLType

public java.lang.String convertXMLType(FieldDefs def)

getMatchCREATE

public java.lang.String getMatchCREATE(java.lang.String tableName)
gets the sytax of the create statement for current database.

getReverseHash

public java.util.Hashtable getReverseHash(java.util.Hashtable in)

getDisallowedField

public java.lang.String getDisallowedField(java.lang.String allowedfield)
Specified by:
getDisallowedField in interface MMJdbc2NodeInterface

getAllowedField

public java.lang.String getAllowedField(java.lang.String disallowedfield)
Specified by:
getAllowedField in interface MMJdbc2NodeInterface

getConnection

public MultiConnection getConnection(JDBCInterface jdbc)
                              throws java.sql.SQLException
Specified by:
getConnection in interface MMJdbc2NodeInterface

getNumberString

public java.lang.String getNumberString()
Specified by:
getNumberString in interface MMJdbc2NodeInterface

getOTypeString

public java.lang.String getOTypeString()
Specified by:
getOTypeString in interface MMJdbc2NodeInterface

getOwnerString

public java.lang.String getOwnerString()
Specified by:
getOwnerString in interface MMJdbc2NodeInterface

tableSizeProtection

public boolean tableSizeProtection(MMObjectBuilder bul)


MMBase 2002