Allow SQLStatements specific for postgres

This commit is contained in:
Carlos Ruiz 2007-05-15 19:11:32 +00:00
parent 1b17a6ad49
commit 4ef7cd2bc0
1 changed files with 16 additions and 2 deletions

View File

@ -2518,14 +2518,28 @@ public class PackInHandler extends DefaultHandler {
String DBType = atts.getValue("DBType"); String DBType = atts.getValue("DBType");
PreparedStatement pstmt = DB.prepareStatement(atts.getValue("statement"), m_trxName); PreparedStatement pstmt = DB.prepareStatement(atts.getValue("statement"), m_trxName);
try { try {
if(DBType.equals("ALL")){ if(DBType.equals("ALL")) {
int n = pstmt.executeUpdate(); int n = pstmt.executeUpdate();
log.info("Executed SQL Statement: "+ atts.getValue("statement")); log.info("Executed SQL Statement: "+ atts.getValue("statement"));
} }
else if(DB.isOracle() == true && DBType.equals("Oracle")){ else if(DB.isOracle() == true && DBType.equals("Oracle")) {
pstmt.executeUpdate(); pstmt.executeUpdate();
log.info("Executed SQL Statement for Oracle: "+ atts.getValue("statement")); log.info("Executed SQL Statement for Oracle: "+ atts.getValue("statement"));
} }
else if(DB.isPostgreSQL() == true && DBType.equals("PostgreSQL")){
// Avoid convert layer - command specific for postgresql
//
// pstmt = DB.prepareStatement(sql, null);
// pstmt.executeUpdate();
//
Connection m_con = DB.getConnectionRW(true);
Statement stmt = m_con.createStatement();
int n = stmt.executeUpdate (atts.getValue("statement"));
log.info("Executed SQL Statement for PostgreSQL: "+ atts.getValue("statement"));
// Postgres needs to commit DDL statements
if (m_con != null && !m_con.getAutoCommit())
m_con.commit();
}
/* else if(DB.isSybase() == true && DBType.equals("Sybase")){ /* else if(DB.isSybase() == true && DBType.equals("Sybase")){
pstmt.executeUpdate(); pstmt.executeUpdate();
log.info("Exceuted SQL Statement for Sybase"); log.info("Exceuted SQL Statement for Sybase");