提交 5aa56d98 authored 作者: Noel Grandin's avatar Noel Grandin

readIfNoExists->readIfNotExists

上级 a6ec7f8f
...@@ -16,7 +16,6 @@ import java.util.ArrayList; ...@@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.api.Trigger; import org.h2.api.Trigger;
import org.h2.command.ddl.AlterIndexRename; import org.h2.command.ddl.AlterIndexRename;
...@@ -4248,7 +4247,7 @@ public class Parser { ...@@ -4248,7 +4247,7 @@ public class Parser {
} }
primaryKey = true; primaryKey = true;
if (!isToken("ON")) { if (!isToken("ON")) {
ifNotExists = readIfNoExists(); ifNotExists = readIfNotExists();
indexName = readIdentifierWithSchema(null); indexName = readIdentifierWithSchema(null);
oldSchema = getSchema(); oldSchema = getSchema();
} }
...@@ -4264,7 +4263,7 @@ public class Parser { ...@@ -4264,7 +4263,7 @@ public class Parser {
} }
if (readIf("INDEX")) { if (readIf("INDEX")) {
if (!isToken("ON")) { if (!isToken("ON")) {
ifNotExists = readIfNoExists(); ifNotExists = readIfNotExists();
indexName = readIdentifierWithSchema(null); indexName = readIdentifierWithSchema(null);
oldSchema = getSchema(); oldSchema = getSchema();
} }
...@@ -4480,14 +4479,14 @@ public class Parser { ...@@ -4480,14 +4479,14 @@ public class Parser {
private CreateRole parseCreateRole() { private CreateRole parseCreateRole() {
CreateRole command = new CreateRole(session); CreateRole command = new CreateRole(session);
command.setIfNotExists(readIfNoExists()); command.setIfNotExists(readIfNotExists());
command.setRoleName(readUniqueIdentifier()); command.setRoleName(readUniqueIdentifier());
return command; return command;
} }
private CreateSchema parseCreateSchema() { private CreateSchema parseCreateSchema() {
CreateSchema command = new CreateSchema(session); CreateSchema command = new CreateSchema(session);
command.setIfNotExists(readIfNoExists()); command.setIfNotExists(readIfNotExists());
command.setSchemaName(readUniqueIdentifier()); command.setSchemaName(readUniqueIdentifier());
if (readIf("AUTHORIZATION")) { if (readIf("AUTHORIZATION")) {
command.setAuthorization(readUniqueIdentifier()); command.setAuthorization(readUniqueIdentifier());
...@@ -4498,7 +4497,7 @@ public class Parser { ...@@ -4498,7 +4497,7 @@ public class Parser {
} }
private CreateSequence parseCreateSequence() { private CreateSequence parseCreateSequence() {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String sequenceName = readIdentifierWithSchema(); String sequenceName = readIdentifierWithSchema();
CreateSequence command = new CreateSequence(session, getSchema()); CreateSequence command = new CreateSequence(session, getSchema());
command.setIfNotExists(ifNotExists); command.setIfNotExists(ifNotExists);
...@@ -4547,7 +4546,7 @@ public class Parser { ...@@ -4547,7 +4546,7 @@ public class Parser {
return command; return command;
} }
private boolean readIfNoExists() { private boolean readIfNotExists() {
if (readIf("IF")) { if (readIf("IF")) {
read("NOT"); read("NOT");
read("EXISTS"); read("EXISTS");
...@@ -4557,7 +4556,7 @@ public class Parser { ...@@ -4557,7 +4556,7 @@ public class Parser {
} }
private CreateConstant parseCreateConstant() { private CreateConstant parseCreateConstant() {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String constantName = readIdentifierWithSchema(); String constantName = readIdentifierWithSchema();
Schema schema = getSchema(); Schema schema = getSchema();
if (isKeyword(constantName)) { if (isKeyword(constantName)) {
...@@ -4574,7 +4573,7 @@ public class Parser { ...@@ -4574,7 +4573,7 @@ public class Parser {
} }
private CreateAggregate parseCreateAggregate(boolean force) { private CreateAggregate parseCreateAggregate(boolean force) {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
CreateAggregate command = new CreateAggregate(session); CreateAggregate command = new CreateAggregate(session);
command.setForce(force); command.setForce(force);
String name = readIdentifierWithSchema(); String name = readIdentifierWithSchema();
...@@ -4592,7 +4591,7 @@ public class Parser { ...@@ -4592,7 +4591,7 @@ public class Parser {
} }
private CreateUserDataType parseCreateUserDataType() { private CreateUserDataType parseCreateUserDataType() {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
CreateUserDataType command = new CreateUserDataType(session); CreateUserDataType command = new CreateUserDataType(session);
command.setTypeName(readUniqueIdentifier()); command.setTypeName(readUniqueIdentifier());
read("AS"); read("AS");
...@@ -4608,7 +4607,7 @@ public class Parser { ...@@ -4608,7 +4607,7 @@ public class Parser {
} }
private CreateTrigger parseCreateTrigger(boolean force) { private CreateTrigger parseCreateTrigger(boolean force) {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String triggerName = readIdentifierWithSchema(null); String triggerName = readIdentifierWithSchema(null);
Schema schema = getSchema(); Schema schema = getSchema();
boolean insteadOf, isBefore; boolean insteadOf, isBefore;
...@@ -4675,7 +4674,7 @@ public class Parser { ...@@ -4675,7 +4674,7 @@ public class Parser {
private CreateUser parseCreateUser() { private CreateUser parseCreateUser() {
CreateUser command = new CreateUser(session); CreateUser command = new CreateUser(session);
command.setIfNotExists(readIfNoExists()); command.setIfNotExists(readIfNotExists());
command.setUserName(readUniqueIdentifier()); command.setUserName(readUniqueIdentifier());
command.setComment(readCommentIf()); command.setComment(readCommentIf());
if (readIf("PASSWORD")) { if (readIf("PASSWORD")) {
...@@ -4699,7 +4698,7 @@ public class Parser { ...@@ -4699,7 +4698,7 @@ public class Parser {
} }
private CreateFunctionAlias parseCreateFunctionAlias(boolean force) { private CreateFunctionAlias parseCreateFunctionAlias(boolean force) {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String aliasName = readIdentifierWithSchema(); String aliasName = readIdentifierWithSchema();
if (isKeyword(aliasName) || if (isKeyword(aliasName) ||
Function.getFunction(database, aliasName) != null || Function.getFunction(database, aliasName) != null ||
...@@ -4787,7 +4786,7 @@ public class Parser { ...@@ -4787,7 +4786,7 @@ public class Parser {
} }
private CreateView parseCreateView(boolean force, boolean orReplace) { private CreateView parseCreateView(boolean force, boolean orReplace) {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String viewName = readIdentifierWithSchema(); String viewName = readIdentifierWithSchema();
CreateView command = new CreateView(session, getSchema()); CreateView command = new CreateView(session, getSchema());
this.createView = command; this.createView = command;
...@@ -5717,7 +5716,7 @@ public class Parser { ...@@ -5717,7 +5716,7 @@ public class Parser {
read(")"); read(")");
command.setNewColumns(columnsToAdd); command.setNewColumns(columnsToAdd);
} else { } else {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
command.setIfNotExists(ifNotExists); command.setIfNotExists(ifNotExists);
String columnName = readColumnIdentifier(); String columnName = readColumnIdentifier();
Column column = parseColumnForTable(columnName, true); Column column = parseColumnForTable(columnName, true);
...@@ -5765,7 +5764,7 @@ public class Parser { ...@@ -5765,7 +5764,7 @@ public class Parser {
boolean ifNotExists = false; boolean ifNotExists = false;
boolean allowIndexDefinition = database.getMode().indexDefinitionInCreateTable; boolean allowIndexDefinition = database.getMode().indexDefinitionInCreateTable;
if (readIf("CONSTRAINT")) { if (readIf("CONSTRAINT")) {
ifNotExists = readIfNoExists(); ifNotExists = readIfNotExists();
constraintName = readIdentifierWithSchema(schema.getName()); constraintName = readIdentifierWithSchema(schema.getName());
checkSchema(schema); checkSchema(schema);
comment = readCommentIf(); comment = readCommentIf();
...@@ -5904,7 +5903,7 @@ public class Parser { ...@@ -5904,7 +5903,7 @@ public class Parser {
private CreateLinkedTable parseCreateLinkedTable(boolean temp, private CreateLinkedTable parseCreateLinkedTable(boolean temp,
boolean globalTemp, boolean force) { boolean globalTemp, boolean force) {
read("TABLE"); read("TABLE");
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String tableName = readIdentifierWithSchema(); String tableName = readIdentifierWithSchema();
CreateLinkedTable command = new CreateLinkedTable(session, getSchema()); CreateLinkedTable command = new CreateLinkedTable(session, getSchema());
command.setTemporary(temp); command.setTemporary(temp);
...@@ -5940,7 +5939,7 @@ public class Parser { ...@@ -5940,7 +5939,7 @@ public class Parser {
private CreateTable parseCreateTable(boolean temp, boolean globalTemp, private CreateTable parseCreateTable(boolean temp, boolean globalTemp,
boolean persistIndexes) { boolean persistIndexes) {
boolean ifNotExists = readIfNoExists(); boolean ifNotExists = readIfNotExists();
String tableName = readIdentifierWithSchema(); String tableName = readIdentifierWithSchema();
if (temp && globalTemp && equalsToken("SESSION", schemaName)) { if (temp && globalTemp && equalsToken("SESSION", schemaName)) {
// support weird syntax: declare global temporary table session.xy // support weird syntax: declare global temporary table session.xy
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论