1 22 package org.enhydra.jdbc.informix; 23 24 import org.enhydra.jdbc.standard.StandardConnectionHandle; 25 26 import java.util.Hashtable ; 27 import java.sql.SQLException ; 28 import java.sql.Statement ; 29 30 public class InformixConnectionHandle extends StandardConnectionHandle { 31 32 private int lockModeWait = 0; 34 public InformixConnectionHandle (InformixPooledConnection pooledCon, Hashtable preparedStatementCache, int preparedStmtCacheSize) { 35 super (pooledCon, preparedStatementCache,preparedStmtCacheSize); 36 } 37 38 public synchronized void setLockModeToWait(int seconds) throws SQLException { 39 if (lockModeWait != seconds) { 40 if (seconds >0) { 41 execute("SET LOCK MODE TO WAIT " + seconds); 42 } else if (seconds == 0) { 43 execute("SET LOCK MODE TO NOT WAIT "); 44 } else { 45 execute("SET LOCK MODE TO WAIT "); 46 } 47 lockModeWait = seconds; 48 } 49 } 50 51 public synchronized void execute (String sql) throws SQLException { 52 Statement stat = createStatement(); 53 stat.execute(sql); 54 } 55 56 } 57 | Popular Tags |