本文整理汇总了Java中java.sql.ClientInfoStatus类的典型用法代码示例。如果您正苦于以下问题:Java ClientInfoStatus类的具体用法?Java ClientInfoStatus怎么用?Java ClientInfoStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientInfoStatus类属于java.sql包,在下文中一共展示了ClientInfoStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FailedProperties40
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* Creates a new <code>FailedProperties40</code> instance. Since
* Derby doesn't support any properties, all the keys from the
* <code>props</code> parameter are added to the
* <code>failedProps_</code> member with value
* REASON_UNKNOWN_PROPERTY.
*
* @param props a <code>Properties</code> value. Can be null or empty
*/
public FailedProperties40(Properties props) {
if (props == null || props.isEmpty()) {
firstKey_ = null;
firstValue_ = null;
return;
}
Enumeration e = props.keys();
firstKey_ = (String)e.nextElement();
firstValue_ = props.getProperty(firstKey_);
failedProps_.put(firstKey_, ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
while (e.hasMoreElements()) {
failedProps_.put((String)e.nextElement(),
ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
}
}
示例2: setClientInfo
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* <code>setClientInfo</code> will throw a <code>SQLClientInfoException</code>
* uless the <code>properties</code> paramenter is empty, since GemFireXD does
* not support any properties.
*/
@Override
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
if (properties != null && !properties.isEmpty()) {
HashMap<String, ClientInfoStatus> failedProperties =
new HashMap<String, ClientInfoStatus>(properties.size());
String firstKey = null;
for (String key : properties.stringPropertyNames()) {
if (firstKey == null) {
firstKey = key;
}
failedProperties.put(key, ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
}
throw ThriftExceptionUtil.newSQLClientInfoException(
SQLState.PROPERTY_UNSUPPORTED_CHANGE, failedProperties, null,
firstKey, properties.getProperty(firstKey));
}
}
示例3: FailedProperties40
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* Creates a new <code>FailedProperties40</code> instance. Since
* Derby doesn't support any properties, all the keys from the
* <code>props</code> parameter are added to the
* <code>failedProps_</code> member with value
* REASON_UNKNOWN_PROPERTY.
*
* @param props a <code>Properties</code> value. Can be null or empty
*/
public FailedProperties40(Properties props) {
if (props == null || props.isEmpty()) {
firstKey_ = null;
firstValue_ = null;
return;
}
Enumeration e = props.keys();
firstKey_ = (String)e.nextElement();
firstValue_ = props.getProperty(firstKey_);
failedProps_.put(firstKey_, ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
while (e.hasMoreElements()) {
failedProps_.put((String)e.nextElement(),
ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
}
}
示例4: test_Constructor_LMap
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(Map<String,ClientInfoStatus>)
*/
public void test_Constructor_LMap() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
failedProperties);
assertNull("The SQLState of SQLClientInfoException should be null",
sqlClientInfoException.getSQLState());
assertNull("The reason of SQLClientInfoException should be null",
sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
}
示例5: test_Constructor_LStringLMap
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,Map<String,ClientInfoStatus>)
*/
public void test_Constructor_LStringLMap() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", failedProperties);
assertNull("The SQLState of SQLClientInfoException should be null",
sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException set and get should be equivalent",
"Message", sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
}
示例6: test_Constructor_LStringLMapLThrowable
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,Map<String,ClientInfoStatus>,Throwable)
*/
public void test_Constructor_LStringLMapLThrowable() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
Throwable cause = new RuntimeException("Message");
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", failedProperties, cause);
assertNull("The SQLState of SQLClientInfoException should be null",
sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException set and get should be equivalent",
"Message", sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
assertEquals(
"The cause of SQLClientInfoException set and get should be equivalent",
cause, sqlClientInfoException.getCause());
}
示例7: test_Constructor_LStringLStringLMap
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,Map<String,ClientInfoStatus>)
*/
public void test_Constructor_LStringLStringLMap() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", "State", failedProperties);
assertEquals(
"The SQLState of SQLClientInfoException set and get should be equivalent",
"State", sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException set and get should be equivalent",
"Message", sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
}
示例8: test_Constructor_LStringLStringLMapLThrowable
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,Map<String,ClientInfoStatus>,Throwable)
*/
public void test_Constructor_LStringLStringLMapLThrowable() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
Throwable cause = new RuntimeException("Message");
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", "State", failedProperties, cause);
assertEquals(
"The SQLState of SQLClientInfoException set and get should be equivalent",
"State", sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException set and get should be equivalent",
"Message", sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
assertEquals(
"The cause of SQLClientInfoException set and get should be equivalent",
cause, sqlClientInfoException.getCause());
}
示例9: test_Constructor_LStringLStringILMapLThrowable
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,int,Map<String,ClientInfoStatus>,Throwable)
*/
public void test_Constructor_LStringLStringILMapLThrowable() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
Throwable cause = new RuntimeException("Message");
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", "State", 1, failedProperties, cause);
assertEquals(
"The SQLState of SQLClientInfoException set and get should be equivalent",
"State", sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException set and get should be equivalent",
"Message", sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 1",
sqlClientInfoException.getErrorCode(), 1);
assertEquals(
"The cause of SQLClientInfoException set and get should be equivalent",
cause, sqlClientInfoException.getCause());
}
示例10: setClientInfo
import java.sql.ClientInfoStatus; //导入依赖的package包/类
public void setClientInfo(String name,
String value) throws SQLClientInfoException {
try {
validate();
} catch (SQLException e) {
throw new SQLClientInfoException(e.getMessage(), e.getSQLState(),
e.getErrorCode(), (Map<String, ClientInfoStatus>) null, e);
}
this.getConnection().setClientInfo(name, value);
}
示例11: newSQLClientInfoException
import java.sql.ClientInfoStatus; //导入依赖的package包/类
public static SQLClientInfoException newSQLClientInfoException(
String sqlState, Map<String, ClientInfoStatus> failedProperties,
Throwable t, Object... args) {
return new SQLClientInfoException(getMessageUtil().getCompleteMessage(
sqlState, args), getSQLStateFromIdentifier(sqlState),
getSeverityFromIdentifier(sqlState), failedProperties, t);
}
示例12: setClientInfo
import java.sql.ClientInfoStatus; //导入依赖的package包/类
public void setClientInfo(Properties properties)
throws SQLClientInfoException
{
if (properties == null || properties.size() == 0)
return;
Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>();
Iterator<String> i = properties.stringPropertyNames().iterator();
while (i.hasNext()) {
failures.put(i.next(), ClientInfoStatus.REASON_UNKNOWN_PROPERTY);
}
throw new SQLClientInfoException("ClientInfo property not supported.", failures);
}
示例13: setClientInfo
import java.sql.ClientInfoStatus; //导入依赖的package包/类
@Override
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
if (disabled) throw new SQLClientInfoException("This connection is disabled", new HashMap<String, ClientInfoStatus>());
con.setClientInfo(properties);
}
示例14: test_Constructor_LMapLThrowable
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests java.sql.SQLClientInfoException#SQLClientInfoException(Map<String,ClientInfoStatus>,Throwable)
*/
public void test_Constructor_LMapLThrowable() {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
Throwable cause = new RuntimeException("Message");
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
failedProperties, cause);
assertNull("The SQLState of SQLClientInfoException should be null",
sqlClientInfoException.getSQLState());
assertEquals(
"The reason of SQLClientInfoException should be equals to cause.toString()",
"java.lang.RuntimeException: Message", sqlClientInfoException
.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
assertEquals(
"The cause of SQLClientInfoException set and get should be equivalent",
cause, sqlClientInfoException.getCause());
sqlClientInfoException = new SQLClientInfoException(failedProperties,
null);
assertNull("The SQLState of SQLClientInfoException should be null",
sqlClientInfoException.getSQLState());
assertNull("The reason of SQLClientInfoException should be null",
sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of SQLClientInfoException set and get should be equivalent",
failedProperties, sqlClientInfoException.getFailedProperties());
assertEquals("The error code of SQLClientInfoException should be 0",
sqlClientInfoException.getErrorCode(), 0);
}
示例15: testSerializationSelf
import java.sql.ClientInfoStatus; //导入依赖的package包/类
/**
* @tests serialization/deserialization.
*/
public void testSerializationSelf() throws Exception {
Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
failedProperties
.put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
Throwable cause = new RuntimeException("Message");
SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
"Message", "State", 1, failedProperties, cause);
SerializationTest.verifySelf(sqlClientInfoException, exComparator);
}