1 23 package com.lutris.appserver.server.sql.informix; 24 25 import java.sql.SQLException ; 26 27 import com.lutris.appserver.server.sql.ConnectionAllocator; 28 import com.lutris.appserver.server.sql.standard.StandardDBConnection; 29 30 38 public class InformixDBConnection extends StandardDBConnection { 39 40 43 private int lockModeWait = 0; 44 45 48 protected InformixLogicalDatabase logicalDatabase; 49 50 65 protected InformixDBConnection(InformixConnectionAllocator connectionAllocator, 66 String url, String user, String password, 67 int maxPreparedStatements, 68 boolean logging, int generation) 69 throws SQLException { 70 super((ConnectionAllocator)connectionAllocator, url, user, password, maxPreparedStatements, 71 logging, generation); 72 this.logicalDatabase = connectionAllocator.logicalDatabase; 73 } 74 75 84 public synchronized void setLockModeToWait(boolean on) 85 throws SQLException { 86 if (on) { 87 setLockModeToWait(-1); 88 } else { 89 setLockModeToWait(0); 90 } 91 } 92 93 104 public synchronized void setLockModeToWait(int seconds) 105 throws SQLException { 106 if (lockModeWait != seconds) { 107 logDebug("set lock mode to wait " + seconds); 108 if (seconds > 0) { 109 execute("SET LOCK MODE TO WAIT " + seconds); 110 } else if (seconds == 0) { 111 execute("SET LOCK MODE TO NOT WAIT"); 112 } else { 113 execute("SET LOCK MODE TO WAIT"); 114 } 115 lockModeWait = seconds; 116 } 117 } 118 } 119 | Popular Tags |