using System;
using System.Reflection;
using ChemAxon.JNI;
using java.lang;
using java.util;
namespace java.sql
{
///
/// The subclass of SQLException is thrown when one or more client info properties could not be set on a Connection.
/// In addition to the information provided by SQLException, a SQLClientInfoException provides a list of client info
/// properties that were not set. Some databases do not allow multiple client info properties to be set atomically.
/// For those databases, it is possible that some of the client info properties had been set even though the
/// Connection.setClientInfo method threw an exception. An application can use the getFailedProperties method to retrieve
/// a list of client info properties that were not set. The properties are identified by passing a Map
/// to the appropriate SQLClientInfoException constructor.
///
[Serializable]
public class SQLClientInfoException : java.sql.SQLException, java.io.Serializable, java.lang.Iterable
{
///
/// Constructs a SQLClientInfoException Object.
///
public SQLClientInfoException()
: base()
{
}
///
/// Constructs a SQLClientInfoException object initialized with a given message.
///
///
public SQLClientInfoException(string message)
: base(message)
{
}
///
/// Constructs a SQLClientInfoException object initialized with a given failedProperties.
///
///
public SQLClientInfoException(Map failedProperties)
: base()
{
MethodBase methodBase = MethodBase.GetCurrentMethod();
string javaClassName = JavaNativeInterface.GetJavaClassName(methodBase.DeclaringType);
string signature = JavaNativeInterface.GetSignature(methodBase, failedProperties);
InitializeJavaClass(javaClassName);
InitializeJavaObject(signature, failedProperties);
}
///
/// Additional function. This function is not part of the original
/// java.sql.SQLClientInfoException class.
///
///
public string getFormattedMessage()
{
string msg = base.getMessage();
return string.Format("This is the message of the exception: {0}.", msg);
}
///
/// Returns the list of client info properties that could not be set.
///
///
public Map getFailedProperties()
{
var map = this.JNI.CallMethod(this.JavaClass, this.JavaObject, MethodBase.GetCurrentMethod());
return new JniMapExt(map.JavaObject);
}
}
}