package org.jdbc.adapter.ifx;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.concurrent.Executor;
import java.util.logging.Logger;

import org.jdbc.adapter.iface.StatementWrapper;
import org.jdbc.adapter.jdbc42.Jdbc42Connection;

import com.informix.jdbc.IfmxConnection;

/**
 * @author David Matějček
 */
public class Ifx42Connection extends Jdbc42Connection {
  private static final Logger LOG = Logger.getLogger(Ifx42Connection.class.getName());

  public Ifx42Connection(final Connection connection) {
    super(connection);
  }


  /**
   * @param statement
   * @return a {@link Ifx42Statement} instance.
   */
  @Override
  public StatementWrapper wrap(final Statement statement) {
    if (statement == null) {
      return null;
    }
    return new Ifx42Statement(statement, this);
  }


  /**
   * @return the wrapped connection;
   */
  @Override
  protected final IfmxConnection getConnection() {
    return IfmxConnection.class.cast(getConnection());
  }


  /**
   * IFXJDBC does not support this method. This wrapper ignores it.
   */
  @Override
  public void setNetworkTimeout(final Executor executor, final int milliseconds) throws SQLException {
    LOG.warning("This driver does not support the setNetworkTimeout(Executor executor, int milliseconds)."
        + " Method call was ignored.");
  }


  /**
   * IFXJDBC does not support this method. This wrapper always returns 0 (no timeout).
   */
  @Override
  public int getNetworkTimeout() throws SQLException {
    return 0;
  }
}

@@ -48,24 +48,64 @@
 Connection;%0A
+import java.sql.SQLClientInfoException;%0A
 import java.
@@ -149,16 +149,45 @@
 tement;%0A
+import java.util.Properties;%0A
 import j
@@ -480,16 +480,17 @@
 ction %7B%0A
+%0A
   privat
@@ -568,16 +568,120 @@
 ame());%0A
+  private Properties clientInfo;%0A%0A%0A  /**%0A   * @param connection instance of %7B@link IfmxConnection%7D%0A   */
 %0A  publi
@@ -1051,17 +1051,28 @@
 wrapped 
-c
+%7B@link IfmxC
 onnectio
@@ -1072,17 +1072,18 @@
 nnection
-;
+%7D.
 %0A   */%0A 
@@ -1197,32 +1197,1662 @@
 ction());%0A  %7D%0A%0A%0A
+  /**%0A   * This method is not supported by IFXJDBC driver, but wrapper uses local Properties to give some%0A   * primitive support.%0A   *%0A   * @param properties - source properties to be copied into internal copy.%0A   */%0A  @Override%0A  public void setClientInfo(final Properties properties) throws SQLClientInfoException %7B%0A    if (properties == null) %7B%0A      this.clientInfo = null;%0A      return;%0A    %7D%0A    this.clientInfo = new Properties();%0A    this.clientInfo.putAll(properties);%0A  %7D%0A%0A%0A  /**%0A   * This method is not supported by IFXJDBC driver, but wrapper uses local Properties to give some%0A   * primitive support.%0A   */%0A  @Override%0A  public void setClientInfo(final String name, final String value) throws SQLClientInfoException %7B%0A    if (this.clientInfo == null) %7B%0A      this.clientInfo = new Properties();%0A    %7D%0A    this.clientInfo.setProperty(name, value);%0A  %7D%0A%0A%0A  /**%0A   * This method is not supported by IFXJDBC driver, but wrapper uses local Properties to give some%0A   * primitive support.%0A   *%0A   * @return the copy of the internal properties. Never null.%0A   */%0A  @Override%0A  public Properties getClientInfo() throws SQLException %7B%0A    if (this.clientInfo == null) %7B%0A      return new Properties();%0A    %7D%0A    final Properties toReturn = new Properties();%0A    toReturn.putAll(this.clientInfo);%0A    return toReturn;%0A  %7D%0A%0A%0A  /**%0A   * This method is not supported by IFXJDBC driver, but wrapper uses local Properties to give some%0A   * primitive support.%0A   */%0A  @Override%0A  public String getClientInfo(final String name) throws SQLException %7B%0A    return this.clientInfo == null ? null : this.clientInfo.getProperty(name);%0A  %7D%0A%0A%0A
   /**%0A   * IFXJD

Support for set and getClientInfo and IFXJDBC