本文整理汇总了Java中org.h2.message.DbException.getSyntaxError方法的典型用法代码示例。如果您正苦于以下问题:Java DbException.getSyntaxError方法的具体用法?Java DbException.getSyntaxError怎么用?Java DbException.getSyntaxError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.h2.message.DbException
的用法示例。
在下文中一共展示了DbException.getSyntaxError方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readInt
import org.h2.message.DbException; //导入方法依赖的package包/类
private int readInt() {
boolean minus = false;
if (currentTokenType == MINUS) {
minus = true;
read();
} else if (currentTokenType == PLUS) {
read();
}
if (currentTokenType != VALUE) {
throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");
}
if (minus) {
// must do that now, otherwise Integer.MIN_VALUE would not work
currentValue = currentValue.negate();
}
int i = currentValue.getInt();
read();
return i;
}
示例2: readLong
import org.h2.message.DbException; //导入方法依赖的package包/类
private long readLong() {
boolean minus = false;
if (currentTokenType == MINUS) {
minus = true;
read();
} else if (currentTokenType == PLUS) {
read();
}
if (currentTokenType != VALUE) {
throw DbException.getSyntaxError(sqlCommand, parseIndex, "long");
}
if (minus) {
// must do that now, otherwise Long.MIN_VALUE would not work
currentValue = currentValue.negate();
}
long i = currentValue.getLong();
read();
return i;
}
示例3: compileViewQuery
import org.h2.message.DbException; //导入方法依赖的package包/类
private static Query compileViewQuery(Session session, String sql) {
Prepared p = session.prepare(sql);
if (!(p instanceof Query)) {
throw DbException.getSyntaxError(sql, 0);
}
return (Query) p;
}
示例4: getSyntaxError
import org.h2.message.DbException; //导入方法依赖的package包/类
private DbException getSyntaxError() {
if (expectedList == null || expectedList.size() == 0) {
return DbException.getSyntaxError(sqlCommand, parseIndex);
}
StatementBuilder buff = new StatementBuilder();
for (String e : expectedList) {
buff.appendExceptFirst(", ");
buff.append(e);
}
return DbException.getSyntaxError(sqlCommand, parseIndex,
buff.toString());
}
示例5: readString
import org.h2.message.DbException; //导入方法依赖的package包/类
private String readString() {
Expression expr = readExpression().optimize(session);
if (!(expr instanceof ValueExpression)) {
throw DbException.getSyntaxError(sqlCommand, parseIndex, "string");
}
String s = expr.getValue(session).getString();
return s;
}
示例6: readIdentifierWithSchema
import org.h2.message.DbException; //导入方法依赖的package包/类
private String readIdentifierWithSchema(String defaultSchemaName) {
if (currentTokenType != IDENTIFIER) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"identifier");
}
String s = currentToken;
read();
schemaName = defaultSchemaName;
if (readIf(".")) {
schemaName = s;
if (currentTokenType != IDENTIFIER) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"identifier");
}
s = currentToken;
read();
}
if (equalsToken(".", currentToken)) {
if (equalsToken(schemaName, database.getShortName())) {
read(".");
schemaName = s;
if (currentTokenType != IDENTIFIER) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"identifier");
}
s = currentToken;
read();
}
}
return s;
}
示例7: readColumnIdentifier
import org.h2.message.DbException; //导入方法依赖的package包/类
private String readColumnIdentifier() {
if (currentTokenType != IDENTIFIER) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"identifier");
}
String s = currentToken;
read();
return s;
}
示例8: checkRunOver
import org.h2.message.DbException; //导入方法依赖的package包/类
private static void checkRunOver(int i, int len, String sql) {
if (i >= len) {
throw DbException.getSyntaxError(sql, i);
}
}
示例9: parseComment
import org.h2.message.DbException; //导入方法依赖的package包/类
private Prepared parseComment() {
int type = 0;
read("ON");
boolean column = false;
if (readIf("TABLE") || readIf("VIEW")) {
type = DbObject.TABLE_OR_VIEW;
} else if (readIf("COLUMN")) {
column = true;
type = DbObject.TABLE_OR_VIEW;
} else if (readIf("CONSTANT")) {
type = DbObject.CONSTANT;
} else if (readIf("CONSTRAINT")) {
type = DbObject.CONSTRAINT;
} else if (readIf("ALIAS")) {
type = DbObject.FUNCTION_ALIAS;
} else if (readIf("INDEX")) {
type = DbObject.INDEX;
} else if (readIf("ROLE")) {
type = DbObject.ROLE;
} else if (readIf("SCHEMA")) {
type = DbObject.SCHEMA;
} else if (readIf("SEQUENCE")) {
type = DbObject.SEQUENCE;
} else if (readIf("TRIGGER")) {
type = DbObject.TRIGGER;
} else if (readIf("USER")) {
type = DbObject.USER;
} else if (readIf("DOMAIN")) {
type = DbObject.USER_DATATYPE;
} else {
throw getSyntaxError();
}
SetComment command = new SetComment(session);
String objectName;
if (column) {
// can't use readIdentifierWithSchema() because
// it would not read schema.table.column correctly
// if the db name is equal to the schema name
ArrayList<String> list = New.arrayList();
do {
list.add(readUniqueIdentifier());
} while (readIf("."));
schemaName = session.getCurrentSchemaName();
if (list.size() == 4) {
if (!equalsToken(database.getShortName(), list.get(0))) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"database name");
}
list.remove(0);
}
if (list.size() == 3) {
schemaName = list.get(0);
list.remove(0);
}
if (list.size() != 2) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"table.column");
}
objectName = list.get(0);
command.setColumn(true);
command.setColumnName(list.get(1));
} else {
objectName = readIdentifierWithSchema();
}
command.setSchemaName(schemaName);
command.setObjectName(objectName);
command.setObjectType(type);
read("IS");
command.setCommentExpression(readExpression());
return command;
}