--- ORIGINAL_MMOracle.java	Tue Oct  8 10:19:51 2002
+++ MODIFIED_MMOracle.java	Tue Oct  8 10:19:51 2002
@@ -8,11 +8,28 @@
 
 */
 /*
-$Id: MMOracle.java.diff,v 1.2 2002/10/08 08:23:16 remvee Exp $
+$Id: MMOracle.java.diff,v 1.2 2002/10/08 08:23:16 remvee Exp $
 
-$Log: MMOracle.java.diff,v $
-Revision 1.2  2002/10/08 08:23:16  remvee
-refreshed diff
-
-Revision 1.2  2002/10/08 08:18:56  aldbab
-The original version from: Revision 1.5  2001/03/09 09:12:04  pierre (mmbase-src-1.5.1.zip)
+$Log: MMOracle.java.diff,v $
+Revision 1.2  2002/10/08 08:23:16  remvee
+refreshed diff
+
+Revision 1.3  2002/10/08 08:16:40  aldbab
+Bug Fix in  methods:
+ getDBText(ResultSet rs,int idx)
+  and
+ removeNode(MMObjectBuilder bul,MMObjectNode node).
+
+1. getDBText, was not take care that when try to retrieved a field from the oracle DB as clob
+but it is not a clob, oracle driver give an exception: "Invalid column type".
+
+2. removeNode, was not take care that Oracle is not an Object Oriented DB, so tables inherited
+doesn't exists, so when delete insrel it also necessary to delete rows in subtable of insrel.
+
+Added more debugs information in method: getDBKeyOld().
+
+P.S. If the db is empty (without table created) when start tomcat, mmbase created the tables
+without problems and all work fine, but the method getDBKeyOld() give this strange error:
+"MMBase -> while getting a new key number: ORA-00942: table or view does not exist" on the
+table object.
+Seems to me, that this method is invoked before the object table is created.
 
 Revision 1.5  2001/03/09 09:12:04  pierre
 pierre: added directionality support to databse support classes. also added logging.
@@ -196,7 +213,7 @@
 * @author Daniel Ockeloen
 * @author Pierre van Rooden
 * @version 09 Mar 2001
-* @$Revision: 1.2 $ $Date: 2002/10/08 08:23:16 $
+* @$Revision: 1.2 $ $Date: 2002/10/08 08:23:16 $
 */
 public class MMOracle extends MMSQL92Node implements MMJdbc2NodeInterface {
 
@@ -469,8 +486,18 @@
 		int siz;
 
 		try {
-			Clob c=rs.getClob(idx);
+			//begin bug fix--------- Aldo Babucci 03/10/2002
+			Clob c = null;
+			try{
+				c=rs.getClob(idx);
 			inp=c.getAsciiStream();
+			} catch (Exception exc) {
+				//is not a clob. When try to retrieved a field from the oracle DB as clob but it is not a clob,
+				//oracle driver give an exception: Invalid column type
+				return null;
+			}
+			//end bug fix -----------
+
 			if (inp==null) {
 				log.warn("MMObjectBuilder -> MMysql42Node DBtext no ascii "+inp);
 				 return("");
@@ -815,6 +842,24 @@
 				}
 			}
 
+			//begin: added this piece of code for bug fix --------- Aldo Babucci 07/10/2002
+			//The problem was that not deletion of posrel was when delete insrel, because Oracle is not a
+			//Object Oriented DB, so tables inherited doesn't exists.  Now delete also posrel.
+			String otypeString = mmb.getTypeDef().getValue(node.getOType());
+			if (node.parent!=null && (node.parent instanceof InsRel) && bul.tableName.equals("insrel") && !otypeString.equals("insrel")) {
+				log.debug("deleting row in subtable of insrel the subtable is of type("+ otypeString +") and the object number is="+ number);
+				try {
+					MultiConnection con=mmb.getConnection();
+					Statement stmt=con.createStatement();
+					stmt.executeUpdate("delete from "+mmb.baseName+"_"+otypeString+" where "+getNumberString()+"="+number);
+					stmt.close();
+					con.close();
+				} catch (SQLException e) {
+					log.error(Logging.stackTrace(e));
+				}
+			}
+			//end bug fix -----------
+
 			try {
 				MultiConnection con=mmb.getConnection();
 				Statement stmt=con.createStatement();
@@ -910,7 +955,8 @@
 			stmt.close();
 			con.close();
 		} catch (SQLException e) {
-			log.error("MMBase -> while getting a new key number");
+			log.error("MMBase -> while getting a new key number: "+e.getMessage());
+			log.debug(Logging.stackTrace(e));
 			return(1);
 		}
 		return(number);
