1 22 23 package org.xquark.mapper.storage; 24 25 import java.sql.*; 26 27 import org.xquark.jdbc.typing.DBMSConstants; 28 import org.xquark.mapper.dbms.AbstractConnection; 29 import org.xquark.mapper.dbms.TableInfo; 30 import org.xquark.mapper.metadata.RepositoryConstants; 31 32 36 public abstract class AbstractPersistentNode implements RepositoryConstants, DBMSConstants 37 { 38 private static final String RCSRevision = "$Revision: 1.2 $"; 39 private static final String RCSName = "$Name: $"; 40 41 45 46 protected TableInfo tableInfo = null; 47 protected Statement stmt = null; 48 protected ResultSet rs = null; 49 50 protected String insertStmt; 51 52 56 protected PreparedStatement pStmt = null; 57 58 protected long docOID = -1; 59 protected long uoid = -1; 60 protected int rsColumnOffset = 1; 61 62 public AbstractPersistentNode(TableInfo tableInfo) 63 { 64 this.tableInfo = tableInfo; 65 } 66 67 public void set(long docOID) {this.docOID = docOID;} 68 69 public long getUOID() { return uoid;} 70 71 public void close() throws SQLException 72 { 73 reset(); 74 if (pStmt != null) 76 pStmt.close(); 77 pStmt = null; 78 } 79 80 public void reset() throws SQLException 81 { 82 if (rs != null) 84 rs.close(); 85 if (stmt != null) 86 stmt.close(); 87 docOID = -1; 88 uoid = -1; 89 rs = null; 90 stmt = null; 91 } 92 93 97 104 public static PreparedStatement getDeleteStatement(AbstractConnection connection, TableInfo tableInfo) 105 throws SQLException 106 { 107 return connection.getConnection().prepareStatement("DELETE FROM " 108 + tableInfo.getName() + " WHERE UOID >= ? and UOID <= ?"); 109 } 110 111 } 112 | Popular Tags |