/*-----------------------------------------------------------------------------
 *
 * Enhydra JdbcS
 * The Initial Developer of the Original Code is Lutris Technologies Inc.
 * Portions created by Lutris are Copyright 1997-2000 Lutris Technologies Inc.
 * All Rights Reserved.
 *
 * The contents of this file are subject to the Enhydra Public License
 * Version 1.1 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 * www.enhydra.org/license/epl.html
 *
 * Software distributed under the License is distributed on an "ASIS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * -----------------------------------------------------------------------------
 * $Id$
 * -----------------------------------------------------------------------------
 */
package org.enhydra.jdbc.informix;

import org.enhydra.jdbc.standard.*;
import java.sql.*;
import java.util.*;

public class InformixConnectionHandle extends StandardConnectionHandle {

    private int lockModeWait = 0;	// The amound time to wait on a query or transaction

    public InformixConnectionHandle (InformixPooledConnection pooledCon, Hashtable preparedStatementCache, int preparedStmtCacheSize) {
	    super (pooledCon, preparedStatementCache,preparedStmtCacheSize);
    } // constructor

    public synchronized void setLockModeToWait(int seconds) throws SQLException {
	if (lockModeWait != seconds) {
	    if (seconds >0) {
		execute("SET LOCK MODE TO WAIT " + seconds);
	    } else if (seconds == 0) {
		execute("SET LOCK MODE TO NOT WAIT ");
	    } else {
		execute("SET LOCK MODE TO WAIT ");
	    }
	    lockModeWait = seconds;
	}
    } // method setLockModeToWait

    public synchronized void execute (String sql) throws SQLException {
	Statement stat = createStatement();
	stat.execute(sql);
    } // method execute

} // class InformixConnectionHandle
