http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/ModificationFactory.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/ModificationFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/ModificationFactory.java new file mode 100644 index 0000000..cd71993 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/ModificationFactory.java @@ -0,0 +1,148 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.factories; + +import org.apache.polygene.library.sql.generator.grammar.builders.modification.ColumnSourceByValuesBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.modification.DeleteBySearchBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.modification.InsertStatementBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.modification.UpdateBySearchBuilder; +import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList; +import org.apache.polygene.library.sql.generator.grammar.common.TableName; +import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect; +import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression; +import org.apache.polygene.library.sql.generator.grammar.modification.ColumnSourceByQuery; +import org.apache.polygene.library.sql.generator.grammar.modification.ColumnSourceByValues; +import org.apache.polygene.library.sql.generator.grammar.modification.DeleteBySearch; +import org.apache.polygene.library.sql.generator.grammar.modification.InsertStatement; +import org.apache.polygene.library.sql.generator.grammar.modification.SetClause; +import org.apache.polygene.library.sql.generator.grammar.modification.TargetTable; +import org.apache.polygene.library.sql.generator.grammar.modification.UpdateBySearch; +import org.apache.polygene.library.sql.generator.grammar.modification.UpdateSource; +import org.apache.polygene.library.sql.generator.grammar.modification.UpdateSourceByExpression; +import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression; +import org.apache.polygene.library.sql.generator.vendor.SQLVendor; + +/** + * A factory, which creates SQL syntax elements related to modification statements ({@code INSERT INTO}, + * {@code DELETE FROM}, and {@code UPDATE}). This factory is obtainable from {@link SQLVendor}. + * + * @author Stanislav Muhametsin + * @see SQLVendor + */ +public interface ModificationFactory +{ + + /** + * Creates a builder to add values as column sources in {@code INSERT INTO} statement. + * + * @return The new {@link ColumnSourceByValuesBuilder} for {@link ColumnSourceByValues}. + */ + ColumnSourceByValuesBuilder columnSourceByValues(); + + /** + * <p> + * Creates a column source, which uses a query as a source for columns in {@code INSERT INTO} statement. + * </p> + * <p> + * Calling this method is equivalent in calling {@link #columnSourceByQuery(ColumnNameList, QueryExpression)} and + * passing {@code null} as first argument. + * </p> + * + * @param query The query to use as source for columns in {@code INSERT INTO} statement. + * @return The new {@link ColumnSourceByQuery}. + */ + ColumnSourceByQuery columnSourceByQuery( QueryExpression query ); + + /** + * Creates a column source, which uses specified target table column names and query as source columns in + * {@code INSERT INTO} statement. + * + * @param columnNames The column names to use in target table. + * @param query The query to use to populate target table. + * @return The new {@link ColumnSourceByQuery}. + */ + ColumnSourceByQuery columnSourceByQuery( ColumnNameList columnNames, QueryExpression query ); + + /** + * Creates builder to create {@link DeleteBySearch} statements. + * + * @return The new builder for {@link DeleteBySearch}. + * @see DeleteBySearchBuilder + */ + DeleteBySearchBuilder deleteBySearch(); + + /** + * Creates builder to create {@link InsertStatement}s. + * + * @return The new builder for {@link InsertStatement}. + * @see InsertStatementBuilder + */ + InsertStatementBuilder insert(); + + /** + * Creates builder to create {@link UpdateBySearch} statements. + * + * @return The new builder for {@link UpdateBySearch} statements. + * @see UpdateBySearchBuilder + */ + UpdateBySearchBuilder updateBySearch(); + + /** + * <p> + * Creates new target table to use in modification statements. + * </p> + * <p> + * Calling this method is equivalent for calling {@link #createTargetTable(TableName, Boolean)} and passing + * {@code false} as second parameter. + * + * @param tableName The name of the table. + * @return The new {@link TargetTable}. + */ + TargetTable createTargetTable( TableNameDirect tableName ); + + /** + * Creates new target table to use in modification statements. + * + * @param tableName The name of the table. + * @param isOnly Whether modification should affect child-tables too. + * @return The new {@link TargetTable}. + */ + TargetTable createTargetTable( TableNameDirect tableName, Boolean isOnly ); + + /** + * Creates a new source for {@code UPDATE} statement. This source will use specified expression as a source for + * values. + * + * @param expression The expression to use. + * @return The new {@link UpdateSourceByExpression}. + * @see UpdateBySearch + */ + UpdateSourceByExpression updateSourceByExp( ValueExpression expression ); + + /** + * Creates a new set clause for {@code UPDATE} statement. + * + * @param updateTarget The target of the update, typically name of the column. + * @param updateSource The source for data to be put into that column. + * @return The new {@link SetClause}. + * @see UpdateBySearch + */ + SetClause setClause( String updateTarget, UpdateSource updateSource ); +}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/QueryFactory.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/QueryFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/QueryFactory.java new file mode 100644 index 0000000..8872251 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/QueryFactory.java @@ -0,0 +1,227 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.factories; + +import org.apache.polygene.library.sql.generator.grammar.builders.query.ColumnsBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.FromBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.GroupByBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.OrderByBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.QueryBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.QuerySpecificationBuilder; +import org.apache.polygene.library.sql.generator.grammar.builders.query.SimpleQueryBuilder; +import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression; +import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier; +import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression; +import org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral; +import org.apache.polygene.library.sql.generator.grammar.query.GroupByClause; +import org.apache.polygene.library.sql.generator.grammar.query.LimitSpecification; +import org.apache.polygene.library.sql.generator.grammar.query.OffsetSpecification; +import org.apache.polygene.library.sql.generator.grammar.query.Ordering; +import org.apache.polygene.library.sql.generator.grammar.query.OrdinaryGroupingSet; +import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression; +import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody; +import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody.EmptyQueryExpressionBody; +import org.apache.polygene.library.sql.generator.grammar.query.QuerySpecification; +import org.apache.polygene.library.sql.generator.grammar.query.RowDefinition; +import org.apache.polygene.library.sql.generator.grammar.query.RowSubQuery; +import org.apache.polygene.library.sql.generator.grammar.query.RowValueConstructor; +import org.apache.polygene.library.sql.generator.grammar.query.SortSpecification; +import org.apache.polygene.library.sql.generator.grammar.query.TableValueConstructor; +import org.apache.polygene.library.sql.generator.vendor.SQLVendor; + +/** + * A factory, which creates builders and syntax elements for SQL queries ({@code SELECT} statements). This factory may + * be obtained from {@link SQLVendor}. + * + * @author Stanislav Muhametsin + * @see SQLVendor + * @see QueryExpression + * @see QuerySpecification + */ +public interface QueryFactory +{ + + /** + * Creates new query, which has the specified body as an actual query. + * + * @param body The actual query to use. + * @return The new {@link QueryExpression} + */ + QueryExpression createQuery( QueryExpressionBody body ); + + /** + * Creates a builder to build query specifications ({@code SELECT} expressions). + * + * @return The new {@link QuerySpecificationBuilder}. + */ + QuerySpecificationBuilder querySpecificationBuilder(); + + /** + * <p> + * Creates a builder for the columns in {@code SELECT} expressions. + * </p> + * <p> + * Calling this method is equivalent to calling {@link #columnsBuilder(SetQuantifier)} and passing + * {@link SetQuantifier#ALL} as argument. + * </p> + * + * @return The new {@link ColumnsBuilder}. + */ + ColumnsBuilder columnsBuilder(); + + /** + * Creates a builder for columns in {@code SELECT} expressions, which has specified set quantifier initially. + * + * @param setQuantifier The set quantifier to use. + * @return The new {@link ColumnsBuilder}. + */ + ColumnsBuilder columnsBuilder( SetQuantifier setQuantifier ); + + /** + * <p> + * Creates a builder to build queries with capability for {@code UNION}, {@code INTERSECT}, and {@code EXCEPT} set + * operations. + * </p> + * <p> + * Calling this method is equivalent in calling {@link #queryBuilder(QueryExpressionBody)} and passing + * {@link EmptyQueryExpressionBody} as argument. + * + * @return The new {@link QueryBuilder}. + */ + QueryBuilder queryBuilder(); + + /** + * Creates a builder to build queries with capability for {@code UNION}, {@code INTERSECT}, and {@code EXCEPT} set + * operations. + * + * @param query The initial query for builder. + * @return The new {@link QueryBuilder}. + */ + QueryBuilder queryBuilder( QueryExpressionBody query ); + + /** + * Creates a builder for {@code GROUP BY} clause. + * + * @return The new {@link GroupByBuilder}. + */ + GroupByBuilder groupByBuilder(); + + /** + * Creates a builder for {@code FROM} clause. + * + * @return The new {@link FromBuilder}. + */ + FromBuilder fromBuilder(); + + /** + * Creates a new grouping element, which has some expressions as grouping columns. + * + * @param expressions The expressions to use. + * @return The new {@link OrdinaryGroupingSet}. + * @see GroupByClause + */ + OrdinaryGroupingSet groupingElement( NonBooleanExpression... expressions ); + + /** + * Creates a new sort specification for {@code ORDER BY} clause. + * + * @param expression The expression for column. + * @param ordering The ordering to use. + * @return The new {@link SortSpecification}. + */ + SortSpecification sortSpec( ValueExpression expression, Ordering ordering ); + + /** + * Creates a builder for {@code ORDER BY} clause. + * + * @return The new {@link OrderByBuilder}. + */ + OrderByBuilder orderByBuilder(); + + /** + * Creates a builder for simple queries. + * + * @return The new {@link SimpleQueryBuilder}. + */ + SimpleQueryBuilder simpleQueryBuilder(); + + /** + * Creates a new {@code VALUES} expression in query. + * + * @param rows The rows for {@code VALUES} expression. + * @return The new {@link TableValueConstructor}. + * @see RowValueConstructor + * @see RowSubQuery + * @see RowDefinition + */ + TableValueConstructor values( RowValueConstructor... rows ); + + /** + * Creates a new subquery for a row for {@code VALUES} expression in query. + * + * @param subQuery The query to return the row. + * @return The new {@link RowSubQuery}. + */ + RowSubQuery rowSubQuery( QueryExpression subQuery ); + + /** + * Creates a new row for {@code VALUES} expression in query. + * + * @param elements The elements for the row. + * @return The new {@link RowDefinition}. + */ + RowDefinition row( ValueExpression... elements ); + + /** + * Returns a query for calling a SQL function with schema. The query is + * {@code SELECT * FROM schemaName.functionName(params...)}. + * + * @param schemaName The name of the schema where SQL function resides. + * @param function The SQL function to call. + * @return A query returning the results of calling SQL function. + */ + QueryExpression callFunction( String schemaName, SQLFunctionLiteral function ); + + /** + * Returns a query for calling a SQL function without a schema. The query is + * {@code SELECT * FROM functionName(params...)}. Calling this method is equivalent to calling + * {@link #callFunction(String, SQLFunctionLiteral)} and passing {@code null} as first argument. + * + * @param function The function to call. + * @return A query returning the results of calling SQL function. + */ + QueryExpression callFunction( SQLFunctionLiteral function ); + + /** + * Creates a new {@code OFFSET <n> ROWS} syntax element for query. + * + * @param offset The offset amount. + * @return A new {@code OFFSET <n> ROWS} syntax element. + */ + OffsetSpecification offset( NonBooleanExpression offset ); + + /** + * Creates a new {@code FETCH FIRST <n> ROWS ONLY} syntax element for query. + * + * @param count The limit amount. + * @return A new {@code FETCH FIRST <n> ROWS ONLY} syntax element. + */ + LimitSpecification limit( NonBooleanExpression count ); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/TableReferenceFactory.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/TableReferenceFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/TableReferenceFactory.java new file mode 100644 index 0000000..252f807 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/TableReferenceFactory.java @@ -0,0 +1,182 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.factories; + +import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression; +import org.apache.polygene.library.sql.generator.grammar.builders.query.TableReferenceBuilder; +import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList; +import org.apache.polygene.library.sql.generator.grammar.common.TableName; +import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect; +import org.apache.polygene.library.sql.generator.grammar.common.TableNameFunction; +import org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral; +import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression; +import org.apache.polygene.library.sql.generator.grammar.query.TableAlias; +import org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByExpression; +import org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByName; +import org.apache.polygene.library.sql.generator.grammar.query.TableReferencePrimary; +import org.apache.polygene.library.sql.generator.grammar.query.joins.JoinCondition; +import org.apache.polygene.library.sql.generator.grammar.query.joins.NamedColumnsJoin; +import org.apache.polygene.library.sql.generator.vendor.SQLVendor; + +/** + * A factory for creating builders and syntax elements related to tables. This factory is obtainable from + * {@link SQLVendor}. + * + * @author Stanislav Muhametsin + * @see SQLVendor + */ +public interface TableReferenceFactory +{ + /** + * <p> + * Creates a new table reference, which uses given table name, without table alias. + * </p> + * <p> + * Calling this method is equivalent to calling {@link #table(TableName, TableAlias)} and passing {@code null} as + * second parameter. + * </p> + * + * @param tableName The table name to use. + * @return The new {@link TableReferenceByName}. + */ + TableReferenceByName table( TableName tableName ); + + /** + * Creates a new table references, which uses given table name along with given table alias. + * + * @param tableName The table name to use. + * @param alias The table alias to use. May be {@code null}. + * @return The new {@link TableReferenceByName}. + */ + TableReferenceByName table( TableName tableName, TableAlias alias ); + + /** + * <p> + * Creates a new table name, which isn't schema-qualified. + * </p> + * <p> + * Calling this method is equivalent to calling {@link #tableName(String, String)} and passing {@code null} as first + * parameter. + * </p> + * + * @param tableName The name of the table. + * @return The new {@link TableName}. + */ + TableNameDirect tableName( String tableName ); + + /** + * Creates a new table name. If the given schema-name is non-{@code null}, the table name is said to be + * schema-qualified. + * + * @param schemaName The schema name to use. May be {@code null}. + * @param tableName The table name to use. + * @return The new {@link TableName}. + */ + TableNameDirect tableName( String schemaName, String tableName ); + + /** + * Creates a new table name representing a call to SQL function without a schema. This is equivalent to calling + * {@link #tableName(String, SQLFunctionLiteral)} and passing {@code null} as first argument. + * + * @param function The function to call. + * @return Table name representing a call to SQL function without a schema. + */ + TableNameFunction tableName( SQLFunctionLiteral function ); + + /** + * Creates a new table name representing a call to SQL function with schema. + * + * @param schemaName The schema where function resides. + * @param function The function to call. + * @return Table name representing a call to SQL function with schema. + */ + TableNameFunction tableName( String schemaName, SQLFunctionLiteral function ); + + /** + * <p> + * Creates a new alias for table. + * </p> + * <p> + * Calling this method is equivalent to calling {@link #tableAliasWithCols(String, String...)} and not pass anything + * to varargs parameter. + * </p> + * + * @param tableNameAlias The alias for table name. + * @return The new {@link TableAlias}. + */ + TableAlias tableAlias( String tableNameAlias ); + + /** + * Creates a new table alias for table, with renamed columns. + * + * @param tableNameAlias The alias for table name. + * @param colNames The new column names for table. + * @return The new {@link TableAlias}. + */ + TableAlias tableAliasWithCols( String tableNameAlias, String... colNames ); + + /** + * <p> + * Creates a new table reference, which will use the values returned by query as if they were values of the table. + * </p> + * <p> + * Calling this method is equivalent to calling {@link #table(QueryExpression, TableAlias)} and passing {@code null} + * as second parameter. + * </p> + * + * @param query The query to use. + * @return The new {@link TableReferenceByExpression}. + */ + TableReferenceByExpression table( QueryExpression query ); + + /** + * Creates a new table reference, which will use the values returned by query as if they were values of the table. + * Optionally, the table will has a given alias. + * + * @param query The query to use. + * @param alias The table alias to use. May be {@code null} if no alias is needed. + * @return The new {@link TableReferenceByExpression}. + */ + TableReferenceByExpression table( QueryExpression query, TableAlias alias ); + + /** + * Creates a new {@link TableReferenceBuilder} typically used to build joined tables. + * + * @param firstTable The starting table. + * @return The new {@link TableReferenceBuilder}. + */ + TableReferenceBuilder tableBuilder( TableReferencePrimary firstTable ); + + /** + * Creates a join-condition using specified boolean expression to join tables. + * + * @param condition The condition to join tables. + * @return The new {@link JoinCondition}. + */ + JoinCondition jc( BooleanExpression condition ); + + /** + * Creates a new named columns join specification, which will use column names to join tables. + * + * @param columnNames The column names to use to join tables. + * @return The new {@link NamedColumnsJoin}. + */ + NamedColumnsJoin nc( ColumnNameList columnNames ); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/package-info.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/package-info.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/package-info.java new file mode 100644 index 0000000..81a4977 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/package-info.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +/** + * This package provides factories to create various builders and SQL syntax elements. + */ +package org.apache.polygene.library.sql.generator.grammar.factories; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLDataTypeFactory.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLDataTypeFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLDataTypeFactory.java new file mode 100644 index 0000000..729173c --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLDataTypeFactory.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.factories.pgsql; + +import org.apache.polygene.library.sql.generator.grammar.common.datatypes.pgsql.Text; +import org.apache.polygene.library.sql.generator.grammar.factories.DataTypeFactory; + +/** + * This is factory for creating SQL pre-defined types, as well as types specific for PostgreSQL. + * + * @author Stanislav Muhametsin + */ +public interface PgSQLDataTypeFactory + extends DataTypeFactory +{ + + /** + * Creates the data type representing {@code TEXT} data type. + * + * @return The data type representing {@code TEXT} data type. + */ + Text text(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLManipulationFactory.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLManipulationFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLManipulationFactory.java new file mode 100644 index 0000000..64acf71 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/PgSQLManipulationFactory.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.factories.pgsql; + +import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect; +import org.apache.polygene.library.sql.generator.grammar.factories.ManipulationFactory; +import org.apache.polygene.library.sql.generator.grammar.manipulation.DropBehaviour; +import org.apache.polygene.library.sql.generator.grammar.manipulation.ObjectType; +import org.apache.polygene.library.sql.generator.grammar.manipulation.pgsql.PgSQLDropTableOrViewStatement; + +/** + * @author Stanislav Muhametsin + */ +public interface PgSQLManipulationFactory + extends ManipulationFactory +{ + + PgSQLDropTableOrViewStatement createDropTableOrViewStatement( TableNameDirect tableName, ObjectType theType, + DropBehaviour dropBehaviour ); + + /** + * Creates {@code DROP TABLE/VIEW} statement, which may use {@code IF EXISTS} clause before the table name. + * + * @param tableName The name of the table/view to drop. + * @param theType What to drop - {@link ObjectType#TABLE} or {@link ObjectType#VIEW}. + * @param dropBehaviour Drop behaviour - {@link DropBehaviour#CASCADE} or {@link DropBehaviour#RESTRICT}. + * @param useIfExists {@code true} to append {@code IF EXISTS} before table/view name, {@code false} otherwise. + * @return New {@code DROP TABLE/VIEW} statement. + */ + PgSQLDropTableOrViewStatement createDropTableOrViewStatement( TableNameDirect tableName, ObjectType theType, + DropBehaviour dropBehaviour, Boolean useIfExists ); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/package-info.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/package-info.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/package-info.java new file mode 100644 index 0000000..63949b2 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/factories/pgsql/package-info.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +/** + * Package to contain PostgreSQL-specific factories enabling creating of PostgreSQL-specific syntax elements. + */ +package org.apache.polygene.library.sql.generator.grammar.factories.pgsql; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/DirectLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/DirectLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/DirectLiteral.java new file mode 100644 index 0000000..9e52571 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/DirectLiteral.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +/** + * This syntax element encapsulates text to be inserted directly into SQL statement. + * + * @author Stanislav Muhametsin + */ +public interface DirectLiteral + extends LiteralExpression +{ + + /** + * Returns the text to be inserted directly into SQL statement. + * + * @return The text to be inserted directly into SQL statement. + */ + String getDirectLiteral(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/LiteralExpression.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/LiteralExpression.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/LiteralExpression.java new file mode 100644 index 0000000..2e6d15d --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/LiteralExpression.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression; + +/** + * This is common interface for all literal expressions. + * + * @author Stanislav Muhametsin + */ +public interface LiteralExpression + extends NonBooleanExpression +{ + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/NumericLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/NumericLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/NumericLiteral.java new file mode 100644 index 0000000..e61e29d --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/NumericLiteral.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +/** + * This syntax element encapsulates reference to some number to be inserted into SQL statement. + * + * @author Stanislav Muhametsin + */ +public interface NumericLiteral + extends LiteralExpression +{ + /** + * Returns the number to be inserted into SQL statement. + * + * @return The number to be inserted into SQL statement. + */ + Number getNumber(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/SQLFunctionLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/SQLFunctionLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/SQLFunctionLiteral.java new file mode 100644 index 0000000..1db873d --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/SQLFunctionLiteral.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +import java.util.List; +import org.apache.polygene.library.sql.generator.grammar.common.ValueExpression; + +/** + * This syntax element encapsulates reference to some SQL function to be inserted into SQL statement. + * + * @author Stanislav Muhametsin + */ +public interface SQLFunctionLiteral + extends LiteralExpression +{ + + /** + * Returns the name of the SQL function. + * + * @return The name of the SQL function. + */ + String getFunctionName(); + + /** + * The parameters for SQL function. + * + * @return The parameters for SQL function. + */ + List<ValueExpression> getParameters(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/StringLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/StringLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/StringLiteral.java new file mode 100644 index 0000000..9006e81 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/StringLiteral.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +/** + * This syntax element encapsulates reference to SQL string, that is, some element between {@code '} and {@code '} + * characters. + * + * @author Stanislav Muhametsin + */ +public interface StringLiteral + extends LiteralExpression +{ + + /** + * Returns the contents of the string literal, that is, the string to be put between {@code '} and {@code '}. + * + * @return The contents of the string literal. + */ + String getString(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TemporalLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TemporalLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TemporalLiteral.java new file mode 100644 index 0000000..8293a4e --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TemporalLiteral.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +/** + * This syntax element represents any literal that represents some kind of time. + * + * @author 2011 Stanislav Muhametsin + * @see TimestampTimeLiteral + */ +public interface TemporalLiteral + extends LiteralExpression +{ + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TimestampTimeLiteral.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TimestampTimeLiteral.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TimestampTimeLiteral.java new file mode 100644 index 0000000..423594f --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/TimestampTimeLiteral.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.literals; + +import java.sql.Timestamp; + +/** + * This syntax element encapsulates reference to some time stamp to be inserted into SQL statement. + * + * @author Stanislav Muhametsin + */ +public interface TimestampTimeLiteral + extends TemporalLiteral +{ + + /** + * Returns the time stamp to be inserted into SQL statement. + * + * @return The time stamp to be inserted into SQL statement. + */ + Timestamp getTimestamp(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/package-info.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/package-info.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/package-info.java new file mode 100644 index 0000000..23fb2e3 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/literals/package-info.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +/** + * The package for syntax elements representing various literals. + */ +package org.apache.polygene.library.sql.generator.grammar.literals; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddColumnDefinition.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddColumnDefinition.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddColumnDefinition.java new file mode 100644 index 0000000..48f6b19 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddColumnDefinition.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.definition.table.ColumnDefinition; + +/** + * This syntax element represents adding a new column to table. + * + * @author Stanislav Muhametsin + */ +public interface AddColumnDefinition + extends AlterTableAction +{ + + /** + * Returns the definition for column to be added. + * + * @return The definition for column to be added. + * @see ColumnDefinition + */ + ColumnDefinition getColumnDefinition(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddTableConstraintDefinition.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddTableConstraintDefinition.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddTableConstraintDefinition.java new file mode 100644 index 0000000..24b1eab --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AddTableConstraintDefinition.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraintDefinition; + +/** + * This syntax element represents the new table constraint to be added in table alteration statement. + * + * @author Stanislav Muhametsin + */ +public interface AddTableConstraintDefinition + extends AlterTableAction +{ + /** + * Returns the table constraint to be added. + * + * @return The table constraint to be added. + */ + TableConstraintDefinition getConstraint(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnAction.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnAction.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnAction.java new file mode 100644 index 0000000..1f2b2a5 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnAction.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.Typeable; + +/** + * This is common interface for column alteration actions. + * + * @author Stanislav Muhametsin + */ +public interface AlterColumnAction + extends Typeable<AlterColumnAction> +{ + + /** + * This syntax element represents dropping column default in table alteration statement. + * + * @author Stanislav Muhametsin + */ + final class DropDefault + implements AlterColumnAction + { + private DropDefault() + { + + } + + public Class<? extends AlterColumnAction> getImplementedType() + { + return DropDefault.class; + } + + public static final DropDefault INSTANCE = new DropDefault(); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnDefinition.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnDefinition.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnDefinition.java new file mode 100644 index 0000000..26616fa --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterColumnDefinition.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * This syntax element represents the alteration of column. + * + * @author Stanislav Muhametsin + * @see AlterTableAction + */ +public interface AlterColumnDefinition + extends AlterTableAction +{ + + /** + * Returns the name of the column to be altered. + * + * @return The name of the column to be altered. + */ + String getColumnName(); + + /** + * Returns the action to be done on column. + * + * @return The action to be done on column. + * @see AlterColumnAction + */ + AlterColumnAction getAction(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterStatement.java new file mode 100644 index 0000000..d807954 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterStatement.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.common.SchemaManipulationStatement; + +/** + * This is a common interface for all {@code ALTER} statements. + * + * @author Stanislav Muhametsin + */ +public interface AlterStatement + extends SchemaManipulationStatement +{ + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableAction.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableAction.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableAction.java new file mode 100644 index 0000000..0ee5866 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableAction.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.Typeable; + +/** + * This is common interface for actions altering table. + * + * @author Stanislav Muhametsin + * @see AlterTableStatement + */ +public interface AlterTableAction + extends Typeable<AlterTableAction> +{ + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableStatement.java new file mode 100644 index 0000000..ad5158d --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/AlterTableStatement.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect; + +/** + * @author Stanislav Muhametsin + */ +public interface AlterTableStatement + extends AlterStatement +{ + + /** + * Returns the name of the table to be altered. + * + * @return The name of the table to be altered. + */ + TableNameDirect getTableName(); + + /** + * Returns the action to perform in order to alter table. + * + * @return The action to perform in order to alter table. + * @see AlterTableAction + */ + AlterTableAction getAction(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviour.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviour.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviour.java new file mode 100644 index 0000000..bb57cdf --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviour.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * The drop behaviour for generalized {@code DROP} statement. Typically one of {@link #CASCADE} or {@link #RESTRICT}. + * + * @author Stanislav Muhametsin + * @see DropStatement + */ +public final class DropBehaviour +{ + + /** + * The drop behaviour which means to {@code CASCADE} the {@code DROP} through all depending elements. + */ + public static final DropBehaviour CASCADE = new DropBehaviour(); + + /** + * The drop behaviour which means to {@code RESTRICT} the {@code DROP} if any elements depend on the object to be + * dropped. + */ + public static final DropBehaviour RESTRICT = new DropBehaviour(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviourContainer.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviourContainer.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviourContainer.java new file mode 100644 index 0000000..9f61bed --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropBehaviourContainer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * A generic drop behaviour container (for any {@code DROP} clause and statement). + * + * @author Stanislav Muhametsin + */ +public interface DropBehaviourContainer +{ + + /** + * Returns the drop behaviour for this clause or statement. + * + * @return The drop behaviour for this clause or statement. + */ + DropBehaviour getDropBehaviour(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropColumnDefinition.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropColumnDefinition.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropColumnDefinition.java new file mode 100644 index 0000000..59cd0e2 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropColumnDefinition.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * This syntax element represents dropping a column from a table in table alteration statement. + * + * @author Stanislav Muhametsin + */ +public interface DropColumnDefinition + extends AlterTableAction, DropBehaviourContainer +{ + + /** + * Returns the name of the column to be dropped. + * + * @return The name of the column to be dropped. + */ + String getColumnName(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropSchemaStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropSchemaStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropSchemaStatement.java new file mode 100644 index 0000000..5b57453 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropSchemaStatement.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * This syntax element represents the {@code DROP SCHEMA} statement. + * + * @author Stanislav Muhametsin + */ +public interface DropSchemaStatement + extends DropStatement +{ + + /** + * Returns the name of the schema to be dropped. + * + * @return The name of the schema to be dropped. + */ + String getSchemaName(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropStatement.java new file mode 100644 index 0000000..0ca5010 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropStatement.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.common.SchemaManipulationStatement; + +/** + * This is a common interface for {@code DROP} statements. + * + * @author Stanislav Muhametsin + */ +public interface DropStatement + extends SchemaManipulationStatement, DropBehaviourContainer +{ + + /** + * Returns the object type to drop. Typically either {@link ObjectType#SCHEMA}, {@link ObjectType#TABLE}, or + * {@link ObjectType#VIEW}. + * + * @return The object type to drop. + * @see ObjectType + */ + ObjectType whatToDrop(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableConstraintDefinition.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableConstraintDefinition.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableConstraintDefinition.java new file mode 100644 index 0000000..a6a1cc1 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableConstraintDefinition.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * This syntax element represents dropping a table constraint in table alteration statement. + * + * @author Stanislav Muhametsin + */ +public interface DropTableConstraintDefinition + extends AlterTableAction, DropBehaviourContainer +{ + + /** + * Returns the constraint name to be dropped. + * + * @return The constraint name to be dropped. + */ + String getConstraintName(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableOrViewStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableOrViewStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableOrViewStatement.java new file mode 100644 index 0000000..1872743 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/DropTableOrViewStatement.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect; + +/** + * This is generalized statement to drop tables and views. + * + * @author Stanislav Muhametsin + */ +public interface DropTableOrViewStatement + extends DropStatement +{ + + /** + * Returns the name of the table or view to be deleted. + * + * @return The name of the table or view to be deleted. + */ + TableNameDirect getTableName(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/ObjectType.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/ObjectType.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/ObjectType.java new file mode 100644 index 0000000..33275c8 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/ObjectType.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * Object type is used in generalized {@code DROP} statement to define what to drop. It is usually one of + * {@link #SCHEMA}, {@link #TABLE}, or {@link #VIEW}. + * + * @author Stanislav Muhametsin + * @see DropStatement + */ +public final class ObjectType +{ + + /** + * The object type which means to {@code DROP SCHEMA}. + */ + public static final ObjectType SCHEMA = new ObjectType(); + + /** + * The object type which means to {@code DROP TABLE}. + */ + public static final ObjectType TABLE = new ObjectType(); + + /** + * The object type which means to {@code DROP VIEW}. + */ + public static final ObjectType VIEW = new ObjectType(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/SetColumnDefault.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/SetColumnDefault.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/SetColumnDefault.java new file mode 100644 index 0000000..4998f80 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/SetColumnDefault.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; + +/** + * This syntax element represents setting a new default for a column in table alteration statement. + * + * @author Stanislav Muhametsin + */ +public interface SetColumnDefault + extends AlterColumnAction +{ + + /** + * Returns the new default value for this column. + * + * @return The new default value for this column. + */ + String getDefault(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/package-info.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/package-info.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/package-info.java new file mode 100644 index 0000000..6ff9718 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/package-info.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +/** + * This package provides syntax elements for {@code DROP} and {@code ALTER} statements. + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/pgsql/PgSQLDropTableOrViewStatement.java ---------------------------------------------------------------------- diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/pgsql/PgSQLDropTableOrViewStatement.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/pgsql/PgSQLDropTableOrViewStatement.java new file mode 100644 index 0000000..2b916b9 --- /dev/null +++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/grammar/manipulation/pgsql/PgSQLDropTableOrViewStatement.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ +package org.apache.polygene.library.sql.generator.grammar.manipulation.pgsql; + +import org.apache.polygene.library.sql.generator.grammar.manipulation.DropTableOrViewStatement; + +/** + * @author Stanislav Muhametsin + */ +public interface PgSQLDropTableOrViewStatement extends DropTableOrViewStatement +{ + + Boolean useIfExists(); +}
