From 706a32e488be938eb8e5149abd09423d834ef5bc Mon Sep 17 00:00:00 2001 From: Markus Spann Date: Mon, 27 Nov 2023 14:46:39 +0100 Subject: [PATCH] net-sf-ucanaccess-fork: Move and expand sql constants --- .../net/ucanaccess/converters/DFunction.java | 2 +- .../net/ucanaccess/converters/Metadata.java | 2 +- .../ucanaccess/converters/Persist2Jet.java | 2 +- .../java/net/ucanaccess/converters/Pivot.java | 2 +- .../net/ucanaccess/converters/TypesMap.java | 2 +- .../jdbc/UcanaccessDatabaseMetadata.java | 2 +- .../jdbc/UcanaccessResultSetMetaData.java | 2 +- .../net/ucanaccess/type/SqlConstants.java | 73 +++++++++++++++++++ .../net/ucanaccess/util/SqlConstants.java | 39 ---------- .../net/ucanaccess/jdbc/AlterTableTest.java | 2 +- .../net/ucanaccess/jdbc/CreateTableTest.java | 2 +- .../java/net/ucanaccess/jdbc/Size97Test.java | 2 +- 12 files changed, 83 insertions(+), 49 deletions(-) create mode 100644 src/main/java/net/ucanaccess/type/SqlConstants.java delete mode 100644 src/main/java/net/ucanaccess/util/SqlConstants.java diff --git a/src/main/java/net/ucanaccess/converters/DFunction.java b/src/main/java/net/ucanaccess/converters/DFunction.java index 423f0ec4..edf9b477 100644 --- a/src/main/java/net/ucanaccess/converters/DFunction.java +++ b/src/main/java/net/ucanaccess/converters/DFunction.java @@ -1,6 +1,6 @@ package net.ucanaccess.converters; -import static net.ucanaccess.util.SqlConstants.COLUMN_NAME; +import static net.ucanaccess.type.SqlConstants.COLUMN_NAME; import net.ucanaccess.jdbc.UcanaccessConnection; import net.ucanaccess.util.Try; diff --git a/src/main/java/net/ucanaccess/converters/Metadata.java b/src/main/java/net/ucanaccess/converters/Metadata.java index ad4eeef1..b72d2b29 100644 --- a/src/main/java/net/ucanaccess/converters/Metadata.java +++ b/src/main/java/net/ucanaccess/converters/Metadata.java @@ -1,6 +1,6 @@ package net.ucanaccess.converters; -import static net.ucanaccess.util.SqlConstants.*; +import static net.ucanaccess.type.SqlConstants.*; import net.ucanaccess.type.AccessVersion; import net.ucanaccess.type.ColumnOrder; diff --git a/src/main/java/net/ucanaccess/converters/Persist2Jet.java b/src/main/java/net/ucanaccess/converters/Persist2Jet.java index c4208624..2049204f 100644 --- a/src/main/java/net/ucanaccess/converters/Persist2Jet.java +++ b/src/main/java/net/ucanaccess/converters/Persist2Jet.java @@ -1,6 +1,6 @@ package net.ucanaccess.converters; -import static net.ucanaccess.util.SqlConstants.*; +import static net.ucanaccess.type.SqlConstants.*; import com.healthmarketscience.jackcess.*; import com.healthmarketscience.jackcess.impl.DatabaseImpl; diff --git a/src/main/java/net/ucanaccess/converters/Pivot.java b/src/main/java/net/ucanaccess/converters/Pivot.java index 70deb808..f5bdc4ae 100644 --- a/src/main/java/net/ucanaccess/converters/Pivot.java +++ b/src/main/java/net/ucanaccess/converters/Pivot.java @@ -1,6 +1,6 @@ package net.ucanaccess.converters; -import static net.ucanaccess.util.SqlConstants.PIVOT; +import static net.ucanaccess.type.SqlConstants.PIVOT; import net.ucanaccess.jdbc.NormalizedSQL; import net.ucanaccess.jdbc.UcanaccessConnection; diff --git a/src/main/java/net/ucanaccess/converters/TypesMap.java b/src/main/java/net/ucanaccess/converters/TypesMap.java index ebcbdc10..61d36ac1 100644 --- a/src/main/java/net/ucanaccess/converters/TypesMap.java +++ b/src/main/java/net/ucanaccess/converters/TypesMap.java @@ -1,7 +1,7 @@ package net.ucanaccess.converters; import com.healthmarketscience.jackcess.DataType; -import net.ucanaccess.util.SqlConstants; +import net.ucanaccess.type.SqlConstants; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/net/ucanaccess/jdbc/UcanaccessDatabaseMetadata.java b/src/main/java/net/ucanaccess/jdbc/UcanaccessDatabaseMetadata.java index 53aa66f7..2ee19c9a 100644 --- a/src/main/java/net/ucanaccess/jdbc/UcanaccessDatabaseMetadata.java +++ b/src/main/java/net/ucanaccess/jdbc/UcanaccessDatabaseMetadata.java @@ -1,6 +1,6 @@ package net.ucanaccess.jdbc; -import static net.ucanaccess.util.SqlConstants.COLUMN_NAME; +import static net.ucanaccess.type.SqlConstants.COLUMN_NAME; import net.ucanaccess.converters.SQLConverter; import net.ucanaccess.jdbc.UcanaccessSQLException.ExceptionMessages; diff --git a/src/main/java/net/ucanaccess/jdbc/UcanaccessResultSetMetaData.java b/src/main/java/net/ucanaccess/jdbc/UcanaccessResultSetMetaData.java index 942a1ded..7ea0fed2 100644 --- a/src/main/java/net/ucanaccess/jdbc/UcanaccessResultSetMetaData.java +++ b/src/main/java/net/ucanaccess/jdbc/UcanaccessResultSetMetaData.java @@ -1,6 +1,6 @@ package net.ucanaccess.jdbc; -import static net.ucanaccess.util.SqlConstants.SYSTEM_SUBQUERY; +import static net.ucanaccess.type.SqlConstants.SYSTEM_SUBQUERY; import net.ucanaccess.converters.Metadata; import net.ucanaccess.converters.SQLConverter; diff --git a/src/main/java/net/ucanaccess/type/SqlConstants.java b/src/main/java/net/ucanaccess/type/SqlConstants.java new file mode 100644 index 00000000..9bdc1fe1 --- /dev/null +++ b/src/main/java/net/ucanaccess/type/SqlConstants.java @@ -0,0 +1,73 @@ +package net.ucanaccess.type; + +/** + * Constants for SQL reserved words and recurring tokens. + * + * @author Markus Spann + * @since v5.1.0 + */ +public final class SqlConstants { + + public static final String ALTER = "ALTER"; + public static final String AND = "AND"; + public static final String ASC_OR_DESC = "ASC_OR_DESC"; + public static final String COLUMN_NAME = "COLUMN_NAME"; + public static final String COLUMN_SIZE = "COLUMN_SIZE"; + public static final String COUNT_STAR = "COUNT(*)"; + public static final String CREATE = "CREATE"; + public static final String DATA_TYPE = "DATA_TYPE"; + public static final String DECIMAL_DIGITS = "DECIMAL_DIGITS"; + public static final String DELETE = "DELETE"; + public static final String DISTINCT = "DISTINCT"; + public static final String DROP = "DROP"; + public static final String ESCAPED_COLUMN_NAME = "ESCAPED_COLUMN_NAME"; + public static final String ESCAPED_TABLE_NAME = "ESCAPED_TABLE_NAME"; + public static final String EXISTS = "EXISTS"; + public static final String FKCOLUMN_NAME = "FKCOLUMN_NAME"; + public static final String FK_NAME = "FK_NAME"; + public static final String FROM = "FROM"; + public static final String GROUP_BY = "GROUP BY"; + public static final String HAVING = "HAVING"; + public static final String IF_NOT_EXISTS = "IF NOT EXISTS"; + public static final String INDEX_NAME = "INDEX_NAME"; + public static final String INSERT = "INSERT"; + public static final String INSERT_INTO = "INSERT INTO"; + public static final String INTEGER = "INTEGER"; + public static final String INTO = "INTO"; + public static final String IS_AUTOINCREMENT = "IS_AUTOINCREMENT"; + public static final String IS_CURRENCY = "IS_CURRENCY"; + public static final String IS_NOT_NULL = "IS NOT NULL"; + public static final String IS_NULL = "IS NULL"; + public static final String LIKE = "LIKE"; + public static final String LONGVARCHAR = "LONGVARCHAR"; + public static final String NON_UNIQUE = "NON_UNIQUE"; + public static final String ON = "ON"; + public static final String OR = "OR"; + public static final String ORDER_BY = "ORDER BY"; + public static final String ORDINAL_POSITION = "ORDINAL_POSITION"; + public static final String ORIGINAL_TYPE = "ORIGINAL_TYPE"; + public static final String PIVOT = "PIVOT"; + public static final String PKCOLUMN_NAME = "PKCOLUMN_NAME"; + public static final String PKTABLE_NAME = "PKTABLE_NAME"; + public static final String PUBLIC = "PUBLIC"; + public static final String SELECT = "SELECT"; + public static final String SELECT_COLUMN_ESCAPED = "SELECT_COLUMN_ESCAPED"; + public static final String SET = "SET"; + public static final String SMALLINT = "SMALLINT"; + public static final String SYSTEM_SUBQUERY = "SYSTEM_SUBQUERY"; + public static final String TABLE = "TABLE"; + public static final String TABLE_ID = "TABLE_ID"; + public static final String TABLE_NAME = "TABLE_NAME"; + public static final String TRUNCATE = "TRUNCATE"; + public static final String UNION = "UNION"; + public static final String UNION_ALL = "UNION ALL"; + public static final String UPDATE = "UPDATE"; + public static final String VALUES = "VALUES"; + public static final String VARCHAR = "VARCHAR"; + public static final String WHERE = "WHERE"; + public static final String WHERE_EXISTS = "WHERE EXISTS"; + + private SqlConstants() { + } + +} diff --git a/src/main/java/net/ucanaccess/util/SqlConstants.java b/src/main/java/net/ucanaccess/util/SqlConstants.java deleted file mode 100644 index 925db62d..00000000 --- a/src/main/java/net/ucanaccess/util/SqlConstants.java +++ /dev/null @@ -1,39 +0,0 @@ -package net.ucanaccess.util; - -/** - * Constants for SQL reserved words and recurring tokens. - */ -public final class SqlConstants { - - public static final String ASC_OR_DESC = "ASC_OR_DESC"; - public static final String COLUMN_NAME = "COLUMN_NAME"; - public static final String COLUMN_SIZE = "COLUMN_SIZE"; - public static final String DATA_TYPE = "DATA_TYPE"; - public static final String DECIMAL_DIGITS = "DECIMAL_DIGITS"; - public static final String ESCAPED_COLUMN_NAME = "ESCAPED_COLUMN_NAME"; - public static final String ESCAPED_TABLE_NAME = "ESCAPED_TABLE_NAME"; - public static final String FKCOLUMN_NAME = "FKCOLUMN_NAME"; - public static final String FK_NAME = "FK_NAME"; - public static final String INDEX_NAME = "INDEX_NAME"; - public static final String INTEGER = "INTEGER"; - public static final String IS_AUTOINCREMENT = "IS_AUTOINCREMENT"; - public static final String IS_CURRENCY = "IS_CURRENCY"; - public static final String LONGVARCHAR = "LONGVARCHAR"; - public static final String NON_UNIQUE = "NON_UNIQUE"; - public static final String ORDINAL_POSITION = "ORDINAL_POSITION"; - public static final String ORIGINAL_TYPE = "ORIGINAL_TYPE"; - public static final String PIVOT = "PIVOT"; - public static final String PKCOLUMN_NAME = "PKCOLUMN_NAME"; - public static final String PKTABLE_NAME = "PKTABLE_NAME"; - public static final String PUBLIC = "PUBLIC"; - public static final String SELECT_COLUMN_ESCAPED = "SELECT_COLUMN_ESCAPED"; - public static final String SMALLINT = "SMALLINT"; - public static final String SYSTEM_SUBQUERY = "SYSTEM_SUBQUERY"; - public static final String TABLE_ID = "TABLE_ID"; - public static final String TABLE_NAME = "TABLE_NAME"; - public static final String VARCHAR = "VARCHAR"; - - private SqlConstants() { - } - -} diff --git a/src/test/java/net/ucanaccess/jdbc/AlterTableTest.java b/src/test/java/net/ucanaccess/jdbc/AlterTableTest.java index 992e2cc8..434cc1d1 100644 --- a/src/test/java/net/ucanaccess/jdbc/AlterTableTest.java +++ b/src/test/java/net/ucanaccess/jdbc/AlterTableTest.java @@ -1,6 +1,6 @@ package net.ucanaccess.jdbc; -import static net.ucanaccess.util.SqlConstants.ORIGINAL_TYPE; +import static net.ucanaccess.type.SqlConstants.ORIGINAL_TYPE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/src/test/java/net/ucanaccess/jdbc/CreateTableTest.java b/src/test/java/net/ucanaccess/jdbc/CreateTableTest.java index 4ff85472..618b3030 100644 --- a/src/test/java/net/ucanaccess/jdbc/CreateTableTest.java +++ b/src/test/java/net/ucanaccess/jdbc/CreateTableTest.java @@ -1,6 +1,6 @@ package net.ucanaccess.jdbc; -import static net.ucanaccess.util.SqlConstants.ORIGINAL_TYPE; +import static net.ucanaccess.type.SqlConstants.ORIGINAL_TYPE; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; diff --git a/src/test/java/net/ucanaccess/jdbc/Size97Test.java b/src/test/java/net/ucanaccess/jdbc/Size97Test.java index b06fbab1..8279ea64 100644 --- a/src/test/java/net/ucanaccess/jdbc/Size97Test.java +++ b/src/test/java/net/ucanaccess/jdbc/Size97Test.java @@ -1,6 +1,6 @@ package net.ucanaccess.jdbc; -import static net.ucanaccess.util.SqlConstants.COLUMN_SIZE; +import static net.ucanaccess.type.SqlConstants.COLUMN_SIZE; import net.ucanaccess.test.UcanaccessBaseTest; import net.ucanaccess.type.AccessVersion;