You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/04/15 08:26:00 UTC

[09/19] polygene-java git commit: Bring in Stanislav's sql-generator from GutHub, after his consent in https://lists.apache.org/thread.html/797352ce2ad7aa7b755720a98f545a176e6050e35f56db113ba115fb@%3Cdev.polygene.apache.org%3E

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/DoublePrecisionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/DoublePrecisionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/DoublePrecisionImpl.java
new file mode 100644
index 0000000..8c68de3
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/DoublePrecisionImpl.java
@@ -0,0 +1,43 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.DoublePrecision;
+
+public final class DoublePrecisionImpl
+    implements DoublePrecision
+{
+    public DoublePrecisionImpl()
+    {
+    }
+
+    /**
+     * Returns {@link DoublePrecision}.
+     */
+    public Class<DoublePrecision> getImplementedType()
+    {
+        return DoublePrecision.class;
+    }
+
+    /**
+     * A singleton instance of {@code DOUBLE PRECISION} data type.
+     */
+    public static final DoublePrecision INSTANCE = new DoublePrecisionImpl();
+}
\ 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/implementation/grammar/common/datatypes/NumericImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/NumericImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/NumericImpl.java
new file mode 100644
index 0000000..c426231
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/NumericImpl.java
@@ -0,0 +1,73 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.Numeric;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class NumericImpl extends TypeableImpl<SQLDataType, Numeric>
+    implements Numeric
+{
+    private final Integer _precision;
+    private final Integer _scale;
+
+    public NumericImpl( Integer precision, Integer scale )
+    {
+        super( Numeric.class );
+        this._precision = precision;
+        this._scale = scale;
+    }
+
+    @Override
+    protected boolean doesEqual( Numeric another )
+    {
+        return bothNullOrEquals( this._precision, another.getPrecision() )
+               && bothNullOrEquals( this._scale, another.getScale() );
+    }
+
+    /**
+     * Returns the precision (first integer) for this {@code NUMERIC}.
+     *
+     * @return The precision for this {@code NUMERIC}.
+     */
+    public Integer getPrecision()
+    {
+        return this._precision;
+    }
+
+    /**
+     * Returns the scale (second integer) for this {@code NUMERIC}.
+     *
+     * @return The precision for this {@code NUMERIC}.
+     */
+    public Integer getScale()
+    {
+        return this._scale;
+    }
+
+    /**
+     * This instance represents {@code NUMERIC} without precision and scale.
+     */
+    public static final Numeric PLAIN_NUMERIC = new NumericImpl( null, null );
+}
\ 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/implementation/grammar/common/datatypes/RealImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/RealImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/RealImpl.java
new file mode 100644
index 0000000..19a3bb4
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/RealImpl.java
@@ -0,0 +1,43 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.Real;
+
+public final class RealImpl
+    implements Real
+{
+    public RealImpl()
+    {
+    }
+
+    /**
+     * Returns {@link Real}.
+     */
+    public Class<Real> getImplementedType()
+    {
+        return Real.class;
+    }
+
+    /**
+     * A singleton instance of {@code REAL}.
+     */
+    public static final Real INSTANCE = new RealImpl();
+}
\ 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/implementation/grammar/common/datatypes/SQLBooleanImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLBooleanImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLBooleanImpl.java
new file mode 100644
index 0000000..081172e
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLBooleanImpl.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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLBoolean;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class SQLBooleanImpl
+    implements SQLBoolean
+{
+    public SQLBooleanImpl()
+    {
+
+    }
+
+    /**
+     * Returns {@link SQLBoolean}.
+     */
+    public Class<SQLBoolean> getImplementedType()
+    {
+        return SQLBoolean.class;
+    }
+
+    /**
+     * The singleton instance of {@code BOOLEAN}.
+     */
+    public static final SQLBoolean INSTANCE = new SQLBooleanImpl();
+}
\ 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/implementation/grammar/common/datatypes/SQLCharImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLCharImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLCharImpl.java
new file mode 100644
index 0000000..e5d3fb0
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLCharImpl.java
@@ -0,0 +1,69 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLChar;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+public final class SQLCharImpl extends TypeableImpl<SQLDataType, SQLChar>
+    implements SQLChar
+{
+    private final Boolean _isVarying;
+    private final Integer _length;
+
+    public SQLCharImpl( Boolean isVarying, Integer length )
+    {
+        super( SQLChar.class );
+        this._isVarying = isVarying;
+        this._length = length;
+    }
+
+    @Override
+    protected boolean doesEqual( SQLChar another )
+    {
+        return this._isVarying.equals( another.isVarying() ) && bothNullOrEquals( this._length, another.getLength() );
+    }
+
+    /**
+     * Returns {@code true} if this is {@code CHARACTER VARYING}; {@code false otherwise}.
+     *
+     * @return {@code true} if this is {@code CHARACTER VARYING}; {@code false otherwise}.
+     */
+    public Boolean isVarying()
+    {
+        return this._isVarying;
+    }
+
+    /**
+     * Returns the length specification for this {@code CHARACTER} or {@code CHARACTER VARYING}. Returns {@code null} if
+     * none specified.
+     *
+     * @return The length for this {@code CHARACTER} or {@code CHARACTER VARYING}.
+     */
+    public Integer getLength()
+    {
+        return this._length;
+    }
+
+    public static final SQLChar PLAIN_FIXED = new SQLCharImpl( false, null );
+
+    public static final SQLChar PLAIN_VARYING = new SQLCharImpl( true, null );
+}
\ 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/implementation/grammar/common/datatypes/SQLDateImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLDateImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLDateImpl.java
new file mode 100644
index 0000000..f2a1f8c
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLDateImpl.java
@@ -0,0 +1,43 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDate;
+
+public final class SQLDateImpl
+    implements SQLDate
+{
+    public SQLDateImpl()
+    {
+    }
+
+    /**
+     * Returns {@link SQLDate}.
+     */
+    public Class<SQLDate> getImplementedType()
+    {
+        return SQLDate.class;
+    }
+
+    /**
+     * A singleton instance of {@code DATE} data type.
+     */
+    public static final SQLDate INSTANCE = new SQLDateImpl();
+}
\ 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/implementation/grammar/common/datatypes/SQLFloatImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLFloatImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLFloatImpl.java
new file mode 100644
index 0000000..2a1bc47
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLFloatImpl.java
@@ -0,0 +1,60 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLFloat;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class SQLFloatImpl extends TypeableImpl<SQLDataType, SQLFloat>
+    implements SQLFloat
+{
+    private final Integer _precision;
+
+    public SQLFloatImpl( Integer precision )
+    {
+        super( SQLFloat.class );
+        this._precision = precision;
+    }
+
+    @Override
+    protected boolean doesEqual( SQLFloat another )
+    {
+        return bothNullOrEquals( this._precision, another.getPrecision() );
+    }
+
+    /**
+     * Returns the precision for this {@code FLOAT}.
+     *
+     * @return The precision for this {@code FLOAT}.
+     */
+    public Integer getPrecision()
+    {
+        return this._precision;
+    }
+
+    /**
+     * This instance represents {@code FLOAT} without precision.
+     */
+    public static final SQLFloat PLAIN_FLOAT = new SQLFloatImpl( null );
+}
\ 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/implementation/grammar/common/datatypes/SQLIntegerImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntegerImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntegerImpl.java
new file mode 100644
index 0000000..e80ed6c
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntegerImpl.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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLInteger;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class SQLIntegerImpl
+    implements SQLInteger
+{
+    public SQLIntegerImpl()
+    {
+    }
+
+    /**
+     * Returns {@link SQLInteger}.
+     */
+    public Class<SQLInteger> getImplementedType()
+    {
+        return SQLInteger.class;
+    }
+
+    /**
+     * The singleton instance of {@code INTEGER}.
+     */
+    public static final SQLInteger INSTANCE = new SQLIntegerImpl();
+}
\ 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/implementation/grammar/common/datatypes/SQLIntervalImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntervalImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntervalImpl.java
new file mode 100644
index 0000000..9b9e239
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLIntervalImpl.java
@@ -0,0 +1,103 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.IntervalDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLInterval;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class SQLIntervalImpl extends TypeableImpl<SQLDataType, SQLInterval>
+    implements SQLInterval
+{
+
+    private final IntervalDataType _startField;
+
+    private final Integer _startFieldPrecision;
+
+    private final IntervalDataType _endField;
+
+    private final Integer _secondFracs;
+
+    public SQLIntervalImpl( IntervalDataType startField, Integer startFieldPrecision, IntervalDataType endField,
+                            Integer secondFracs )
+    {
+        super( SQLInterval.class );
+        this._startField = startField;
+        this._startFieldPrecision = startFieldPrecision;
+        this._endField = endField;
+        this._secondFracs = secondFracs;
+    }
+
+    @Override
+    protected boolean doesEqual( SQLInterval another )
+    {
+        return this._startField.equals( another.getStartField() )
+               && bothNullOrEquals( this._startFieldPrecision, another.getStartFieldPrecision() )
+               && bothNullOrEquals( this._endField, another.getEndField() )
+               && bothNullOrEquals( this._secondFracs, another.getSecondFracs() );
+    }
+
+    /**
+     * Returns the start field type for this {@code INTERVAL}.
+     *
+     * @return The start field type for this {@code INTERVAL}.
+     */
+    public IntervalDataType getStartField()
+    {
+        return this._startField;
+    }
+
+    /**
+     * Return the start field precision for this {@code INTERVAL}. May be {@code null} if none specified.
+     *
+     * @return The start field precision for this {@code INTERVAL}.
+     */
+    public Integer getStartFieldPrecision()
+    {
+        return this._startFieldPrecision;
+    }
+
+    /**
+     * Returns the end field precision for this {@code INTERVAL}. Will always be {@code null} for single datetime field
+     * intervals.
+     *
+     * @return The end field precision for this {@code INTERVAL}.
+     */
+    public IntervalDataType getEndField()
+    {
+        return this._endField;
+    }
+
+    /**
+     * Returns the fraction seconds precision for this {@code INTERVAL}. Will always be {@code null} if the end field
+     * type is not {@link IntervalDataType#SECOND}, or if this is single datetime field interval, and its start type is
+     * not {@link IntervalDataType#SECOND}.
+     *
+     * @return The fraction seconds precision for this {@code INTERVAL}.
+     */
+    public Integer getSecondFracs()
+    {
+        return this._secondFracs;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeImpl.java
new file mode 100644
index 0000000..120b074
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeImpl.java
@@ -0,0 +1,74 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTime;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class SQLTimeImpl extends TypeableImpl<SQLDataType, SQLTime>
+    implements SQLTime
+{
+    private final Integer _precision;
+    private final Boolean _withTimeZone;
+
+    public SQLTimeImpl( Integer precision, Boolean withTimeZone )
+    {
+        super( SQLTime.class );
+        this._precision = precision;
+        this._withTimeZone = withTimeZone;
+    }
+
+    @Override
+    protected boolean doesEqual( SQLTime another )
+    {
+        return bothNullOrEquals( this._precision, another.getPrecision() )
+               && bothNullOrEquals( this._withTimeZone, another.isWithTimeZone() );
+    }
+
+    /**
+     * Returns the precision for this {@code TIME}. May be {@code null}.
+     *
+     * @return The precision for this {@code TIME}.
+     */
+    public Integer getPrecision()
+    {
+        return this._precision;
+    }
+
+    /**
+     * Returns whether the {@code TIME} should be with time zone. May be {@code null} if no choice specified.
+     *
+     * @return
+     */
+    public Boolean isWithTimeZone()
+    {
+        return this._withTimeZone;
+    }
+
+    public static final SQLTime PLAIN_TIME = new SQLTimeImpl( null, null );
+
+    public static final SQLTime PLAIN_TIME_WITHOUT_TZ = new SQLTimeImpl( null, false );
+
+    public static final SQLTime PLAIN_TIME_WITH_TZ = new SQLTimeImpl( null, true );
+}
\ 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/implementation/grammar/common/datatypes/SQLTimeStampImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeStampImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeStampImpl.java
new file mode 100644
index 0000000..de2b22d
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SQLTimeStampImpl.java
@@ -0,0 +1,76 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTimeStamp;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * This class represents {@code TIMESTAMP} data type.
+ *
+ * @author Stanislav Muhametsin
+ */
+public final class SQLTimeStampImpl extends TypeableImpl<SQLDataType, SQLTimeStamp>
+    implements SQLTimeStamp
+{
+    private final Integer _precision;
+    private final Boolean _withTimeZone;
+
+    public SQLTimeStampImpl( Integer precision, Boolean withTimeZone )
+    {
+        super( SQLTimeStamp.class );
+        this._precision = precision;
+        this._withTimeZone = withTimeZone;
+    }
+
+    @Override
+    protected boolean doesEqual( SQLTimeStamp another )
+    {
+        return bothNullOrEquals( this._precision, another.getPrecision() )
+               && bothNullOrEquals( this._withTimeZone, another.isWithTimeZone() );
+    }
+
+    /**
+     * Returns the precision for this {@code TIMESTAMP}. May be {@code null}.
+     *
+     * @return The precision for this {@code TIMESTAMP}.
+     */
+    public Integer getPrecision()
+    {
+        return this._precision;
+    }
+
+    /**
+     * Returns whether the {@code TIMESTAMP} should be with time zone. May be {@code null} if no choice specified.
+     *
+     * @return
+     */
+    public Boolean isWithTimeZone()
+    {
+        return this._withTimeZone;
+    }
+
+    public static final SQLTimeStamp PLAIN_TIMESTAMP = new SQLTimeStampImpl( null, null );
+
+    public static final SQLTimeStamp PLAIN_TIMESTAMP_WITHOUT_TZ = new SQLTimeStampImpl( null, false );
+
+    public static final SQLTimeStamp PLAIN_TIMESTAMP_WITH_TZ = new SQLTimeStampImpl( null, true );
+}
\ 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/implementation/grammar/common/datatypes/SmallIntImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SmallIntImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SmallIntImpl.java
new file mode 100644
index 0000000..e931873
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/SmallIntImpl.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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SmallInt;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public final class SmallIntImpl
+    implements SmallInt
+{
+    public SmallIntImpl()
+    {
+    }
+
+    /**
+     * Returns {@link SmallInt}.
+     */
+    public Class<SmallInt> getImplementedType()
+    {
+        return SmallInt.class;
+    }
+
+    /**
+     * The singleton instance of {@code SMALLINT}.
+     */
+    public static final SmallInt INSTANCE = new SmallIntImpl();
+}
\ 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/implementation/grammar/common/datatypes/UserDefinedTypeImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/UserDefinedTypeImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/UserDefinedTypeImpl.java
new file mode 100644
index 0000000..8a7e119
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/UserDefinedTypeImpl.java
@@ -0,0 +1,57 @@
+/*
+ *  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.implementation.grammar.common.datatypes;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.UserDefinedType;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class UserDefinedTypeImpl extends TypeableImpl<SQLDataType, UserDefinedType>
+    implements UserDefinedType
+{
+
+    private final String _text;
+
+    public UserDefinedTypeImpl( String textContent )
+    {
+        this( UserDefinedType.class, textContent );
+    }
+
+    protected UserDefinedTypeImpl( Class<? extends UserDefinedType> realImplementingType, String textContent )
+    {
+        super( realImplementingType );
+
+        this._text = textContent;
+    }
+
+    @Override
+    protected boolean doesEqual( UserDefinedType another )
+    {
+        return bothNullOrEquals( this._text, another.getTextualRepresentation() );
+    }
+
+    public String getTextualRepresentation()
+    {
+        return this._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/implementation/grammar/common/datatypes/pgsql/TextImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/pgsql/TextImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/pgsql/TextImpl.java
new file mode 100644
index 0000000..0667f16
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/common/datatypes/pgsql/TextImpl.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.implementation.grammar.common.datatypes.pgsql;
+
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.pgsql.Text;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TextImpl
+    implements Text
+{
+
+    public TextImpl()
+    {
+    }
+
+    /**
+     * Returns {@link Text}.
+     */
+    public Class<Text> getImplementedType()
+    {
+        return Text.class;
+    }
+
+    /**
+     * A singleton instance of {@code TEXT} data type.
+     */
+    public static Text INSTANCE = new TextImpl();
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/schema/SchemaDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/schema/SchemaDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/schema/SchemaDefinitionImpl.java
new file mode 100644
index 0000000..6a376f3
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/schema/SchemaDefinitionImpl.java
@@ -0,0 +1,85 @@
+/*
+ *  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.implementation.grammar.definition.schema;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.SchemaStatement;
+import org.apache.polygene.library.sql.generator.grammar.definition.schema.SchemaDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.schema.SchemaElement;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class SchemaDefinitionImpl extends SQLSyntaxElementBase<SchemaStatement, SchemaDefinition>
+    implements SchemaDefinition
+{
+
+    private final String _charset;
+    private final String _name;
+    private final List<SchemaElement> _elements;
+
+    public SchemaDefinitionImpl( SQLProcessorAggregator processor, String name, String charset,
+                                 List<SchemaElement> elements )
+    {
+        this( processor, SchemaDefinition.class, name, charset, elements );
+    }
+
+    protected SchemaDefinitionImpl( SQLProcessorAggregator processor,
+                                    Class<? extends SchemaDefinition> realImplementingType, String name, String charset,
+                                    List<SchemaElement> elements )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( name, "Schema name" );
+        Objects.requireNonNull( elements, "Elements" );
+
+        this._name = name;
+        this._charset = charset;
+        this._elements = Collections.unmodifiableList( new ArrayList<SchemaElement>( elements ) );
+    }
+
+    @Override
+    protected boolean doesEqual( SchemaDefinition another )
+    {
+        return this._name.equals( another.getSchemaName() ) && this._elements.equals( another.getSchemaElements() )
+               && TypeableImpl.bothNullOrEquals( this._charset, another.getSchemaCharset() );
+    }
+
+    public String getSchemaCharset()
+    {
+        return this._charset;
+    }
+
+    public List<SchemaElement> getSchemaElements()
+    {
+        return this._elements;
+    }
+
+    public String getSchemaName()
+    {
+        return this._name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/CheckConstraintImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/CheckConstraintImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/CheckConstraintImpl.java
new file mode 100644
index 0000000..175744f
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/CheckConstraintImpl.java
@@ -0,0 +1,61 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.CheckConstraint;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class CheckConstraintImpl extends SQLSyntaxElementBase<TableConstraint, CheckConstraint>
+    implements CheckConstraint
+{
+
+    private final BooleanExpression _searchCondition;
+
+    public CheckConstraintImpl( SQLProcessorAggregator processor, BooleanExpression searchCondition )
+    {
+        this( processor, CheckConstraint.class, searchCondition );
+    }
+
+    protected CheckConstraintImpl( SQLProcessorAggregator processor,
+                                   Class<? extends CheckConstraint> realImplementingType, BooleanExpression searchCondition )
+    {
+        super( processor, realImplementingType );
+
+        this._searchCondition = searchCondition;
+    }
+
+    @Override
+    protected boolean doesEqual( CheckConstraint another )
+    {
+        return TypeableImpl.bothNullOrEquals( this._searchCondition, another.getCheckCondition() );
+    }
+
+    public BooleanExpression getCheckCondition()
+    {
+        return this._searchCondition;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ColumnDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ColumnDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ColumnDefinitionImpl.java
new file mode 100644
index 0000000..9a19e4f
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ColumnDefinitionImpl.java
@@ -0,0 +1,99 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.AutoGenerationPolicy;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ColumnDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableElement;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ColumnDefinitionImpl extends SQLSyntaxElementBase<TableElement, ColumnDefinition>
+    implements ColumnDefinition
+{
+
+    private final String _name;
+    private final SQLDataType _dataType;
+    private final String _default;
+    private final Boolean _mayBeNull;
+    private final AutoGenerationPolicy _autoGenerationPolicy;
+
+    public ColumnDefinitionImpl( SQLProcessorAggregator processor, String name, SQLDataType dataType,
+                                 String defaultStr, Boolean mayBeNull, AutoGenerationPolicy autoGenerationPolicy )
+    {
+        this( processor, ColumnDefinition.class, name, dataType, defaultStr, mayBeNull, autoGenerationPolicy );
+    }
+
+    protected ColumnDefinitionImpl( SQLProcessorAggregator processor,
+                                    Class<? extends ColumnDefinition> realImplementingType, String name, SQLDataType dataType, String defaultStr,
+                                    Boolean mayBeNull, AutoGenerationPolicy autoGenerationPolicy )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( name, "Column name" );
+        Objects.requireNonNull( dataType, "Column data type" );
+        Objects.requireNonNull( mayBeNull, "Null policy" );
+
+        this._name = name;
+        this._dataType = dataType;
+        this._default = defaultStr;
+        this._mayBeNull = mayBeNull;
+        this._autoGenerationPolicy = autoGenerationPolicy;
+    }
+
+    @Override
+    protected boolean doesEqual( ColumnDefinition another )
+    {
+        return this._name.equals( another.getColumnName() ) && this._dataType.equals( another.getDataType() )
+               && TypeableImpl.bothNullOrEquals( this._default, another.getDefault() )
+               && this._mayBeNull.equals( another.mayBeNull() );
+    }
+
+    public String getColumnName()
+    {
+        return this._name;
+    }
+
+    public SQLDataType getDataType()
+    {
+        return this._dataType;
+    }
+
+    public String getDefault()
+    {
+        return this._default;
+    }
+
+    public Boolean mayBeNull()
+    {
+        return this._mayBeNull;
+    }
+
+    public AutoGenerationPolicy getAutoGenerationPolicy()
+    {
+        return this._autoGenerationPolicy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ForeignKeyConstraintImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ForeignKeyConstraintImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ForeignKeyConstraintImpl.java
new file mode 100644
index 0000000..e856424
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/ForeignKeyConstraintImpl.java
@@ -0,0 +1,113 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ForeignKeyConstraint;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.MatchType;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ReferentialAction;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ForeignKeyConstraintImpl extends SQLSyntaxElementBase<TableConstraint, ForeignKeyConstraint>
+    implements ForeignKeyConstraint
+{
+
+    private final ColumnNameList _sourceColumns;
+    private final TableNameDirect _targetTableName;
+    private final ColumnNameList _targetColumns;
+    private final MatchType _matchType;
+    private final ReferentialAction _onDelete;
+    private final ReferentialAction _onUpdate;
+
+    public ForeignKeyConstraintImpl( SQLProcessorAggregator processor, ColumnNameList sourceColumns,
+                                     TableNameDirect targetTableName, ColumnNameList targetColumns, MatchType matchType, ReferentialAction onDelete,
+                                     ReferentialAction onUpdate )
+    {
+        this( processor, ForeignKeyConstraint.class, sourceColumns, targetTableName, targetColumns, matchType,
+              onDelete, onUpdate );
+    }
+
+    protected ForeignKeyConstraintImpl( SQLProcessorAggregator processor,
+                                        Class<? extends ForeignKeyConstraint> realImplementingType, ColumnNameList sourceColumns,
+                                        TableNameDirect targetTableName, ColumnNameList targetColumns, MatchType matchType, ReferentialAction onDelete,
+                                        ReferentialAction onUpdate )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( sourceColumns, "Source columns" );
+        Objects.requireNonNull( targetTableName, "Target table name" );
+
+        this._sourceColumns = sourceColumns;
+        this._targetTableName = targetTableName;
+        this._targetColumns = targetColumns;
+        this._matchType = matchType;
+        this._onDelete = onDelete;
+        this._onUpdate = onUpdate;
+    }
+
+    @Override
+    protected boolean doesEqual( ForeignKeyConstraint another )
+    {
+        return this._targetTableName.equals( another.getTargetTableName() )
+               && this._sourceColumns.equals( another.getSourceColumns() )
+               && TypeableImpl.bothNullOrEquals( this._targetColumns, another.getTargetColumns() )
+               && TypeableImpl.bothNullOrEquals( this._matchType, another.getMatchType() )
+               && TypeableImpl.bothNullOrEquals( this._onDelete, another.getOnDelete() )
+               && TypeableImpl.bothNullOrEquals( this._onUpdate, another.getOnUpdate() );
+    }
+
+    public MatchType getMatchType()
+    {
+        return this._matchType;
+    }
+
+    public ReferentialAction getOnDelete()
+    {
+        return this._onDelete;
+    }
+
+    public ReferentialAction getOnUpdate()
+    {
+        return this._onUpdate;
+    }
+
+    public ColumnNameList getSourceColumns()
+    {
+        return this._sourceColumns;
+    }
+
+    public ColumnNameList getTargetColumns()
+    {
+        return this._targetColumns;
+    }
+
+    public TableNameDirect getTargetTableName()
+    {
+        return this._targetTableName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/LikeClauseImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/LikeClauseImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/LikeClauseImpl.java
new file mode 100644
index 0000000..d763b7a
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/LikeClauseImpl.java
@@ -0,0 +1,63 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.LikeClause;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableElement;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class LikeClauseImpl extends SQLSyntaxElementBase<TableElement, LikeClause>
+    implements LikeClause
+{
+
+    private final TableNameDirect _tableName;
+
+    public LikeClauseImpl( SQLProcessorAggregator processor, TableNameDirect tableName )
+    {
+        this( processor, LikeClause.class, tableName );
+    }
+
+    protected LikeClauseImpl( SQLProcessorAggregator processor, Class<? extends LikeClause> realImplementingType,
+                              TableNameDirect tableName )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( tableName, "Table name" );
+
+        this._tableName = tableName;
+    }
+
+    @Override
+    protected boolean doesEqual( LikeClause another )
+    {
+        return this._tableName.equals( another.getTableName() );
+    }
+
+    public TableNameDirect getTableName()
+    {
+        return this._tableName;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableConstraintDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableConstraintDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableConstraintDefinitionImpl.java
new file mode 100644
index 0000000..0998576
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableConstraintDefinitionImpl.java
@@ -0,0 +1,83 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ConstraintCharacteristics;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraintDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableElement;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableConstraintDefinitionImpl extends SQLSyntaxElementBase<TableElement, TableConstraintDefinition>
+    implements TableConstraintDefinition
+{
+
+    private final String _name;
+    private final TableConstraint _constraint;
+    private final ConstraintCharacteristics _characteristics;
+
+    public TableConstraintDefinitionImpl( SQLProcessorAggregator processor, String name, TableConstraint constraint,
+                                          ConstraintCharacteristics characteristics )
+    {
+        this( processor, TableConstraintDefinition.class, name, constraint, characteristics );
+    }
+
+    protected TableConstraintDefinitionImpl( SQLProcessorAggregator processor,
+                                             Class<? extends TableConstraintDefinition> realImplementingType, String name, TableConstraint constraint,
+                                             ConstraintCharacteristics characteristics )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( constraint, "Constraint" );
+
+        this._constraint = constraint;
+        this._name = name;
+        this._characteristics = characteristics;
+    }
+
+    @Override
+    protected boolean doesEqual( TableConstraintDefinition another )
+    {
+        return this._constraint.equals( another.getConstraint() )
+               && TypeableImpl.bothNullOrEquals( this._name, another.getConstraintName() )
+               && TypeableImpl.bothNullOrEquals( this._characteristics, another.getCharacteristics() );
+    }
+
+    public ConstraintCharacteristics getCharacteristics()
+    {
+        return this._characteristics;
+    }
+
+    public TableConstraint getConstraint()
+    {
+        return this._constraint;
+    }
+
+    public String getConstraintName()
+    {
+        return this._name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableDefinitionImpl.java
new file mode 100644
index 0000000..6abed15
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableDefinitionImpl.java
@@ -0,0 +1,99 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.Typeable;
+import org.apache.polygene.library.sql.generator.grammar.common.SchemaStatement;
+import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableCommitAction;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableContentsSource;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableScope;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableDefinitionImpl extends SQLSyntaxElementBase<SchemaStatement, TableDefinition>
+    implements TableDefinition
+{
+
+    private final TableCommitAction _commitAction;
+    private final TableContentsSource _contents;
+    private final TableNameDirect _name;
+    private final TableScope _scope;
+
+    public TableDefinitionImpl( SQLProcessorAggregator processor, TableCommitAction commitAction,
+                                TableContentsSource contents, TableNameDirect name, TableScope scope )
+    {
+        this( processor, TableDefinition.class, commitAction, contents, name, scope );
+    }
+
+    protected TableDefinitionImpl( SQLProcessorAggregator processor,
+                                   Class<? extends TableDefinition> realImplementingType, TableCommitAction commitAction,
+                                   TableContentsSource contents, TableNameDirect name, TableScope scope )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( name, "Table name" );
+        Objects.requireNonNull( contents, "Table contents" );
+
+        this._name = name;
+        this._contents = contents;
+        this._scope = scope;
+        this._commitAction = commitAction;
+    }
+
+    @Override
+    protected boolean doesEqual( TableDefinition another )
+    {
+        return this._name.equals( another.getTableName() ) && this._contents.equals( another.getContents() )
+               && TypeableImpl.bothNullOrEquals( this._scope, another.getTableScope() )
+               && TypeableImpl.bothNullOrEquals( this._commitAction, another.getCommitAction() );
+    }
+
+    public Typeable<?> asTypeable()
+    {
+        return this;
+    }
+
+    public TableCommitAction getCommitAction()
+    {
+        return this._commitAction;
+    }
+
+    public TableContentsSource getContents()
+    {
+        return this._contents;
+    }
+
+    public TableNameDirect getTableName()
+    {
+        return this._name;
+    }
+
+    public TableScope getTableScope()
+    {
+        return this._scope;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableElementListImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableElementListImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableElementListImpl.java
new file mode 100644
index 0000000..7114482
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/TableElementListImpl.java
@@ -0,0 +1,65 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableContentsSource;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableElement;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableElementList;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class TableElementListImpl extends SQLSyntaxElementBase<TableContentsSource, TableElementList>
+    implements TableElementList
+{
+
+    private final List<TableElement> _elements;
+
+    public TableElementListImpl( SQLProcessorAggregator processor, List<TableElement> elements )
+    {
+        this( processor, TableElementList.class, elements );
+    }
+
+    protected TableElementListImpl( SQLProcessorAggregator processor,
+                                    Class<? extends TableElementList> realImplementingType, List<TableElement> elements )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( elements, "Table elements" );
+
+        this._elements = Collections.unmodifiableList( elements );
+    }
+
+    @Override
+    protected boolean doesEqual( TableElementList another )
+    {
+        return this._elements.equals( another.getElementList() );
+    }
+
+    public List<TableElement> getElementList()
+    {
+        return this._elements;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/UniqueConstraintImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/UniqueConstraintImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/UniqueConstraintImpl.java
new file mode 100644
index 0000000..8a115ba
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/table/UniqueConstraintImpl.java
@@ -0,0 +1,74 @@
+/*
+ *  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.implementation.grammar.definition.table;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.UniqueConstraint;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.UniqueSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class UniqueConstraintImpl extends SQLSyntaxElementBase<TableConstraint, UniqueConstraint>
+    implements UniqueConstraint
+{
+
+    private final ColumnNameList _columns;
+    private final UniqueSpecification _uniqueness;
+
+    public UniqueConstraintImpl( SQLProcessorAggregator processor, ColumnNameList columns,
+                                 UniqueSpecification uniqueness )
+    {
+        this( processor, UniqueConstraint.class, columns, uniqueness );
+    }
+
+    protected UniqueConstraintImpl( SQLProcessorAggregator processor,
+                                    Class<? extends UniqueConstraint> realImplementingType, ColumnNameList columns, UniqueSpecification uniqueness )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( columns, "Columns" );
+        Objects.requireNonNull( uniqueness, "Uniqueness" );
+
+        this._columns = columns;
+        this._uniqueness = uniqueness;
+    }
+
+    @Override
+    protected boolean doesEqual( UniqueConstraint another )
+    {
+        return this._uniqueness.equals( another.getUniquenessKind() )
+               && this._columns.equals( another.getColumnNameList() );
+    }
+
+    public ColumnNameList getColumnNameList()
+    {
+        return this._columns;
+    }
+
+    public UniqueSpecification getUniquenessKind()
+    {
+        return this._uniqueness;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/RegularViewSpecificationImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/RegularViewSpecificationImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/RegularViewSpecificationImpl.java
new file mode 100644
index 0000000..79aa362
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/RegularViewSpecificationImpl.java
@@ -0,0 +1,60 @@
+/*
+ *  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.implementation.grammar.definition.view;
+
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.definition.view.RegularViewSpecification;
+import org.apache.polygene.library.sql.generator.grammar.definition.view.ViewSpecification;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class RegularViewSpecificationImpl extends SQLSyntaxElementBase<ViewSpecification, RegularViewSpecification>
+    implements RegularViewSpecification
+{
+
+    private final ColumnNameList _columns;
+
+    public RegularViewSpecificationImpl( SQLProcessorAggregator processor, ColumnNameList columns )
+    {
+        this( processor, RegularViewSpecification.class, columns );
+    }
+
+    protected RegularViewSpecificationImpl( SQLProcessorAggregator processor,
+                                            Class<? extends RegularViewSpecification> realImplementingType, ColumnNameList columns )
+    {
+        super( processor, realImplementingType );
+
+        this._columns = columns;
+    }
+
+    @Override
+    protected boolean doesEqual( RegularViewSpecification another )
+    {
+        return this._columns.equals( another.getColumns() );
+    }
+
+    public ColumnNameList getColumns()
+    {
+        return this._columns;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/ViewDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/ViewDefinitionImpl.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/ViewDefinitionImpl.java
new file mode 100644
index 0000000..202ae9c
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/definition/view/ViewDefinitionImpl.java
@@ -0,0 +1,108 @@
+/*
+ *  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.implementation.grammar.definition.view;
+
+import java.util.Objects;
+import org.apache.polygene.library.sql.generator.Typeable;
+import org.apache.polygene.library.sql.generator.grammar.common.SchemaStatement;
+import org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import org.apache.polygene.library.sql.generator.grammar.definition.view.ViewCheckOption;
+import org.apache.polygene.library.sql.generator.grammar.definition.view.ViewDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.view.ViewSpecification;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.implementation.TypeableImpl;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLSyntaxElementBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class ViewDefinitionImpl extends SQLSyntaxElementBase<SchemaStatement, ViewDefinition>
+    implements ViewDefinition
+{
+
+    private final TableNameDirect _name;
+    private final QueryExpression _query;
+    private final ViewSpecification _spec;
+    private final ViewCheckOption _viewCheck;
+    private final Boolean _isRecursive;
+
+    public ViewDefinitionImpl( SQLProcessorAggregator processor, TableNameDirect name, QueryExpression query,
+                               ViewSpecification spec, ViewCheckOption viewCheck, Boolean isRecursive )
+    {
+        this( processor, ViewDefinition.class, name, query, spec, viewCheck, isRecursive );
+    }
+
+    protected ViewDefinitionImpl( SQLProcessorAggregator processor,
+                                  Class<? extends ViewDefinition> realImplementingType, TableNameDirect name, QueryExpression query,
+                                  ViewSpecification spec, ViewCheckOption viewCheck, Boolean isRecursive )
+    {
+        super( processor, realImplementingType );
+
+        Objects.requireNonNull( name, "View name" );
+        Objects.requireNonNull( query, "View query" );
+        Objects.requireNonNull( isRecursive, "Is recursive" );
+        Objects.requireNonNull( spec, "View specification" );
+
+        this._name = name;
+        this._query = query;
+        this._spec = spec;
+        this._isRecursive = isRecursive;
+        this._viewCheck = viewCheck;
+    }
+
+    @Override
+    protected boolean doesEqual( ViewDefinition another )
+    {
+        return this._name.equals( another.getViewName() ) && this._isRecursive.equals( another.isRecursive() )
+               && this._spec.equals( another.getViewSpecification() ) && this._query.equals( another.getViewQuery() )
+               && TypeableImpl.bothNullOrEquals( this._viewCheck, another.getViewCheckOption() );
+    }
+
+    public Typeable<?> asTypeable()
+    {
+        return this;
+    }
+
+    public ViewCheckOption getViewCheckOption()
+    {
+        return this._viewCheck;
+    }
+
+    public TableNameDirect getViewName()
+    {
+        return this._name;
+    }
+
+    public QueryExpression getViewQuery()
+    {
+        return this._query;
+    }
+
+    public ViewSpecification getViewSpecification()
+    {
+        return this._spec;
+    }
+
+    public Boolean isRecursive()
+    {
+        return this._isRecursive;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractBooleanFactory.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractBooleanFactory.java b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractBooleanFactory.java
new file mode 100644
index 0000000..e0ec1a7
--- /dev/null
+++ b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractBooleanFactory.java
@@ -0,0 +1,51 @@
+/*
+ *  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.implementation.grammar.factories;
+
+import org.apache.polygene.library.sql.generator.grammar.booleans.InPredicate;
+import org.apache.polygene.library.sql.generator.grammar.builders.booleans.BooleanBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.factories.BooleanFactory;
+import org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractBooleanFactory extends SQLFactoryBase
+    implements BooleanFactory
+{
+
+    protected AbstractBooleanFactory( SQLVendor vendor, SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public BooleanBuilder booleanBuilder()
+    {
+        return this.booleanBuilder( null );
+    }
+
+    public InPredicate in( NonBooleanExpression what, NonBooleanExpression... values )
+    {
+        return this.inBuilder( what ).addValues( values ).createExpression();
+    }
+}