1 23 package com.lutris.appserver.server.sql.informix; 24 25 import java.sql.SQLException ; 26 import org.enhydra.dods.DODS; 27 import com.lutris.appserver.server.sql.DatabaseManagerException; 28 import com.lutris.appserver.server.sql.standard.StandardDBQuery; 29 30 37 public class InformixDBQuery extends StandardDBQuery { 38 39 44 private int queryTimeout = 0; 45 46 49 protected InformixDBConnection conn; 50 51 59 protected InformixDBQuery(InformixDBConnection dbConnection) 60 throws SQLException { 61 super(dbConnection); 62 this.conn = dbConnection; 63 try { 64 setQueryTimeout(dbConnection.logicalDatabase.getDefaultQueryTimeout()); 65 } catch (SQLException sqlExcept) { 66 handleException(sqlExcept); 67 dbConnection.release(); 68 throw sqlExcept; 69 } 70 } 71 72 86 public InformixDBQuery() 87 throws SQLException , DatabaseManagerException { 88 this((InformixDBConnection) DODS.getDatabaseManager().allocateConnection()); 89 } 90 91 102 public InformixDBQuery(String dbName) 103 throws SQLException , DatabaseManagerException { 104 this((InformixDBConnection) DODS.getDatabaseManager().allocateConnection(dbName)); 105 } 106 107 115 public void setQueryTimeout(int seconds) 116 throws SQLException { 117 try { 118 logDebug("set query time out to " + seconds); 119 conn.setLockModeToWait(queryTimeout); 120 queryTimeout = seconds; 121 } catch (SQLException e) { 122 handleException(e); 123 throw e; 124 } 125 } 126 } 127 | Popular Tags |