当前位置: 首页>>代码示例>>Java>>正文


Java ServerErrorMessage.getMessage方法代码示例

本文整理汇总了Java中org.postgresql.util.ServerErrorMessage.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ServerErrorMessage.getMessage方法的具体用法?Java ServerErrorMessage.getMessage怎么用?Java ServerErrorMessage.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.postgresql.util.ServerErrorMessage的用法示例。


在下文中一共展示了ServerErrorMessage.getMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initFromServerErrorMessage

import org.postgresql.util.ServerErrorMessage; //导入方法依赖的package包/类
private void initFromServerErrorMessage(ServerErrorMessage sem) {
    if (sem == null) {
        return;
    }
    sqlState = sem.getSQLState();
    serverMessage = sem.getMessage();
    severity = sem.getSeverity();
    detail = sem.getDetail();
    hint = sem.getHint();
    position = sem.getPosition();
    where = sem.getWhere();
    schema = sem.getSchema();
    table = sem.getTable();
    column = sem.getColumn();
    dataType = sem.getDatatype();
    constraint = sem.getConstraint();
    file = sem.getFile();
    line = sem.getLine();
    routine = sem.getRoutine();
    internalQuery = sem.getInternalQuery();
    internalPosition = sem.getInternalPosition();
}
 
开发者ID:manniwood,项目名称:cl4pg,代码行数:23,代码来源:Cl4pgPgSqlException.java

示例2: translateUndefinedColumnException

import org.postgresql.util.ServerErrorMessage; //导入方法依赖的package包/类
/**
 * Package private for testability
 *
 * @param pSqlException PostgreSQL exception
 * @return translated validation exception
 */
static MolgenisValidationException translateUndefinedColumnException(PSQLException pSqlException)
{
	ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
	String message = serverErrorMessage.getMessage(); // FIXME exposes internal message
	ConstraintViolation constraintViolation = new ConstraintViolation(message);
	return new MolgenisValidationException(singleton(constraintViolation));
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:14,代码来源:PostgreSqlExceptionTranslator.java

示例3: translateInvalidIntegerException

import org.postgresql.util.ServerErrorMessage; //导入方法依赖的package包/类
/**
 * Package private for testability
 *
 * @param pSqlException PostgreSQL exception
 * @return translated validation exception
 */
static MolgenisValidationException translateInvalidIntegerException(PSQLException pSqlException)
{
	ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
	String message = serverErrorMessage.getMessage();
	Matcher matcher = Pattern.compile("invalid input syntax for \\b(?:type )?\\b(.+?): \"(.*?)\"").matcher(message);
	boolean matches = matcher.matches();
	if (!matches)
	{
		throw new RuntimeException("Error translating exception", pSqlException);
	}
	String postgreSqlType = matcher.group(1);

	// convert PostgreSQL data type to attribute type:
	String type;
	switch (postgreSqlType)
	{
		case "boolean":
			type = BOOL.toString();
			break;
		case "date":
			type = DATE.toString();
			break;
		case "timestamp with time zone":
			type = DATE_TIME.toString();
			break;
		case "double precision":
			type = DECIMAL.toString();
			break;
		case "integer":
			type = INT.toString() + " or " + LONG.toString();
			break;
		default:
			type = postgreSqlType;
			break;
	}
	String value = matcher.group(2);

	ConstraintViolation constraintViolation = new ConstraintViolation(
			format("Value [%s] of this entity attribute is not of type [%s].", value, type), null);
	return new MolgenisValidationException(singleton(constraintViolation));
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:48,代码来源:PostgreSqlExceptionTranslator.java


注:本文中的org.postgresql.util.ServerErrorMessage.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。