Author: blafond
Date: 2010-01-05 15:33:13 -0500 (Tue, 05 Jan 2010)
New Revision: 1530
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlIntegrationTestUtil.java
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdlSequencerIntegrationTest.java
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdlSequencerIntegrationTest.java
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdlSequencerIntegrationTest.java
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/derby_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/oracle_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/postgres_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/grant_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/revoke_test_statements.ddl
Removed:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/DerbyDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/OracleDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/PostgresDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/derby_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/oracle_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/postgres_test_statements.ddl
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/test_cnd.cnd
Modified:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlSequencerIntegrationTest.java
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/StandardDdl.cnd
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/standard_test_statements.ddl
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlConstants.java
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlLexicon.java
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlParser.java
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlConstants.java
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlParser.java
trunk/extensions/dna-sequencer-ddl/src/test/java/org/jboss/dna/sequencer/ddl/StandardDdlParserTest.java
Log:
DNA-49 refactored ddl sequencer integration tests. Separated per dialect. Added standard
revoke statement parsing.
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlIntegrationTestUtil.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlIntegrationTestUtil.java
(rev 0)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlIntegrationTestUtil.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,348 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration.sequencer.ddl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Calendar;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFormatException;
+import javax.jcr.nodetype.NodeType;
+import org.jboss.dna.graph.SecurityContext;
+import org.jboss.dna.jcr.JcrEngine;
+import org.jboss.dna.jcr.JcrTools;
+import org.jboss.dna.repository.sequencer.SequencingService;
+
+/**
+ *
+ */
+public class DdlIntegrationTestUtil {
+ public JcrEngine engine;
+ public Session session;
+ public JcrTools tools;
+ public static final String ddlTestResourceRootFolder =
"org/jboss/dna/test/integration/sequencer/ddl/";
+
+
+ public void uploadFile(URL url) throws RepositoryException, IOException {
+ // Grab the last segment of the URL path, using it as the filename
+ String filename = url.getPath().replaceAll("([^/]*/)*", "");
+ String nodePath = "/a/b/" + filename;
+ String mimeType = "ddl";
+
+ // Now use the JCR API to upload the file ...
+
+
+ // Create the node at the supplied path ...
+ Node node = tools.findOrCreateNode(session.getRootNode(), nodePath,
"nt:folder", "nt:file");
+
+ // Upload the file to that node ...
+ Node contentNode = tools.findOrCreateChild(node, "jcr:content",
"nt:resource");
+ contentNode.setProperty("jcr:mimeType", mimeType);
+ contentNode.setProperty("jcr:lastModified", Calendar.getInstance());
+ contentNode.setProperty("jcr:data", url.openStream());
+
+ // Save the session ...
+ session.save();
+
+ }
+
+ /**
+ * Get the sequencing statistics.
+ *
+ * @return the statistics; never null
+ */
+ public SequencingService.Statistics getStatistics() {
+ return this.engine.getSequencingService().getStatistics();
+ }
+
+ public void waitUntilSequencedNodesIs( int totalNumberOfNodesSequenced ) throws
InterruptedException {
+ // check 50 times, waiting 0.1 seconds between (for a total of 5 seconds max)
...
+ long numFound = 0;
+ for (int i = 0; i != 50; i++) {
+ numFound = getStatistics().getNumberOfNodesSequenced();
+ if (numFound >= totalNumberOfNodesSequenced) {
+ return;
+ }
+ Thread.sleep(1000);
+ }
+ fail("Expected to find " + totalNumberOfNodesSequenced + " nodes
sequenced, but found " + numFound);
+ }
+
+
+ public class MyCustomSecurityContext implements SecurityContext {
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.SecurityContext#getUserName()
+ */
+ public String getUserName() {
+ return "Fred";
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.SecurityContext#hasRole(java.lang.String)
+ */
+ public boolean hasRole( String roleName ) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.SecurityContext#logout()
+ */
+ public void logout() {
+ // do something
+ }
+ }
+
+ public void verifyChildNode(Node parentNode, String childNodeName, String propName,
String expectedValue) throws Exception {
+ // Find child node
+ Node childNode = null;
+ for (NodeIterator iter = parentNode.getNodes(); iter.hasNext();) {
+ Node nextNode = iter.nextNode();
+ if( nextNode.getName().equals(childNodeName)) {
+ childNode = nextNode;
+ break;
+ }
+ }
+ if( childNode != null ) {
+ assertThat( childNode.hasProperty(propName), is(true));
+ verifySingleValueProperty(childNode, propName, expectedValue);
+
+ } else {
+ fail("NODE: " + childNodeName + " not found");
+ }
+
+ }
+
+ public void verifyNode(Node topNode, String name, String propName) throws Exception
{
+ Node node = findNode(topNode, name);
+
+ if( node != null ) {
+ assertThat( node.hasProperty(propName), is(true));
+ } else {
+ fail("NODE: " + name + " not found");
+ }
+
+ }
+
+ public void verifySimpleStringProperty(Node node, String propName, String
expectedValue) throws Exception {
+ assertThat( node.hasProperty(propName), is(true));
+ verifySingleValueProperty(node, propName, expectedValue);
+ }
+
+ public void verifyNode(Node topNode, String name, String propName, String
expectedValue) throws Exception {
+ Node node = findNode(topNode, name);
+
+ if( node != null ) {
+ assertThat( node.hasProperty(propName), is(true));
+ verifySingleValueProperty(node, propName, expectedValue);
+
+ } else {
+ fail("NODE: " + name + " not found");
+ }
+
+ }
+
+ public void verifyNode(Node topNode, String name, String propName, int expectedValue)
throws Exception {
+ Node node = findNode(topNode, name);
+
+ if( node != null ) {
+ assertThat( node.hasProperty(propName), is(true));
+ verifySingleValueProperty(node, propName, expectedValue);
+
+ } else {
+ fail("NODE: " + name + " not found");
+ }
+
+ }
+
+ protected Value value( String value ) throws Exception {
+ return session.getValueFactory().createValue(value);
+ }
+
+ public void verifySingleValueProperty(Node node, String propNameStr, String
expectedValue) throws Exception {
+ Value expValue = value(expectedValue);
+ Property prop = node.getProperty(propNameStr);
+ if( prop.getDefinition().isMultiple()) {
+ boolean hasValue = false;
+
+ Object[] values = prop.getValues();
+ for( Object val : values) {
+ if(val.equals(expValue)) {
+ hasValue = true;
+ }
+ }
+
+ assertThat(hasValue, is(true));
+ } else {
+ Object actualValue = prop.getValue();
+ assertThat(expValue, is(actualValue));
+ }
+
+ }
+
+
+ public void verifySingleValueProperty(Node node, String propNameStr, int
expectedValue) throws Exception {
+ Property prop = node.getProperty(propNameStr);
+ Value expValue = session.getValueFactory().createValue(expectedValue);
+ Object actualValue = prop.getValue();
+ assertThat(expValue, is(actualValue));
+
+ }
+
+ public void verifyMixin(Node topNode, String nodeName, String nodeType) throws
Exception {
+ Node node = findNode(topNode, nodeName);
+
+ if( node != null ) {
+ verifyMixin(node, nodeType);
+
+ } else {
+ fail("NODE: " + nodeName + " not found");
+ }
+ }
+
+ public boolean hasMixin(Node node, String nodeType) throws Exception {
+ for( NodeType mixin : node.getMixinNodeTypes() ) {
+ String mixinName = mixin.getName();
+ if( mixinName.equals(nodeType) ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void verifyMixin(Node node, String nodeType) throws Exception {
+ boolean foundMixin = hasMixin(node, nodeType);
+
+
+ assertThat(foundMixin, is(true));
+ }
+
+ public void verifyNodeType(Node topNode, String nodeName, String nodeTypeName) throws
Exception {
+ Node node = findNode(topNode, nodeName);
+
+ if( node != null ) {
+ assertThat(node.isNodeType(nodeTypeName), is(true));
+ } else {
+ fail("NODE: " + nodeName + " not found");
+ }
+
+ }
+
+ public void verifyNodeTypes(Node topNode, String nodeName, String nodeTypeName,
String...moreNodeTypeNames) throws Exception {
+ Node node = findNode(topNode, nodeName);
+
+ if( node != null ) {
+ assertThat(node.isNodeType(nodeTypeName), is(true));
+ for( String nextTypeName : moreNodeTypeNames ) {
+ assertThat(node.isNodeType(nextTypeName), is(true));
+ }
+ } else {
+ fail("NODE: " + nodeName + " not found");
+ }
+
+ }
+
+ public Node findNode(Node node, String name) throws Exception {
+ if( node.getName().equals(name)) {
+ return node;
+ }
+ for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
+ Node nextNode = iter.nextNode();
+ if( nextNode.getName().equals(name)) {
+ return nextNode;
+ }
+ Node someNode = findNode(nextNode, name);
+ if( someNode != null ) {
+ return someNode;
+ }
+ }
+
+ return null;
+ }
+
+ public Node findNode(Node node, String name, String type) throws Exception {
+ if( node.getName().equals(name) && node.isNodeType(type)) {
//(hasMixin(node, type) || node.isNodeType(type))) {
+ return node;
+ }
+ for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
+ Node nextNode = iter.nextNode();
+ //String nextNodeName = nextNode.getName();
+ //boolean isNodeType = nextNode.isNodeType(type);
+ if( nextNode.getName().equals(name) && nextNode.isNodeType(type)) {
//nextNodeName.equals(name) && isNodeType) { //(hasMixin(node, type) ||
node.isNodeType(type))) {
+ return nextNode;
+ }
+ Node someNode = findNode(nextNode, name, type);
+ if( someNode != null ) {
+ return someNode;
+ }
+ }
+
+ return null;
+ }
+
+ public void printProperties( Node node ) throws RepositoryException,
PathNotFoundException, ValueFormatException {
+
+ System.out.println("\n >>> NODE PATH: " + node.getPath() );
+ System.out.println(" NAME: " + node.getName() +
"\n" );
+
+ // Create a Properties object containing the properties for this node; ignore any
children ...
+ //Properties props = new PropMyCustomSecurityContexterties();
+ for (PropertyIterator propertyIter = node.getProperties();
propertyIter.hasNext();) {
+ Property property = propertyIter.nextProperty();
+ String name = property.getName();
+ String stringValue = null;
+ if (property.getDefinition().isMultiple()) {
+ StringBuilder sb = new StringBuilder();
+ boolean first = true;
+ for (Value value : property.getValues()) {
+ if (!first) {
+ sb.append(", ");
+ first = false;
+ }
+ sb.append(value.getString());
+ }
+ stringValue = sb.toString();
+ } else {
+ stringValue = property.getValue().getString();
+ }
+ System.out.println(" | PROP: " + name + " VALUE: " +
stringValue);
+ //props.put(name, stringValue);
+ }
+ }
+}
Property changes on:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlIntegrationTestUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlSequencerIntegrationTest.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlSequencerIntegrationTest.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/DdlSequencerIntegrationTest.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -23,35 +23,16 @@
*/
package org.jboss.dna.test.integration.sequencer.ddl;
-import static org.junit.Assert.assertNotNull;
-import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import java.io.IOException;
+import static org.junit.Assert.assertNotNull;
import java.net.URL;
-import java.util.Calendar;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.ValueFormatException;
-import javax.jcr.nodetype.NodeType;
-import org.jboss.dna.graph.SecurityContext;
import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
import org.jboss.dna.jcr.JcrConfiguration;
-import org.jboss.dna.jcr.JcrEngine;
import org.jboss.dna.jcr.JcrTools;
import org.jboss.dna.jcr.SecurityContextCredentials;
-import org.jboss.dna.repository.sequencer.SequencingService;
import org.jboss.dna.sequencer.ddl.StandardDdlLexicon;
-import org.jboss.dna.sequencer.ddl.dialect.derby.DerbyDdlLexicon;
-import org.jboss.dna.sequencer.ddl.dialect.oracle.OracleDdlLexicon;
-import org.jboss.dna.sequencer.ddl.dialect.postgres.PostgresDdlLexicon;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -59,11 +40,11 @@
/**
*
*/
-public class DdlSequencerIntegrationTest {
- private JcrEngine engine;
- private Session session;
- private JcrTools tools;
- private static final String cndDdlFolder =
"org/jboss/dna/test/integration/sequencer/ddl/";
+public class DdlSequencerIntegrationTest extends DdlIntegrationTestUtil {
+// private JcrEngine engine;
+// private Session session;
+// private JcrTools tools;
+// private static final String cndDdlFolder =
"org/jboss/dna/test/integration/sequencer/ddl/";
@Before
public void beforeEach() throws Exception {
@@ -85,14 +66,8 @@
.setProperty("defaultWorkspaceName", workspaceName);
// Set up the JCR repository to use the source ...
config.repository(repositoryName)
- .addNodeTypes(getUrl(cndDdlFolder + "StandardDdl.cnd"))
- .addNodeTypes(getUrl(cndDdlFolder + "DerbyDdl.cnd"))
- .addNodeTypes(getUrl(cndDdlFolder + "OracleDdl.cnd"))
- .addNodeTypes(getUrl(cndDdlFolder + "PostgresDdl.cnd"))
+ .addNodeTypes(getUrl(ddlTestResourceRootFolder +
"StandardDdl.cnd"))
.registerNamespace(StandardDdlLexicon.Namespace.PREFIX,
StandardDdlLexicon.Namespace.URI)
- .registerNamespace(DerbyDdlLexicon.Namespace.PREFIX,
DerbyDdlLexicon.Namespace.URI)
- .registerNamespace(OracleDdlLexicon.Namespace.PREFIX,
OracleDdlLexicon.Namespace.URI)
- .registerNamespace(PostgresDdlLexicon.Namespace.PREFIX,
PostgresDdlLexicon.Namespace.URI)
.setSource(repositorySource);
// Set up the DDL sequencer ...
config.sequencer("DDL Sequencer")
@@ -124,55 +99,10 @@
}
}
- private void uploadFile(URL url) throws RepositoryException, IOException {
- // Grab the last segment of the URL path, using it as the filename
- String filename = url.getPath().replaceAll("([^/]*/)*", "");
- String nodePath = "/a/b/" + filename;
- String mimeType = "ddl";
-
- // Now use the JCR API to upload the file ...
-
-
- // Create the node at the supplied path ...
- Node node = tools.findOrCreateNode(session.getRootNode(), nodePath,
"nt:folder", "nt:file");
-
- // Upload the file to that node ...
- Node contentNode = tools.findOrCreateChild(node, "jcr:content",
"nt:resource");
- contentNode.setProperty("jcr:mimeType", mimeType);
- contentNode.setProperty("jcr:lastModified", Calendar.getInstance());
- contentNode.setProperty("jcr:data", url.openStream());
-
- // Save the session ...
- session.save();
-
- }
-
- /**
- * Get the sequencing statistics.
- *
- * @return the statistics; never null
- */
- public SequencingService.Statistics getStatistics() {
- return this.engine.getSequencingService().getStatistics();
- }
-
- protected void waitUntilSequencedNodesIs( int totalNumberOfNodesSequenced ) throws
InterruptedException {
- // check 50 times, waiting 0.1 seconds between (for a total of 5 seconds max)
...
- long numFound = 0;
- for (int i = 0; i != 50; i++) {
- numFound = getStatistics().getNumberOfNodesSequenced();
- if (numFound >= totalNumberOfNodesSequenced) {
- return;
- }
- Thread.sleep(1000);
- }
- fail("Expected to find " + totalNumberOfNodesSequenced + " nodes
sequenced, but found " + numFound);
- }
-
@Test
public void shouldSequenceCreateSchemaDdlFile() throws Exception {
System.out.println("STARTED:
shouldSequenceCreateSchemaDdlFile(create_schema.ddl)");
- URL url = getUrl(cndDdlFolder + "create_schema.ddl");
+ URL url = getUrl(ddlTestResourceRootFolder + "create_schema.ddl");
uploadFile(url);
waitUntilSequencedNodesIs(1);
@@ -202,7 +132,7 @@
@Test
public void shouldSequenceStandardDdlFile() throws Exception {
System.out.println("STARTED:
shouldSequenceStandardDdlFile(standard_test_statements.ddl)");
- URL url = getUrl(cndDdlFolder + "standard_test_statements.ddl");
+ URL url = getUrl(ddlTestResourceRootFolder +
"standard_test_statements.ddl");
uploadFile(url);
waitUntilSequencedNodesIs(1);
@@ -220,36 +150,18 @@
//printNodeProperties(ddlNode);
long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
- assertEquals(numStatements, 11);
-
- //GRANT SELECT ON TABLE purchaseOrders TO maria,harry;
- Node grantNode = findNode(ddlNode, "purchaseOrders",
"ddl:grantOnTableStatement");
- assertNotNull(grantNode);
- Node granteeNode = findNode(grantNode, "maria",
"ddl:grantee");
- assertNotNull(granteeNode);
- Node privNode = findNode(grantNode, "privilege",
"ddl:grantPrivilege");
- assertNotNull(privNode);
- verifySingleValueProperty(privNode, "ddl:type",
"SELECT");
-
- //GRANT UPDATE, USAGE ON TABLE purchaseOrders TO anita,zhi;
- grantNode = findNode(ddlNode, "billedOrders",
"ddl:grantOnTableStatement");
- assertNotNull(grantNode);
- privNode = findNode(grantNode, "privilege",
"ddl:grantPrivilege");
- assertNotNull(privNode);
- verifySingleValueProperty(privNode, "ddl:type",
"UPDATE");
- granteeNode = findNode(grantNode, "anita",
"ddl:grantee");
- assertNotNull(granteeNode);
+ assertEquals(numStatements, 7);
}
}
}
- System.out.println("FINISHED:
shouldSequenceStandardDdlFile(create_schema.ddl)");
+ System.out.println("FINISHED:
shouldSequenceStandardDdlFile(standard_test_statements.ddl)");
}
@Test
- public void shouldSequenceDerbyDdlFile() throws Exception {
- System.out.println("STARTED:
shouldSequenceDerbyDdlFile(derby_test_statements.ddl)");
- URL url = getUrl(cndDdlFolder + "derby_test_statements.ddl");
+ public void shouldSequenceStandardDdlGrantStatements() throws Exception {
+ System.out.println("STARTED:
shouldSequenceStandardDdlGrantStatements(grant_test_statements.ddl)");
+ URL url = getUrl(ddlTestResourceRootFolder +
"grant_test_statements.ddl");
uploadFile(url);
waitUntilSequencedNodesIs(1);
@@ -263,110 +175,40 @@
//System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
Node ddlNode = iter.nextNode();
+
+ //printNodeProperties(ddlNode);
long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
- assertEquals(numStatements, 64);
+ assertEquals(numStatements, 4);
- //printNodeProperties(ddlNode);
-
- verifyNode(ddlNode, "HOTELAVAILABILITY",
"ddl:startLineNumber");
- verifyNode(ddlNode, "SAMP.DEPARTMENT",
"ddl:expression");
- verifyNode(ddlNode, "HOTEL_ID",
"ddl:datatypeName");
- verifyNode(ddlNode, "CITIES",
"ddl:startLineNumber");
-
- // Create Function
- verifyNode(ddlNode, "PROPERTY_FILE_READER",
"ddl:startLineNumber", 71);
- verifyNodeTypes(ddlNode, "PROPERTY_FILE_READER",
- "derbyddl:createFunctionStatement",
- "ddl:creatable",
- "derbyddl:functionOperand");
- verifyNode(ddlNode, "KEY_COL",
"ddl:datatypeName", "VARCHAR");
-
- Node functionNode = findNode(ddlNode, "TO_DEGREES");
- assertNotNull(functionNode);
- verifyChildNode(functionNode, "parameterStyle",
"ddl:value", "PARAMETER STYLE JAVA");
-
- // Create Index
- // CREATE INDEX IXSALE ON SAMP.SALES (SALES);
- Node indexNode = findNode(ddlNode, "IXSALE",
"derbyddl:createIndexStatement");
- assertNotNull(indexNode);
- verifySimpleStringProperty(indexNode, "derbyddl:tableName",
"SAMP.SALES");
- Node colRefNode = findNode(indexNode, "SALES");
- assertNotNull(colRefNode);
- colRefNode = findNode(ddlNode, "SALES",
"derbyddl:indexColumnReference");
- assertNotNull(colRefNode);
- verifyNodeTypes(colRefNode, "SALES",
- "derbyddl:indexColumnReference",
- "ddl:columnReference",
- "ddl:referenceOperand");
-
- // declare global temporary table SESSION.t1(c11 int) not logged;
- Node ttNode = findNode(ddlNode, "SESSION.t1",
"derbyddl:declareGlobalTemporaryTableStatement");
- assertNotNull(ttNode);
- Node colNode = findNode(ttNode, "c11");
- assertNotNull(colNode);
- verifySimpleStringProperty(colNode, "ddl:datatypeName",
"int");
-
- // LOCK TABLE FlightAvailability IN EXCLUSIVE MODE;
- Node lockNode = findNode(ddlNode, "FlightAvailability",
"derbyddl:lockTableStatement");
- assertNotNull(lockNode);
- Node optionNode = findNode(lockNode, "lockMode");
- assertNotNull(optionNode);
- verifySimpleStringProperty(optionNode, "ddl:value",
"EXCLUSIVE");
-
- // RENAME TABLE SAMP.EMP_ACT TO EMPLOYEE_ACT
- Node renameTableNode = findNode(ddlNode, "SAMP.EMP_ACT",
"derbyddl:renameTableStatement");
- assertNotNull(renameTableNode);
- verifySimpleStringProperty(renameTableNode, "ddl:newName",
"EMPLOYEE_ACT");
-
- // CREATE SYNONYM SAMP.T1 FOR SAMP.TABLEWITHLONGNAME;
- Node synonymNode = findNode(ddlNode, "SAMP.T1",
"derbyddl:createSynonymStatement");
- assertNotNull(synonymNode);
- verifySimpleStringProperty(synonymNode,
"derbyddl:tableName", "SAMP.TABLEWITHLONGNAME");
-
- //CREATE TRIGGER FLIGHTSDELETE3
- // AFTER DELETE ON FLIGHTS
- // REFERENCING OLD AS OLD
- // FOR EACH ROW
- // DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID = OLD.FLIGHT_ID;
- Node triggerNode = findNode(ddlNode, "FLIGHTSDELETE3",
"derbyddl:createTriggerStatement");
- assertNotNull(triggerNode);
- verifySimpleStringProperty(triggerNode,
"derbyddl:tableName", "FLIGHTS");
-
- //CREATE TRIGGER t1 NO CASCADE BEFORE UPDATE ON x
- // FOR EACH ROW MODE DB2SQL
- // values app.notifyEmail('Jerry', 'Table x is about to
be updated');
- triggerNode = findNode(ddlNode, "t1",
"derbyddl:createTriggerStatement");
- assertNotNull(triggerNode);
- verifySimpleStringProperty(triggerNode,
"derbyddl:tableName", "x");
- optionNode = findNode(triggerNode, "forEach");
- assertNotNull(optionNode);
- verifySimpleStringProperty(optionNode, "ddl:value",
"FOR EACH ROW");
- optionNode = findNode(triggerNode, "eventType");
- assertNotNull(optionNode);
- verifySimpleStringProperty(optionNode, "ddl:value",
"UPDATE");
-
- //GRANT EXECUTE ON PROCEDURE p TO george;
- Node grantNode = findNode(ddlNode, "p",
"derbyddl:grantOnProcedureStatement");
+ //GRANT SELECT ON TABLE purchaseOrders TO maria,harry;
+ Node grantNode = findNode(ddlNode, "purchaseOrders",
"ddl:grantOnTableStatement");
assertNotNull(grantNode);
+ Node granteeNode = findNode(grantNode, "maria",
"ddl:grantee");
+ assertNotNull(granteeNode);
+ Node privNode = findNode(grantNode, "privilege",
"ddl:grantPrivilege");
+ assertNotNull(privNode);
+ verifySingleValueProperty(privNode, "ddl:type",
"SELECT");
- //GRANT purchases_reader_role TO george,maria;
- grantNode = findNode(ddlNode, "grantRoles",
"derbyddl:grantRolesStatement");
+ //GRANT UPDATE, USAGE ON TABLE purchaseOrders FROM anita,zhi;
+ grantNode = findNode(ddlNode, "billedOrders",
"ddl:grantOnTableStatement");
assertNotNull(grantNode);
- Node roleNode = findNode(grantNode, "george",
"ddl:grantee");
- assertNotNull(roleNode);
-
+ privNode = findNode(grantNode, "privilege",
"ddl:grantPrivilege");
+ assertNotNull(privNode);
+ verifySingleValueProperty(privNode, "ddl:type",
"UPDATE");
+ granteeNode = findNode(grantNode, "anita",
"ddl:grantee");
+ assertNotNull(granteeNode);
}
}
}
- System.out.println("FINISHED:
shouldSequenceDerbyDdlFile(derby_test_statements.ddl)");
+ System.out.println("FINISHED:
shouldSequenceStandardDdlGrantStatements(grant_test_statements.ddl)");
}
@Test
- public void shouldSequenceOracleDdlFile() throws Exception {
- System.out.println("STARTED:
shouldSequenceOracleDdlFile(oracle_test_statements.ddl)");
- URL url = getUrl(cndDdlFolder + "oracle_test_statements.ddl");
+ public void shouldSequenceStandardDdlRevokeStatements() throws Exception {
+ System.out.println("STARTED:
shouldSequenceStandardDdlRevokeStatements(revoke_test_statements.ddl)");
+ URL url = getUrl(ddlTestResourceRootFolder +
"revoke_test_statements.ddl");
uploadFile(url);
waitUntilSequencedNodesIs(1);
@@ -380,335 +222,34 @@
//System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
Node ddlNode = iter.nextNode();
-
- long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
- assertEquals(numStatements, 50);
-
+
//printNodeProperties(ddlNode);
- verifyNode(ddlNode, "address",
"ddl:startLineNumber");
- verifyNode(ddlNode, "cust_orders",
"ddl:expression");
- verifyMixin(ddlNode, "cust_orders",
"oracleddl:createIndexStatement");
- verifyNodeType(ddlNode, "cust_orders",
"oracleddl:createIndexStatement");
- verifyNodeType(ddlNode, "cust_orders",
"ddl:creatable");
- verifyNode(ddlNode, "cust_orders",
"ddl:startCharIndex", 1698);
- verifyNode(ddlNode, "customers_dim",
"ddl:startColumnNumber");
- }
- }
- }
-
- System.out.println("FINISHED:
shouldSequenceOracleDdlFile(oracle_test_statements.ddl)");
- }
-
- @Test
- public void shouldSequencePostgresDdlFile() throws Exception {
- System.out.println("STARTED:
shouldSequencePostgresDdlFile(postgres_test_statements.ddl)");
- URL url = getUrl(cndDdlFolder + "postgres_test_statements.ddl");
- uploadFile(url);
-
- waitUntilSequencedNodesIs(1);
-
- // Find the node ...
- Node root = session.getRootNode();
-
- if (root.hasNode("ddls") ) {
- if (root.hasNode("ddls")) {
- Node ddlsNode = root.getNode("ddls");
- //System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
- for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
- Node ddlNode = iter.nextNode();
-
long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
- assertEquals(numStatements, 106);
+ assertEquals(numStatements, 4);
- //printNodeProperties(ddlNode);
+ //REVOKE SELECT ON TABLE purchaseOrders FROM maria,harry;
+ Node revokeNode = findNode(ddlNode, "purchaseOrders",
"ddl:revokeOnTableStatement");
+ assertNotNull(revokeNode);
+ Node granteeNode = findNode(revokeNode, "maria",
"ddl:grantee");
+ assertNotNull(granteeNode);
+ Node privNode = findNode(revokeNode, "privilege",
"ddl:grantPrivilege");
+ assertNotNull(privNode);
+ verifySingleValueProperty(privNode, "ddl:type",
"SELECT");
- verifyNodeType(ddlNode, "increment",
"postgresddl:createFunctionStatement");
- verifyNode(ddlNode, "increment",
"ddl:expression");
- verifyNodeType(ddlNode, "increment",
"ddl:creatable");
- verifyNodeType(ddlNode, "increment",
"postgresddl:functionOperand");
- verifyNode(ddlNode, "increment",
"ddl:startLineNumber", 214);
- verifyNode(ddlNode, "increment",
"ddl:startCharIndex", 7604);
-
-
- //COMMENT ON FUNCTION my_function (timestamp) IS ’Returns Roman
Numeral’;
- verifyNodeType(ddlNode, "my_function",
"postgresddl:commentOnStatement");
- verifyNode(ddlNode, "my_function",
"ddl:expression");
- verifyNodeType(ddlNode, "my_function",
"postgresddl:commentOperand");
- verifyNode(ddlNode, "my_function",
"ddl:startLineNumber", 44);
- verifyNode(ddlNode, "my_function",
"ddl:startCharIndex", 1573);
- verifyNode(ddlNode, "my_function",
"postgresddl:comment", "'Returns Roman Numeral'");
-
- //ALTER TABLE foreign_companies RENAME COLUMN address TO city;
- Node alterTableNode = findNode(ddlNode,
"foreign_companies", "postgresddl:alterTableStatement");
- assertNotNull(alterTableNode);
- Node renameColNode = findNode(alterTableNode,
"address","postgresddl:renamedColumn");
- assertNotNull(renameColNode);
- verifySingleValueProperty(renameColNode, "ddl:newName",
"city");
-
- //GRANT EXECUTE ON FUNCTION divideByTwo(numerator int, IN demoninator
int) TO george;
- Node grantNode = findNode(ddlNode, "divideByTwo",
"postgresddl:grantOnFunctionStatement");
- assertNotNull(grantNode);
- Node parameter_1 = findNode(grantNode,
"numerator","postgresddl:functionParameter");
- assertNotNull(parameter_1);
- verifySingleValueProperty(parameter_1, "ddl:datatypeName",
"int");
+ //REVOKE UPDATE, USAGE ON TABLE purchaseOrders FROM anita,zhi
CASCADE;
+ revokeNode = findNode(ddlNode, "orderDetails",
"ddl:revokeOnTableStatement");
+ assertNotNull(revokeNode);
+ privNode = findNode(revokeNode, "privilege",
"ddl:grantPrivilege");
+ assertNotNull(privNode);
+ verifySingleValueProperty(privNode, "ddl:type",
"UPDATE");
+ granteeNode = findNode(revokeNode, "anita",
"ddl:grantee");
+ assertNotNull(granteeNode);
}
}
}
- System.out.println("FINISHED:
shouldSequencePostgresDdlFile(postgres_test_statements.ddl)");
+ System.out.println("FINISHED:
shouldSequenceStandardDdlRevokeStatements(revoke_test_statements.ddl)");
}
-
- protected class MyCustomSecurityContext implements SecurityContext {
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.SecurityContext#getUserName()
- */
- public String getUserName() {
- return "Fred";
- }
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.SecurityContext#hasRole(java.lang.String)
- */
- public boolean hasRole( String roleName ) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.SecurityContext#logout()
- */
- public void logout() {
- // do something
- }
- }
-
- public void printNodeProperties(Node node) throws Exception {
- printProperties(node);
-
- for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
- printNodeProperties(iter.nextNode());
- }
-
- }
-
- private void verifyChildNode(Node parentNode, String childNodeName, String propName,
String expectedValue) throws Exception {
- // Find child node
- Node childNode = null;
- for (NodeIterator iter = parentNode.getNodes(); iter.hasNext();) {
- Node nextNode = iter.nextNode();
- if( nextNode.getName().equals(childNodeName)) {
- childNode = nextNode;
- break;
- }
- }
- if( childNode != null ) {
- assertThat( childNode.hasProperty(propName), is(true));
- verifySingleValueProperty(childNode, propName, expectedValue);
-
- } else {
- fail("NODE: " + childNodeName + " not found");
- }
-
- }
-
- private void verifyNode(Node topNode, String name, String propName) throws Exception
{
- Node node = findNode(topNode, name);
-
- if( node != null ) {
- assertThat( node.hasProperty(propName), is(true));
- } else {
- fail("NODE: " + name + " not found");
- }
-
- }
-
- private void verifySimpleStringProperty(Node node, String propName, String
expectedValue) throws Exception {
- assertThat( node.hasProperty(propName), is(true));
- verifySingleValueProperty(node, propName, expectedValue);
- }
-
- private void verifyNode(Node topNode, String name, String propName, String
expectedValue) throws Exception {
- Node node = findNode(topNode, name);
-
- if( node != null ) {
- assertThat( node.hasProperty(propName), is(true));
- verifySingleValueProperty(node, propName, expectedValue);
-
- } else {
- fail("NODE: " + name + " not found");
- }
-
- }
-
- private void verifyNode(Node topNode, String name, String propName, int
expectedValue) throws Exception {
- Node node = findNode(topNode, name);
-
- if( node != null ) {
- assertThat( node.hasProperty(propName), is(true));
- verifySingleValueProperty(node, propName, expectedValue);
-
- } else {
- fail("NODE: " + name + " not found");
- }
-
- }
-
- protected Value value( String value ) throws Exception {
- return session.getValueFactory().createValue(value);
- }
-
- private void verifySingleValueProperty(Node node, String propNameStr, String
expectedValue) throws Exception {
- Value expValue = value(expectedValue);
- Property prop = node.getProperty(propNameStr);
- if( prop.getDefinition().isMultiple()) {
- boolean hasValue = false;
-
- Object[] values = prop.getValues();
- for( Object val : values) {
- if(val.equals(expValue)) {
- hasValue = true;
- }
- }
-
- assertThat(hasValue, is(true));
- } else {
- Object actualValue = prop.getValue();
- assertThat(expValue, is(actualValue));
- }
-
- }
-
-
- private void verifySingleValueProperty(Node node, String propNameStr, int
expectedValue) throws Exception {
- Property prop = node.getProperty(propNameStr);
- Value expValue = session.getValueFactory().createValue(expectedValue);
- Object actualValue = prop.getValue();
- assertThat(expValue, is(actualValue));
-
- }
-
- private void verifyMixin(Node topNode, String nodeName, String nodeType) throws
Exception {
- Node node = findNode(topNode, nodeName);
-
- if( node != null ) {
- verifyMixin(node, nodeType);
-
- } else {
- fail("NODE: " + nodeName + " not found");
- }
- }
-
- private boolean hasMixin(Node node, String nodeType) throws Exception {
- for( NodeType mixin : node.getMixinNodeTypes() ) {
- String mixinName = mixin.getName();
- if( mixinName.equals(nodeType) ) {
- return true;
- }
- }
- return false;
- }
-
- private void verifyMixin(Node node, String nodeType) throws Exception {
- boolean foundMixin = hasMixin(node, nodeType);
-
-
- assertThat(foundMixin, is(true));
- }
-
- private void verifyNodeType(Node topNode, String nodeName, String nodeTypeName)
throws Exception {
- Node node = findNode(topNode, nodeName);
-
- if( node != null ) {
- assertThat(node.isNodeType(nodeTypeName), is(true));
- } else {
- fail("NODE: " + nodeName + " not found");
- }
-
- }
-
- private void verifyNodeTypes(Node topNode, String nodeName, String nodeTypeName,
String...moreNodeTypeNames) throws Exception {
- Node node = findNode(topNode, nodeName);
-
- if( node != null ) {
- assertThat(node.isNodeType(nodeTypeName), is(true));
- for( String nextTypeName : moreNodeTypeNames ) {
- assertThat(node.isNodeType(nextTypeName), is(true));
- }
- } else {
- fail("NODE: " + nodeName + " not found");
- }
-
- }
-
- private Node findNode(Node node, String name) throws Exception {
- if( node.getName().equals(name)) {
- return node;
- }
- for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
- Node nextNode = iter.nextNode();
- if( nextNode.getName().equals(name)) {
- return nextNode;
- }
- Node someNode = findNode(nextNode, name);
- if( someNode != null ) {
- return someNode;
- }
- }
-
- return null;
- }
-
- private Node findNode(Node node, String name, String type) throws Exception {
- if( node.getName().equals(name) && node.isNodeType(type)) {
//(hasMixin(node, type) || node.isNodeType(type))) {
- return node;
- }
- for (NodeIterator iter = node.getNodes(); iter.hasNext();) {
- Node nextNode = iter.nextNode();
- if( nextNode.getName().equals(name) && node.isNodeType(type)) {
//(hasMixin(node, type) || node.isNodeType(type))) {
- return nextNode;
- }
- Node someNode = findNode(nextNode, name, type);
- if( someNode != null ) {
- return someNode;
- }
- }
-
- return null;
- }
-
- private void printProperties( Node node ) throws RepositoryException,
PathNotFoundException, ValueFormatException {
-
- System.out.println("\n >>> NODE PATH: " + node.getPath() );
- System.out.println(" NAME: " + node.getName() +
"\n" );
-
- // Create a Properties object containing the properties for this node; ignore any
children ...
- //Properties props = new Properties();
- for (PropertyIterator propertyIter = node.getProperties();
propertyIter.hasNext();) {
- Property property = propertyIter.nextProperty();
- String name = property.getName();
- String stringValue = null;
- if (property.getDefinition().isMultiple()) {
- StringBuilder sb = new StringBuilder();
- boolean first = true;
- for (Value value : property.getValues()) {
- if (!first) {
- sb.append(", ");
- first = false;
- }
- sb.append(value.getString());
- }
- stringValue = sb.toString();
- } else {
- stringValue = property.getValue().getString();
- }
- System.out.println(" | PROP: " + name + " VALUE: " +
stringValue);
- //props.put(name, stringValue);
- }
- }
}
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdlSequencerIntegrationTest.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdlSequencerIntegrationTest.java
(rev 0)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdlSequencerIntegrationTest.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,220 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration.sequencer.ddl.dialect.derby;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.URL;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrConfiguration;
+import org.jboss.dna.jcr.JcrTools;
+import org.jboss.dna.jcr.SecurityContextCredentials;
+import org.jboss.dna.sequencer.ddl.StandardDdlLexicon;
+import org.jboss.dna.sequencer.ddl.dialect.derby.DerbyDdlLexicon;
+import org.jboss.dna.test.integration.sequencer.ddl.DdlIntegrationTestUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author blafond
+ *
+ */
+public class DerbyDdlSequencerIntegrationTest extends DdlIntegrationTestUtil {
+ private String resourceFolder = ddlTestResourceRootFolder +
"/dialect/derby/";
+
+ @Before
+ public void beforeEach() throws Exception {
+ // Configure the DNA configuration. This could be done by loading a configuration
from a file, or by
+ // using a (local or remote) configuration repository, or by setting up the
configuration programmatically.
+ // This test uses the programmatic approach...
+
+ tools = new JcrTools();
+
+ String repositoryName = "ddlRepository";
+ String workspaceName = "default";
+ String repositorySource = "ddlRepositorySource";
+
+ JcrConfiguration config = new JcrConfiguration();
+ // Set up the in-memory source where we'll upload the content and where the
sequenced output will be stored ...
+ config.repositorySource(repositorySource)
+ .usingClass(InMemoryRepositorySource.class)
+ .setDescription("The repository for our content")
+ .setProperty("defaultWorkspaceName", workspaceName);
+ // Set up the JCR repository to use the source ..protected.
+ config.repository(repositoryName)
+ .addNodeTypes(getUrl(ddlTestResourceRootFolder +
"StandardDdl.cnd"))
+ .addNodeTypes(getUrl(resourceFolder + "DerbyDdl.cnd"))
+ .registerNamespace(StandardDdlLexicon.Namespace.PREFIX,
StandardDdlLexicon.Namespace.URI)
+ .registerNamespace(DerbyDdlLexicon.Namespace.PREFIX,
DerbyDdlLexicon.Namespace.URI)
+ .setSource(repositorySource);
+ // Set up the DDL sequencer ...
+ config.sequencer("DDL Sequencer")
+ .usingClass("org.jboss.dna.sequencer.ddl.DdlSequencer")
+ .loadedFromClasspath()
+ .setDescription("Sequences DDL files to extract individual statements
and accompanying statement properties and values")
+ .sequencingFrom("//(*.(ddl)[*])/jcr:content[@jcr:data]")
+ .andOutputtingTo("/ddls/$1");
+ config.save();
+ this.engine = config.build();
+ this.engine.start();
+
+ this.session = this.engine.getRepository(repositoryName)
+ .login(new SecurityContextCredentials(new
MyCustomSecurityContext()), workspaceName);
+
+ }
+
+ private URL getUrl(String urlStr) {
+ return this.getClass().getClassLoader().getResource(urlStr);
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (this.session != null) {
+ this.session.logout();
+ }
+ if (this.engine != null) {
+ this.engine.shutdown();
+ }
+ }
+
+ @Test
+ public void shouldSequenceDerbyDdlFile() throws Exception {
+ System.out.println("STARTED:
shouldSequenceDerbyDdlFile(derby_test_statements.ddl)");
+ URL url = getUrl(resourceFolder + "derby_test_statements.ddl");
+ uploadFile(url);
+
+ waitUntilSequencedNodesIs(1);
+
+ // Find the node ...
+ Node root = session.getRootNode();
+
+ if (root.hasNode("ddls") ) {
+ if (root.hasNode("ddls")) {
+ Node ddlsNode = root.getNode("ddls");
+ //System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
+ for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
+ Node ddlNode = iter.nextNode();
+
+ long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
+ assertEquals(numStatements, 64);
+
+ //printNodeProperties(ddlNode);
+
+ verifyNode(ddlNode, "HOTELAVAILABILITY",
"ddl:startLineNumber");
+ verifyNode(ddlNode, "SAMP.DEPARTMENT",
"ddl:expression");
+ verifyNode(ddlNode, "HOTEL_ID",
"ddl:datatypeName");
+ verifyNode(ddlNode, "CITIES",
"ddl:startLineNumber");
+
+ // Create Function
+ verifyNode(ddlNode, "PROPERTY_FILE_READER",
"ddl:startLineNumber", 71);
+ verifyNodeTypes(ddlNode, "PROPERTY_FILE_READER",
+ "derbyddl:createFunctionStatement",
+ "ddl:creatable",
+ "derbyddl:functionOperand");
+ verifyNode(ddlNode, "KEY_COL",
"ddl:datatypeName", "VARCHAR");
+
+ Node functionNode = findNode(ddlNode, "TO_DEGREES");
+ assertNotNull(functionNode);
+ verifyChildNode(functionNode, "parameterStyle",
"ddl:value", "PARAMETER STYLE JAVA");
+
+ // Create Index
+ // CREATE INDEX IXSALE ON SAMP.SALES (SALES);
+ Node indexNode = findNode(ddlNode, "IXSALE",
"derbyddl:createIndexStatement");
+ assertNotNull(indexNode);
+ verifySimpleStringProperty(indexNode, "derbyddl:tableName",
"SAMP.SALES");
+ Node colRefNode = findNode(indexNode, "SALES");
+ assertNotNull(colRefNode);
+ colRefNode = findNode(ddlNode, "SALES",
"derbyddl:indexColumnReference");
+ assertNotNull(colRefNode);
+ verifyNodeTypes(colRefNode, "SALES",
+ "derbyddl:indexColumnReference",
+ "ddl:columnReference",
+ "ddl:referenceOperand");
+
+ // declare global temporary table SESSION.t1(c11 int) not logged;
+ Node ttNode = findNode(ddlNode, "SESSION.t1",
"derbyddl:declareGlobalTemporaryTableStatement");
+ assertNotNull(ttNode);
+ Node colNode = findNode(ttNode, "c11");
+ assertNotNull(colNode);
+ verifySimpleStringProperty(colNode, "ddl:datatypeName",
"int");
+
+ // LOCK TABLE FlightAvailability IN EXCLUSIVE MODE;
+ Node lockNode = findNode(ddlNode, "FlightAvailability",
"derbyddl:lockTableStatement");
+ assertNotNull(lockNode);
+ Node optionNode = findNode(lockNode, "lockMode");
+ assertNotNull(optionNode);
+ verifySimpleStringProperty(optionNode, "ddl:value",
"EXCLUSIVE");
+
+ // RENAME TABLE SAMP.EMP_ACT TO EMPLOYEE_ACT
+ Node renameTableNode = findNode(ddlNode, "SAMP.EMP_ACT",
"derbyddl:renameTableStatement");
+ assertNotNull(renameTableNode);
+ verifySimpleStringProperty(renameTableNode, "ddl:newName",
"EMPLOYEE_ACT");
+
+ // CREATE SYNONYM SAMP.T1 FOR SAMP.TABLEWITHLONGNAME;
+ Node synonymNode = findNode(ddlNode, "SAMP.T1",
"derbyddl:createSynonymStatement");
+ assertNotNull(synonymNode);
+ verifySimpleStringProperty(synonymNode,
"derbyddl:tableName", "SAMP.TABLEWITHLONGNAME");
+
+ //CREATE TRIGGER FLIGHTSDELETE3
+ // AFTER DELETE ON FLIGHTS
+ // REFERENCING OLD AS OLD
+ // FOR EACH ROW
+ // DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID = OLD.FLIGHT_ID;
+ Node triggerNode = findNode(ddlNode, "FLIGHTSDELETE3",
"derbyddl:createTriggerStatement");
+ assertNotNull(triggerNode);
+ verifySimpleStringProperty(triggerNode,
"derbyddl:tableName", "FLIGHTS");
+
+ //CREATE TRIGGER t1 NO CASCADE BEFORE UPDATE ON x
+ // FOR EACH ROW MODE DB2SQL
+ // values app.notifyEmail('Jerry', 'Table x is about to
be updated');
+ triggerNode = findNode(ddlNode, "t1",
"derbyddl:createTriggerStatement");
+ assertNotNull(triggerNode);
+ verifySimpleStringProperty(triggerNode,
"derbyddl:tableName", "x");
+ optionNode = findNode(triggerNode, "forEach");
+ assertNotNull(optionNode);
+ verifySimpleStringProperty(optionNode, "ddl:value",
"FOR EACH ROW");
+ optionNode = findNode(triggerNode, "eventType");
+ assertNotNull(optionNode);
+ verifySimpleStringProperty(optionNode, "ddl:value",
"UPDATE");
+
+ //GRANT EXECUTE ON PROCEDURE p TO george;
+ Node grantNode = findNode(ddlNode, "p",
"derbyddl:grantOnProcedureStatement");
+ assertNotNull(grantNode);
+
+ //GRANT purchases_reader_role TO george,maria;
+ grantNode = findNode(ddlNode, "grantRoles",
"derbyddl:grantRolesStatement");
+ assertNotNull(grantNode);
+ Node roleNode = findNode(grantNode, "george",
"ddl:grantee");
+ assertNotNull(roleNode);
+
+ }
+ }
+ }
+
+ System.out.println("FINISHED:
shouldSequenceDerbyDdlFile(derby_test_statements.ddl)");
+ }
+}
Property changes on:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdlSequencerIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdlSequencerIntegrationTest.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdlSequencerIntegrationTest.java
(rev 0)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdlSequencerIntegrationTest.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,140 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration.sequencer.ddl.dialect.oracle;
+
+import static org.junit.Assert.assertEquals;
+import java.net.URL;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrConfiguration;
+import org.jboss.dna.jcr.JcrTools;
+import org.jboss.dna.jcr.SecurityContextCredentials;
+import org.jboss.dna.sequencer.ddl.StandardDdlLexicon;
+import org.jboss.dna.sequencer.ddl.dialect.oracle.OracleDdlLexicon;
+import org.jboss.dna.test.integration.sequencer.ddl.DdlIntegrationTestUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author blafond
+ *
+ */
+public class OracleDdlSequencerIntegrationTest extends DdlIntegrationTestUtil {
+ private String resourceFolder = ddlTestResourceRootFolder +
"/dialect/oracle/";
+
+ @Before
+ public void beforeEach() throws Exception {
+ // Configure the DNA configuration. This could be done by loading a configuration
from a file, or by
+ // using a (local or remote) configuration repository, or by setting up the
configuration programmatically.
+ // This test uses the programmatic approach...
+
+ tools = new JcrTools();
+
+ String repositoryName = "ddlRepository";
+ String workspaceName = "default";
+ String repositorySource = "ddlRepositorySource";
+
+ JcrConfiguration config = new JcrConfiguration();
+ // Set up the in-memory source where we'll upload the content and where the
sequenced output will be stored ...
+ config.repositorySource(repositorySource)
+ .usingClass(InMemoryRepositorySource.class)
+ .setDescription("The repository for our content")
+ .setProperty("defaultWorkspaceName", workspaceName);
+ // Set up the JCR repository to use the source ...
+ config.repository(repositoryName)
+ .addNodeTypes(getUrl(ddlTestResourceRootFolder +
"StandardDdl.cnd"))
+ .addNodeTypes(getUrl(resourceFolder + "OracleDdl.cnd"))
+ .registerNamespace(StandardDdlLexicon.Namespace.PREFIX,
StandardDdlLexicon.Namespace.URI)
+ .registerNamespace(OracleDdlLexicon.Namespace.PREFIX,
OracleDdlLexicon.Namespace.URI)
+ .setSource(repositorySource);
+ // Set up the DDL sequencer ...
+ config.sequencer("DDL Sequencer")
+ .usingClass("org.jboss.dna.sequencer.ddl.DdlSequencer")
+ .loadedFromClasspath()
+ .setDescription("Sequences DDL files to extract individual statements
and accompanying statement properties and values")
+ .sequencingFrom("//(*.(ddl)[*])/jcr:content[@jcr:data]")
+ .andOutputtingTo("/ddls/$1");
+ config.save();
+ this.engine = config.build();
+ this.engine.start();
+
+ this.session = this.engine.getRepository(repositoryName)
+ .login(new SecurityContextCredentials(new
MyCustomSecurityContext()), workspaceName);
+
+ }
+
+ private URL getUrl(String urlStr) {
+ return this.getClass().getClassLoader().getResource(urlStr);
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (this.session != null) {
+ this.session.logout();
+ }
+ if (this.engine != null) {
+ this.engine.shutdown();
+ }
+ }
+
+
+ @Test
+ public void shouldSequenceOracleDdlFile() throws Exception {
+ System.out.println("STARTED:
shouldSequenceOracleDdlFile(oracle_test_statements.ddl)");
+ URL url = getUrl(resourceFolder + "oracle_test_statements.ddl");
+ uploadFile(url);
+
+ waitUntilSequencedNodesIs(1);
+
+ // Find the node ...
+ Node root = session.getRootNode();
+
+ if (root.hasNode("ddls") ) {
+ if (root.hasNode("ddls")) {
+ Node ddlsNode = root.getNode("ddls");
+ //System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
+ for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
+ Node ddlNode = iter.nextNode();
+
+ long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
+ assertEquals(numStatements, 50);
+
+ //printNodeProperties(ddlNode);
+
+ verifyNode(ddlNode, "address",
"ddl:startLineNumber");
+ verifyNode(ddlNode, "cust_orders",
"ddl:expression");
+ verifyMixin(ddlNode, "cust_orders",
"oracleddl:createIndexStatement");
+ verifyNodeType(ddlNode, "cust_orders",
"oracleddl:createIndexStatement");
+ verifyNodeType(ddlNode, "cust_orders",
"ddl:creatable");
+ verifyNode(ddlNode, "cust_orders",
"ddl:startCharIndex", 1698);
+ verifyNode(ddlNode, "customers_dim",
"ddl:startColumnNumber");
+ }
+ }
+ }
+
+ System.out.println("FINISHED:
shouldSequenceOracleDdlFile(oracle_test_statements.ddl)");
+ }
+}
Property changes on:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdlSequencerIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdlSequencerIntegrationTest.java
===================================================================
---
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdlSequencerIntegrationTest.java
(rev 0)
+++
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdlSequencerIntegrationTest.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,161 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.test.integration.sequencer.ddl.dialect.postgres;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.URL;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.jcr.JcrConfiguration;
+import org.jboss.dna.jcr.JcrTools;
+import org.jboss.dna.jcr.SecurityContextCredentials;
+import org.jboss.dna.sequencer.ddl.StandardDdlLexicon;
+import org.jboss.dna.sequencer.ddl.dialect.postgres.PostgresDdlLexicon;
+import org.jboss.dna.test.integration.sequencer.ddl.DdlIntegrationTestUtil;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class PostgresDdlSequencerIntegrationTest extends DdlIntegrationTestUtil {
+ private String resourceFolder = ddlTestResourceRootFolder +
"/dialect/postgres/";
+
+ @Before
+ public void beforeEach() throws Exception {
+ // Configure the DNA configuration. This could be done by loading a configuration
from a file, or by
+ // using a (local or remote) configuration repository, or by setting up the
configuration programmatically.
+ // This test uses the programmatic approach...
+
+ tools = new JcrTools();
+
+ String repositoryName = "ddlRepository";
+ String workspaceName = "default";
+ String repositorySource = "ddlRepositorySource";
+
+ JcrConfiguration config = new JcrConfiguration();
+ // Set up the in-memory source where we'll upload the content and where the
sequenced output will be stored ...
+ config.repositorySource(repositorySource)
+ .usingClass(InMemoryRepositorySource.class)
+ .setDescription("The repository for our content")
+ .setProperty("defaultWorkspaceName", workspaceName);
+ // Set up the JCR repository to use the source ...
+ config.repository(repositoryName)
+ .addNodeTypes(getUrl(ddlTestResourceRootFolder +
"StandardDdl.cnd"))
+ .addNodeTypes(getUrl(resourceFolder + "PostgresDdl.cnd"))
+ .registerNamespace(StandardDdlLexicon.Namespace.PREFIX,
StandardDdlLexicon.Namespace.URI)
+ .registerNamespace(PostgresDdlLexicon.Namespace.PREFIX,
PostgresDdlLexicon.Namespace.URI)
+ .setSource(repositorySource);
+ // Set up the DDL sequencer ...
+ config.sequencer("DDL Sequencer")
+ .usingClass("org.jboss.dna.sequencer.ddl.DdlSequencer")
+ .loadedFromClasspath()
+ .setDescription("Sequences DDL files to extract individual statements
and accompanying statement properties and values")
+ .sequencingFrom("//(*.(ddl)[*])/jcr:content[@jcr:data]")
+ .andOutputtingTo("/ddls/$1");
+ config.save();
+ this.engine = config.build();
+ this.engine.start();
+
+ this.session = this.engine.getRepository(repositoryName)
+ .login(new SecurityContextCredentials(new
MyCustomSecurityContext()), workspaceName);
+
+ }
+
+ private URL getUrl(String urlStr) {
+ return this.getClass().getClassLoader().getResource(urlStr);
+ }
+
+ @After
+ public void afterEach() throws Exception {
+ if (this.session != null) {
+ this.session.logout();
+ }
+ if (this.engine != null) {
+ this.engine.shutdown();
+ }
+ }
+
+ @Test
+ public void shouldSequencePostgresDdlFile() throws Exception {
+ System.out.println("STARTED:
shouldSequencePostgresDdlFile(postgres_test_statements.ddl)");
+ URL url = getUrl(resourceFolder + "postgres_test_statements.ddl");
+ uploadFile(url);
+
+ waitUntilSequencedNodesIs(1);
+
+ // Find the node ...
+ Node root = session.getRootNode();
+
+ if (root.hasNode("ddls") ) {
+ if (root.hasNode("ddls")) {
+ Node ddlsNode = root.getNode("ddls");
+ //System.out.println(" | NAME: " + ddlsNode.getName() +
" PATH: " + ddlsNode.getPath());
+ for (NodeIterator iter = ddlsNode.getNodes(); iter.hasNext();) {
+ Node ddlNode = iter.nextNode();
+
+ long numStatements =
ddlNode.getNodes().nextNode().getNodes().getSize();
+ assertEquals(numStatements, 106);
+
+ //printNodeProperties(ddlNode);
+
+ verifyNodeType(ddlNode, "increment",
"postgresddl:createFunctionStatement");
+ verifyNode(ddlNode, "increment",
"ddl:expression");
+ verifyNodeType(ddlNode, "increment",
"ddl:creatable");
+ verifyNodeType(ddlNode, "increment",
"postgresddl:functionOperand");
+ verifyNode(ddlNode, "increment",
"ddl:startLineNumber", 214);
+ verifyNode(ddlNode, "increment",
"ddl:startCharIndex", 7604);
+
+
+ //COMMENT ON FUNCTION my_function (timestamp) IS ’Returns Roman
Numeral’;
+ verifyNodeType(ddlNode, "my_function",
"postgresddl:commentOnStatement");
+ verifyNode(ddlNode, "my_function",
"ddl:expression");
+ verifyNodeType(ddlNode, "my_function",
"postgresddl:commentOperand");
+ verifyNode(ddlNode, "my_function",
"ddl:startLineNumber", 44);
+ verifyNode(ddlNode, "my_function",
"ddl:startCharIndex", 1573);
+ verifyNode(ddlNode, "my_function",
"postgresddl:comment", "'Returns Roman Numeral'");
+
+ //ALTER TABLE foreign_companies RENAME COLUMN address TO city;
+ Node alterTableNode = findNode(ddlNode,
"foreign_companies", "postgresddl:alterTableStatement");
+ assertNotNull(alterTableNode);
+ Node renameColNode = findNode(alterTableNode,
"address","postgresddl:renamedColumn");
+ assertNotNull(renameColNode);
+ verifySingleValueProperty(renameColNode, "ddl:newName",
"city");
+
+ //GRANT EXECUTE ON FUNCTION divideByTwo(numerator int, IN demoninator
int) TO george;
+ Node grantNode = findNode(ddlNode, "divideByTwo",
"postgresddl:grantOnFunctionStatement");
+ assertNotNull(grantNode);
+ Node parameter_1 = findNode(grantNode,
"numerator","postgresddl:functionParameter");
+ assertNotNull(parameter_1);
+ verifySingleValueProperty(parameter_1, "ddl:datatypeName",
"int");
+ }
+ }
+ }
+
+ System.out.println("FINISHED:
shouldSequencePostgresDdlFile(postgres_test_statements.ddl)");
+ }
+}
Property changes on:
trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdlSequencerIntegrationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/DerbyDdl.cnd
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/DerbyDdl.cnd 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/DerbyDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,102 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
- //------------------------------------------------------------------------------
-// N A M E S P A C E S
-//------------------------------------------------------------------------------
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-<ddl='http://www.jboss.org/dna/ddl/1.0'>
-<derbyddl='http://www.jboss.org/dna/ddl/derby/1.0'>
-
-// =============================================================================
-// OPERANDS
-// =============================================================================
-[derbyddl:functionOperand] > ddl:operand abstract
-[derbyddl:indexOperand] > ddl:operand abstract
-[derbyddl:procedureOperand] > ddl:operand abstract
-[derbyddl:roleOperand] > ddl:operand abstract
-[derbyddl:synonymOperand] > ddl:operand abstract
-[derbyddl:triggerOperand] > ddl:operand abstract
-
-[derbyddl:roleName] > derbyddl:roleOperand mixin
-
-// =============================================================================
-// COLUMN
-// =============================================================================
-[derbyddl:columnDefinition] > ddl:columnDefinition mixin
- - derbyddl:dropDefault (boolean)
-
-[derbyddl:functionParameter] > ddl:columnDefinition mixin
-
-[derbyddl:indexColumnReference] > ddl:columnReference mixin
- - derbyddl:order (STRING)
-
-// =============================================================================
-// CREATE STATEMENTS
-// =============================================================================
-[derbyddl:createFunctionStatement] > ddl:creatable, ddl:statement,
derbyddl:functionOperand mixin
- - ddl:datatypeName (STRING) mandatory
- - ddl:datatypeLength (LONG)
- - ddl:datatypePrecision (LONG)
- - ddl:datatypeScale (LONG)
- - ddl:isTableType (boolean)
- + * (derbyddl:functionParameter) = derbyddl:functionParameter multiple
- + * (ddl:statementOption) = ddl:statementOption multiple
-[derbyddl:createIndexStatement] > ddl:statement, ddl:creatable,
derbyddl:indexOperand mixin
- - derbyddl:tableName (string) mandatory
- - derbyddl:unique (boolean)
- + * (derbyddl:indexColumnReference) = derbyddl:indexColumnReference multiple
-[derbyddl:createProcedureStatement] > ddl:creatable, ddl:statement,
derbyddl:procedureOperand mixin
-[derbyddl:createRoleStatement] > ddl:creatable, ddl:statement,
derbyddl:roleOperand mixin
-[derbyddl:createSynonymStatement] > ddl:creatable, ddl:statement,
derbyddl:synonymOperand mixin
- - derbyddl:tableName (string) mandatory
-[derbyddl:createTriggerStatement] > ddl:creatable, ddl:statement,
derbyddl:triggerOperand mixin
- - derbyddl:tableName (string) mandatory
- - ddl:sql (string) mandatory
- + * (ddl:columnReference) = ddl:columnreference multiple
-[derbyddl:declareGlobalTemporaryTableStatement] > ddl:createTableStatement mixin
-
-// =============================================================================
-// DROP STATEMENTS
-// =============================================================================
-[derbyddl:dropFunctionStatement] > ddl:droppable, derbyddl:functionOperand mixin
-[derbyddl:dropIndexStatement] > ddl:droppable, derbyddl:indexOperand mixin
-[derbyddl:dropProcedureStatement] > ddl:droppable, derbyddl:procedureOperand mixin
-[derbyddl:dropRoleStatement] > ddl:droppable, derbyddl:roleOperand mixin
-[derbyddl:dropSynonymStatement] > ddl:droppable, derbyddl:synonymOperand mixin
-[derbyddl:dropTriggerStatement] > ddl:droppable, derbyddl:triggerOperand mixin
-
-// =============================================================================
-// MISC STATEMENTS
-// =============================================================================
-[derbyddl:lockTableStatement] > ddl:statement, ddl:tableOperand mixin
-[derbyddl:renameTableStatement] > ddl:statement, ddl:renamable, ddl:tableOperand
mixin
-
-[derbyddl:grantOnFunctionStatement] > ddl:grantStatement, derbyddl:functionOperand
mixin
-[derbyddl:grantOnProcedureStatement] > ddl:grantStatement,
derbyddl:procedureOperand mixin
-
-[derbyddl:grantRolesStatement] > ddl:grantStatement mixin
- + ddl:name (derbyddl:roleName) = derbyddl:roleName multiple
\ No newline at end of file
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/OracleDdl.cnd
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/OracleDdl.cnd 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/OracleDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,202 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
- //------------------------------------------------------------------------------
-// N A M E S P A C E S
-//------------------------------------------------------------------------------
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-<ddl='http://www.jboss.org/dna/ddl/1.0'>
-<oracleddl='http://www.jboss.org/dna/ddl/oracle/1.0'>
-
-// =============================================================================
-// OPERANDS
-// =============================================================================
-[oracleddl:clusterOperand] > ddl:operand abstract
-[oracleddl:commentOperand] > ddl:operand abstract
-[oracleddl:contextOperand] > ddl:operand abstract
-[oracleddl:controlfileOperand] > ddl:operand abstract
-[oracleddl:databaseOperand] > ddl:operand abstract
-[oracleddl:dimensionOperand] > ddl:operand abstract
-[oracleddl:directoryOperand] > ddl:operand abstract
-[oracleddl:diskgroupOperand] > ddl:operand abstract
-[oracleddl:functionOperand] > ddl:operand abstract
-[oracleddl:indexOperand] > ddl:operand abstract
-[oracleddl:indextypeOperand] > ddl:operand abstract
-[oracleddl:javaOperand] > ddl:operand abstract
-[oracleddl:libraryOperand] > ddl:operand abstract
-[oracleddl:materializedOperand] > ddl:operand abstract
-[oracleddl:operatorOperand] > ddl:operand abstract
-[oracleddl:outlineOperand] > ddl:operand abstract
-[oracleddl:packageOperand] > ddl:operand abstract
-[oracleddl:pfileOperand] > ddl:operand abstract
-[oracleddl:procedureOperand] > ddl:operand abstract
-[oracleddl:profileOperand] > ddl:operand abstract
-[oracleddl:resourceOperand] > ddl:operand abstract
-[oracleddl:roleOperand] > ddl:operand abstract
-[oracleddl:rollbackOperand] > ddl:operand abstract
-[oracleddl:sequenceOperand] > ddl:operand abstract
-[oracleddl:sessionOperand] > ddl:operand abstract
-[oracleddl:spfileOperand] > ddl:operand abstract
-[oracleddl:systemOperand] > ddl:operand abstract
-[oracleddl:synonymOperand] > ddl:operand abstract
-[oracleddl:tablespaceOperand] > ddl:operand abstract
-[oracleddl:triggerOperand] > ddl:operand abstract
-[oracleddl:typeOperand] > ddl:operand abstract
-[oracleddl:userOperand] > ddl:operand abstract
-
-// =============================================================================
-// COLUMN
-// =============================================================================
-[oracleddl:columnDefinition] > ddl:columnDefinition
- - oracleddl:dropDefault (boolean)
-
-// =============================================================================
-// ALTER STATEMENTS
-// =============================================================================
-[oracleddl:alterClusterStatement] > ddl:alterable, ddl:statement,
oracleddl:clusterOperand mixin
-[oracleddl:alterDatabaseStatement] > ddl:alterable, ddl:statement,
oracleddl:databaseOperand mixin
-[oracleddl:alterDimensionStatement] > ddl:alterable, ddl:statement,
oracleddl:dimensionOperand mixin
-[oracleddl:alterDiskgroupStatement] > ddl:alterable, ddl:statement,
oracleddl:diskgroupOperand mixin
-[oracleddl:alterFunctionStatement] > ddl:alterable, ddl:statement,
oracleddl:functionOperand mixin
-[oracleddl:alterIndexStatement] > ddl:alterable, ddl:statement,
oracleddl:indexOperand mixin
-[oracleddl:alterIndextypeStatement] > ddl:alterable, ddl:statement,
oracleddl:indextypeOperand mixin
-[oracleddl:alterJavaStatement] > ddl:alterable, ddl:statement,
oracleddl:javaOperand mixin
-[oracleddl:alterMaterializedStatement] > ddl:alterable, ddl:statement,
oracleddl:materializedOperand mixin
-[oracleddl:alterOperatorStatement] > ddl:alterable, ddl:statement,
oracleddl:operatorOperand mixin
-[oracleddl:alterOutlineStatement] > ddl:alterable, ddl:statement,
oracleddl:outlineOperand mixin
-[oracleddl:alterPackageStatement] > ddl:alterable, ddl:statement,
oracleddl:packageOperand mixin
-[oracleddl:alterProcedureStatement] > ddl:alterable, ddl:statement,
oracleddl:procedureOperand mixin
-[oracleddl:alterProfileStatement] > ddl:alterable, ddl:statement,
oracleddl:profileOperand mixin
-[oracleddl:alterResourceStatement] > ddl:alterable, ddl:statement,
oracleddl:resourceOperand mixin
-[oracleddl:alterRoleStatement] > ddl:alterable, ddl:statement,
oracleddl:roleOperand mixin
-[oracleddl:alterRollbackStatement] > ddl:alterable, ddl:statement,
oracleddl:rollbackOperand mixin
-[oracleddl:alterSequenceStatement] > ddl:alterable, ddl:statement,
oracleddl:sequenceOperand mixin
-[oracleddl:alterSessionStatement] > ddl:alterable, ddl:statement,
oracleddl:sessionOperand mixin
-[oracleddl:alterSystemStatement] > ddl:alterable, ddl:statement,
oracleddl:systemOperand mixin
-[oracleddl:alterTablespaceStatement] > ddl:alterable, ddl:statement,
oracleddl:tablespaceOperand mixin
-[oracleddl:alterTriggerStatement] > ddl:alterable, ddl:statement,
oracleddl:triggerOperand mixin
-[oracleddl:alterTypeStatement] > ddl:alterable, ddl:statement,
oracleddl:typeOperand mixin
-[oracleddl:alterUserStatement] > ddl:alterable, ddl:statement,
oracleddl:userOperand mixin
-[oracleddl:alterViewStatement] > ddl:alterable, ddl:statement,
ddl:viewOperand mixin
-
-[oracleddl:alterTableStatement] > ddl:alterTableStatement mixin
- - oracleddl:newTableName (STRING)
- + oracleddl:renameColumn (ddl:renamable) = ddl:renamable multiple
- + oracleddl:renameConstraint (ddl:renamable) = ddl:renamable multiple
-
-// =============================================================================
-// CREATE STATEMENTS
-// =============================================================================
-
-[oracleddl:createClusterStatement] > ddl:creatable, ddl:statement,
oracleddl:clusterOperand mixin
-[oracleddl:createContextStatement] > ddl:creatable, ddl:statement,
oracleddl:contextOperand mixin
-[oracleddl:createControlfileStatement] > ddl:creatable, ddl:statement,
oracleddl:controlfileOperand mixin
-[oracleddl:createDatabaseStatement] > ddl:creatable, ddl:statement,
oracleddl:databaseOperand mixin
-[oracleddl:createDimensionStatement] > ddl:creatable, ddl:statement,
oracleddl:dimensionOperand mixin
-[oracleddl:createDirectoryStatement] > ddl:creatable, ddl:statement,
oracleddl:directoryOperand mixin
-[oracleddl:createDiskgroupStatement] > ddl:creatable, ddl:statement,
oracleddl:diskgroupOperand mixin
-[oracleddl:createFunctionStatement] > ddl:creatable, ddl:statement,
oracleddl:functionOperand mixin
-[oracleddl:createIndexStatement] > ddl:creatable, ddl:statement,
oracleddl:indexOperand mixin
- - oracleddl:tableName (string) mandatory
- - oracleddl:unique (boolean)
- - oracleddl:bitmap (boolean)
- + * (ddl:columnReference) = ddl:columnReference multiple
-[oracleddl:createIndexTypeStatement] > ddl:creatable, ddl:statement,
oracleddl:indextypeOperand mixin
-[oracleddl:createJavaStatement] > ddl:creatable, ddl:statement,
oracleddl:javaOperand mixin
-[oracleddl:createLibraryStatement] > ddl:creatable, ddl:statement,
oracleddl:libraryOperand mixin
-[oracleddl:createMaterializedStatement] > ddl:creatable, ddl:statement,
oracleddl:materializedOperand mixin
-[oracleddl:createOperatorStatement] > ddl:creatable, ddl:statement,
oracleddl:operatorOperand mixin
-[oracleddl:createOutlineStatement] > ddl:creatable, ddl:statement,
oracleddl:outlineOperand mixin
-[oracleddl:createPackageStatement] > ddl:creatable, ddl:statement,
oracleddl:packageOperand mixin
-[oracleddl:createPfileStatement] > ddl:creatable, ddl:statement,
oracleddl:pfileOperand mixin
-[oracleddl:createProcedureStatement] > ddl:creatable, ddl:statement,
oracleddl:procedureOperand mixin
-[oracleddl:createRoleStatement] > ddl:creatable, ddl:statement,
oracleddl:roleOperand mixin
-[oracleddl:createRollbackStatement] > ddl:creatable, ddl:statement,
oracleddl:rollbackOperand mixin
-[oracleddl:createSequenceStatement] > ddl:creatable, ddl:statement,
oracleddl:sequenceOperand mixin
-[oracleddl:createSpfileStatement] > ddl:creatable, ddl:statement,
oracleddl:spfileOperand mixin
-[oracleddl:createSynonymStatement] > ddl:creatable, ddl:statement,
oracleddl:synonymOperand mixin
-[oracleddl:createTablespaceStatement] > ddl:creatable, ddl:statement,
oracleddl:tablespaceOperand mixin
-[oracleddl:createTriggerStatement] > ddl:creatable, ddl:statement,
oracleddl:triggerOperand mixin
-[oracleddl:createTypeStatement] > ddl:creatable, ddl:statement,
oracleddl:typeOperand mixin
-[oracleddl:createUserStatement] > ddl:creatable, ddl:statement,
oracleddl:userOperand mixin
-
-// =============================================================================
-// DROP STATEMENTS
-// =============================================================================
-
-[oracleddl:dropClusterStatement] > ddl:droppable, ddl:statement,
oracleddl:clusterOperand mixin
-[oracleddl:dropContextStatement] > ddl:droppable, ddl:statement,
oracleddl:contextOperand mixin
-[oracleddl:dropDatabaseStatement] > ddl:droppable, ddl:statement,
oracleddl:databaseOperand mixin
-[oracleddl:dropDimensionStatement] > ddl:droppable, ddl:statement,
oracleddl:dimensionOperand mixin
-[oracleddl:dropDirectoryStatement] > ddl:droppable, ddl:statement,
oracleddl:directoryOperand mixin
-[oracleddl:dropDiskgroupStatement] > ddl:droppable, ddl:statement,
oracleddl:diskgroupOperand mixin
-[oracleddl:dropFunctionStatement] > ddl:droppable, ddl:statement,
oracleddl:functionOperand mixin
-[oracleddl:dropIndexStatement] > ddl:droppable, ddl:statement,
oracleddl:indexOperand mixin
-[oracleddl:dropIndextypeStatement] > ddl:droppable, ddl:statement,
oracleddl:indextypeOperand mixin
-[oracleddl:dropJavaStatement] > ddl:droppable, ddl:statement,
oracleddl:javaOperand mixin
-[oracleddl:dropLibraryStatement] > ddl:droppable, ddl:statement,
oracleddl:libraryOperand mixin
-[oracleddl:dropMaterializedStatement] > ddl:droppable, ddl:statement,
oracleddl:materializedOperand mixin
-[oracleddl:dropOperatorStatement] > ddl:droppable, ddl:statement,
oracleddl:operatorOperand mixin
-[oracleddl:dropOutlineStatement] > ddl:droppable, ddl:statement,
oracleddl:outlineOperand mixin
-[oracleddl:dropPackageStatement] > ddl:droppable, ddl:statement,
oracleddl:packageOperand mixin
-[oracleddl:dropProcedureStatement] > ddl:droppable, ddl:statement,
oracleddl:procedureOperand mixin
-[oracleddl:dropProfileStatement] > ddl:droppable, ddl:statement,
oracleddl:profileOperand mixin
-[oracleddl:dropRoleStatement] > ddl:droppable, ddl:statement,
oracleddl:roleOperand mixin
-[oracleddl:dropRollbackStatement] > ddl:droppable, ddl:statement,
oracleddl:rollbackOperand mixin
-[oracleddl:dropSequenceStatement] > ddl:droppable, ddl:statement,
oracleddl:sequenceOperand mixin
-[oracleddl:dropSynonymStatement] > ddl:droppable, ddl:statement,
oracleddl:synonymOperand mixin
-[oracleddl:dropTablespaceStatement] > ddl:droppable, ddl:statement,
oracleddl:tablespaceOperand mixin
-[oracleddl:dropTriggerStatement] > ddl:droppable, ddl:statement,
oracleddl:triggerOperand mixin
-[oracleddl:dropTypeStatement] > ddl:droppable, ddl:statement,
oracleddl:typeOperand mixin
-[oracleddl:dropUserStatement] > ddl:droppable, ddl:statement,
oracleddl:userOperand mixin
-
-// =============================================================================
-// MISC STATEMENTS
-// =============================================================================
-
-[oracleddl:analyzeStatement] > ddl:statement mixin
-[oracleddl:associateStatisticsStatement] > ddl:statement mixin
-[oracleddl:auditStatement] > ddl:statement mixin
-[oracleddl:commitStatement] > ddl:statement mixin
-[oracleddl:commentOnStatement] > ddl:statement, oracleddl:commentOperand mixin
- - oracleddl:targetObjectType (STRING) mandatory
- - oracleddl:targetObjectName (STRING)
- - oracleddl:comment (STRING) mandatory
-[oracleddl:disassociateStatisticsStatement] > ddl:statement mixin
-[oracleddl:explainPlanStatement] > ddl:statement mixin
-[oracleddl:flashbackStatement] > ddl:statement mixin
-[oracleddl:lockTableStatement] > ddl:statement mixin
-[oracleddl:mergeStatement] > ddl:statement mixin
-[oracleddl:nestedTableStatement] > ddl:statement mixin
-[oracleddl:noauditStatement] > ddl:statement mixin
-[oracleddl:purgeStatement] > ddl:statement mixin
-[oracleddl:renameStatement] > ddl:statement mixin
-[oracleddl:revokeStatement] > ddl:statement mixin
-[oracleddl:rollbackStatement] > ddl:statement mixin
-[oracleddl:setConstraintsStatement] > ddl:statement, ddl:settable mixin
-[oracleddl:setRoleStatement] > ddl:statement, ddl:settable mixin
-[oracleddl:setTransactionStatement] > ddl:statement, ddl:settable mixin
-[oracleddl:truncateStatement] > ddl:statement mixin
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/PostgresDdl.cnd
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/PostgresDdl.cnd 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/PostgresDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,205 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
- //------------------------------------------------------------------------------
-// N A M E S P A C E S
-//------------------------------------------------------------------------------
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-<ddl='http://www.jboss.org/dna/ddl/1.0'>
-<postgresddl='http://www.jboss.org/dna/ddl/postgres/1.0'>
-
-// =============================================================================
-// OPERANDS
-// =============================================================================
-[postgresddl:aggregateOperand] > ddl:operand abstract
-[postgresddl:castOperand] > ddl:operand abstract
-[postgresddl:commentOperand] > ddl:operand abstract
-[postgresddl:constraintTriggerOperand] > ddl:operand abstract
-[postgresddl:conversionOperand] > ddl:operand abstract
-[postgresddl:databaseOperand] > ddl:operand abstract
-[postgresddl:foreignDataOperand] > ddl:operand abstract
-[postgresddl:groupOperand] > ddl:operand abstract
-[postgresddl:functionOperand] > ddl:operand abstract
-[postgresddl:indexOperand] > ddl:operand abstract
-[postgresddl:languageOperand] > ddl:operand abstract
-[postgresddl:operatorOperand] > ddl:operand abstract
-[postgresddl:ownedByOperand] > ddl:operand abstract
-[postgresddl:roleOperand] > ddl:operand abstract
-[postgresddl:ruleOperand] > ddl:operand abstract
-[postgresddl:sequenceOperand] > ddl:operand abstract
-[postgresddl:serverOperand] > ddl:operand abstract
-[postgresddl:tablespaceOperand] > ddl:operand abstract
-[postgresddl:textSearchOperand] > ddl:operand abstract
-[postgresddl:triggerOperand] > ddl:operand abstract
-[postgresddl:typeOperand] > ddl:operand abstract
-[postgresddl:userOperand] > ddl:operand abstract
-[postgresddl:userMappingOperand] > ddl:operand abstract
-[postgresddl:parameterOperand] > ddl:operand abstract
-
-[postgresddl:functionParameter] > postgresddl:parameterOperand mixin
- - ddl:datatypeName (STRING) mandatory
- - ddl:datatypeLength (LONG)
- - ddl:datatypePrecision (LONG)
- - ddl:datatypeScale (LONG)
- - ddl:nullable (STRING)
- - ddl:defaultOption (STRING)
- - postgresddl:mode (STRING)
-
-[postgresddl:role] > postgresddl:roleOperand mixin
-
-[postgresddl:renamedColumn] > ddl:renamable mixin
-
-// =============================================================================
-// ALTER STATEMENTS
-// =============================================================================
-[postgresddl:alterAggregateStatement] > ddl:alterable, ddl:statement,
postgresddl:aggregateOperand mixin
-[postgresddl:alterConversionStatement] > ddl:alterable, ddl:statement,
postgresddl:conversionOperand mixin
-[postgresddl:alterDatabaseStatement] > ddl:alterable, ddl:statement,
postgresddl:databaseOperand mixin
-[postgresddl:alterForeignDataWrapperStatement] > ddl:alterable, ddl:statement,
postgresddl:foreignDataOperand mixin
-[postgresddl:alterFunctionStatement] > ddl:alterable, ddl:statement,
postgresddl:functionOperand mixin
-[postgresddl:alterGroupStatement] > ddl:alterable, ddl:statement,
postgresddl:groupOperand mixin
-[postgresddl:alterIndexStatement] > ddl:alterable, ddl:statement,
postgresddl:indexOperand mixin
-[postgresddl:alterLanguageStatement] > ddl:alterable, ddl:statement,
postgresddl:languageOperand mixin
-[postgresddl:alterOperatorStatement] > ddl:alterable, ddl:statement,
postgresddl:operatorOperand mixin
-[postgresddl:alterRoleStatement] > ddl:alterable, ddl:statement,
postgresddl:roleOperand mixin
-[postgresddl:alterSchemaStatement] > ddl:alterable, ddl:statement,
ddl:schemaOperand mixin
-[postgresddl:alterSequenceStatement] > ddl:alterable, ddl:statement,
postgresddl:sequenceOperand mixin
-[postgresddl:alterServerStatement] > ddl:alterable, ddl:statement,
postgresddl:serverOperand mixin
-[postgresddl:alterTablespaceStatement] > ddl:alterable, ddl:statement,
postgresddl:tablespaceOperand mixin
-[postgresddl:alterTextSearchStatement] > ddl:alterable, ddl:statement,
postgresddl:textSearchOperand mixin
-[postgresddl:alterTriggerStatement] > ddl:alterable, ddl:statement,
postgresddl:triggerOperand mixin
-[postgresddl:alterTypeStatement] > ddl:alterable, ddl:statement,
postgresddl:typeOperand mixin
-[postgresddl:alterUserStatement] > ddl:alterable, ddl:statement,
postgresddl:userOperand mixin
-[postgresddl:alterUserMappingStatement] > ddl:alterable, ddl:statement,
postgresddl:userMappingOperand mixin
-[postgresddl:alterViewStatement] > ddl:alterable, ddl:statement,
ddl:viewOperand mixin
-
-[postgresddl:alterTableStatement] > ddl:alterTableStatement mixin
- - postgresddl:newTableName (STRING)
- - postgresddl:schemaName (STRING)
- + postgresddl:renameColumn (postgresddl:renamedColumn) = postgresddl:renamedColumn
multiple
-
-
-// =============================================================================
-// CREATE STATEMENTS
-// =============================================================================
-
-[postgresddl:createAggregateStatement] > ddl:creatable, ddl:statement,
postgresddl:aggregateOperand mixin
-[postgresddl:createCastStatement] > ddl:creatable, ddl:statement,
postgresddl:castOperand mixin
-[postgresddl:createConstraintTriggerStatement] > ddl:creatable, ddl:statement,
postgresddl:constraintTriggerOperand mixin
-[postgresddl:createConversionStatement] > ddl:creatable, ddl:statement,
postgresddl:conversionOperand mixin
-[postgresddl:createDatabaseStatement] > ddl:creatable, ddl:statement,
postgresddl:databaseOperand mixin
-[postgresddl:createForeignDataWrapperStatement] > ddl:creatable, ddl:statement,
postgresddl:foreignDataOperand mixin
-[postgresddl:createFunctionStatement] > ddl:creatable, ddl:statement,
postgresddl:functionOperand mixin
-[postgresddl:createGroupStatement] > ddl:creatable, ddl:statement,
postgresddl:groupOperand mixin
-[postgresddl:createIndexStatement] > ddl:creatable, ddl:statement,
postgresddl:indexOperand mixin
-[postgresddl:createLanguageStatement] > ddl:creatable, ddl:statement,
postgresddl:languageOperand mixin
-[postgresddl:createOperatorStatement] > ddl:creatable, ddl:statement,
postgresddl:operatorOperand mixin
-[postgresddl:createRoleStatement] > ddl:creatable, ddl:statement,
postgresddl:roleOperand mixin
-[postgresddl:createRuleStatement] > ddl:creatable, ddl:statement,
postgresddl:ruleOperand mixin
-[postgresddl:createSequenceStatement] > ddl:creatable, ddl:statement,
postgresddl:sequenceOperand mixin
-[postgresddl:createServerStatement] > ddl:creatable, ddl:statement,
postgresddl:serverOperand mixin
-[postgresddl:createTablespaceStatement] > ddl:creatable, ddl:statement,
postgresddl:tablespaceOperand mixin
-[postgresddl:createTextSearchStatement] > ddl:creatable, ddl:statement,
postgresddl:textSearchOperand mixin
-[postgresddl:createTriggerStatement] > ddl:creatable, ddl:statement,
postgresddl:triggerOperand mixin
-[postgresddl:createTypeStatement] > ddl:creatable, ddl:statement,
postgresddl:typeOperand mixin
-[postgresddl:createUserStatement] > ddl:creatable, ddl:statement,
postgresddl:userOperand mixin
-[postgresddl:createUserMappingStatement] > ddl:creatable, ddl:statement,
postgresddl:userMappingOperand mixin
-
-// =============================================================================
-// DROP STATEMENTS
-// =============================================================================
-
-[postgresddl:dropAggregateStatement] > ddl:droppable, ddl:statement,
postgresddl:aggregateOperand mixin
-[postgresddl:dropCastStatement] > ddl:droppable, ddl:statement,
postgresddl:castOperand mixin
-[postgresddl:dropConstraintTriggerStatement] > ddl:droppable, ddl:statement,
postgresddl:constraintTriggerOperand mixin
-[postgresddl:dropConversionStatement] > ddl:droppable, ddl:statement,
postgresddl:conversionOperand mixin
-[postgresddl:dropDatabaseStatement] > ddl:droppable, ddl:statement,
postgresddl:databaseOperand mixin
-[postgresddl:dropForeignDataWrapperStatement] > ddl:droppable, ddl:statement,
postgresddl:foreignDataOperand mixin
-[postgresddl:dropFunctionStatement] > ddl:droppable, ddl:statement,
postgresddl:functionOperand mixin
-[postgresddl:dropGroupStatement] > ddl:droppable, ddl:statement,
postgresddl:groupOperand mixin
-[postgresddl:dropIndexStatement] > ddl:droppable, ddl:statement,
postgresddl:indexOperand mixin
-[postgresddl:dropLanguageStatement] > ddl:droppable, ddl:statement,
postgresddl:languageOperand mixin
-[postgresddl:dropOperatorStatement] > ddl:droppable, ddl:statement,
postgresddl:operatorOperand mixin
-[postgresddl:dropOwnedByStatement] > ddl:droppable, ddl:statement,
postgresddl:ownedByOperand mixin
-[postgresddl:dropRoleStatement] > ddl:droppable, ddl:statement,
postgresddl:roleOperand mixin
-[postgresddl:dropRuleStatement] > ddl:droppable, ddl:statement,
postgresddl:ruleOperand mixin
-[postgresddl:dropSequenceStatement] > ddl:droppable, ddl:statement,
postgresddl:sequenceOperand mixin
-[postgresddl:dropServerStatement] > ddl:droppable, ddl:statement,
postgresddl:serverOperand mixin
-[postgresddl:dropTablespaceStatement] > ddl:droppable, ddl:statement,
postgresddl:tablespaceOperand mixin
-[postgresddl:dropTextSearchStatement] > ddl:droppable, ddl:statement,
postgresddl:textSearchOperand mixin
-[postgresddl:dropTriggerStatement] > ddl:droppable, ddl:statement,
postgresddl:triggerOperand mixin
-[postgresddl:dropTypeStatement] > ddl:droppable, ddl:statement,
postgresddl:typeOperand mixin
-[postgresddl:dropUserStatement] > ddl:droppable, ddl:statement,
postgresddl:userOperand mixin
-[postgresddl:dropUserMappingStatement] > ddl:droppable, ddl:statement,
postgresddl:userMappingOperand mixin
-
-// =============================================================================
-// MISC STATEMENTS
-// =============================================================================
-
-[postgresddl:abortStatement] > ddl:statement mixin
-[postgresddl:analyzeStatement] > ddl:statement mixin
-[postgresddl:clusterStatement] > ddl:statement mixin
-[postgresddl:commentOnStatement] > ddl:statement, postgresddl:commentOperand
mixin
- - postgresddl:targetObjectType (STRING) mandatory
- - postgresddl:targetObjectName (STRING)
- - postgresddl:comment (STRING) mandatory
-[postgresddl:copyStatement] > ddl:statement mixin
-[postgresddl:deallocateStatement] > ddl:statement mixin
-[postgresddl:declareStatement] > ddl:statement mixin
-[postgresddl:discardStatement] > ddl:statement mixin
-[postgresddl:explainStatement] > ddl:statement mixin
-[postgresddl:fetchStatement] > ddl:statement mixin
-[postgresddl:listenStatement] > ddl:statement mixin
-[postgresddl:loadStatement] > ddl:statement mixin
-[postgresddl:lockTableStatement] > ddl:statement mixin
-[postgresddl:moveStatement] > ddl:statement mixin
-[postgresddl:notifyStatement] > ddl:statement mixin
-[postgresddl:prepareStatement] > ddl:statement mixin
-[postgresddl:reassignOwnedStatement] > ddl:statement mixin
-[postgresddl:reindexStatement] > ddl:statement mixin
-[postgresddl:releaseSavepointStatement] > ddl:statement mixin
-[postgresddl:rollbackStatement] > ddl:statement mixin
-[postgresddl:selectIntoStatement] > ddl:statement mixin
-[postgresddl:showStatement] > ddl:statement mixin
-[postgresddl:truncateStatement] > ddl:statement mixin
-[postgresddl:unlistenStatement] > ddl:statement mixin
-[postgresddl:vacuumStatement] > ddl:statement mixin
-
-// =============================================================================
-// GRANT STATEMENTS
-// =============================================================================
-[postgresddl:grantOnTableStatement] > ddl:grantStatement, ddl:tableOperand
mixin
-[postgresddl:grantOnSequenceStatement] > ddl:grantStatement,
postgresddl:sequenceOperand mixin
-[postgresddl:grantOnDatabaseStatement] > ddl:grantStatement,
postgresddl:databaseOperand mixin
-[postgresddl:grantOnForeignDataWrapperStatement] > ddl:grantStatement,
postgresddl:foreignDataOperand mixin
-[postgresddl:grantOnForeignServerStatement] > ddl:grantStatement,
postgresddl:serverOperand mixin
-[postgresddl:grantOnFunctionStatement] > ddl:grantStatement,
postgresddl:functionOperand mixin
- + postgresddl:parameter (postgresddl:functionParameter) = postgresddl:functionParameter
multiple
-[postgresddl:grantOnLanguageStatement] > ddl:grantStatement,
postgresddl:languageOperand mixin
-[postgresddl:grantOnSchemaStatement] > ddl:grantStatement, ddl:schemaOperand
mixin
-[postgresddl:grantOnTablespaceStatement] > ddl:grantStatement,
postgresddl:tablespaceOperand mixin
-[postgresddl:grantRolesStatement] > ddl:grantStatement mixin
- + postgresddl:grantRole (postgresddl:role) = postgresddl:role multiple
Modified:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/StandardDdl.cnd
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/StandardDdl.cnd 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/StandardDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -278,3 +278,18 @@
[ddl:grantOnCollationStatement] > ddl:grantStatement, ddl:collationOperand mixin
[ddl:grantOnCharacterSetStatement] > ddl:grantStatement, ddl:characterSetOperand
mixin
[ddl:grantOnTranslationStatement] > ddl:grantStatement, ddl:translationOperand
mixin
+
+// =============================================================================
+// REVOKE STATEMENTS
+// =============================================================================
+
+[ddl:revokeStatement] > ddl:statement, ddl:revokable, ddl:droppable mixin
+ - ddl:allPrivileges (boolean)
+ + * (ddl:grantPrivilege) = ddl:grantPrivilege multiple
+ + * (ddl:grantee) = ddl:grantee multiple
+
+[ddl:revokeOnTableStatement] > ddl:revokeStatement, ddl:tableOperand mixin
+[ddl:revokeOnDomainStatement] > ddl:revokeStatement, ddl:domainOperand mixin
+[ddl:revokeOnCollationStatement] > ddl:revokeStatement, ddl:collationOperand
mixin
+[ddl:revokeOnCharacterSetStatement] > ddl:revokeStatement, ddl:characterSetOperand
mixin
+[ddl:revokeOnTranslationStatement] > ddl:revokeStatement, ddl:translationOperand
mixin
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/derby_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/derby_test_statements.ddl 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/derby_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,218 +0,0 @@
---
--- SAMPLE DERBY STATEMENTS
---
-
--- Add a new column with a column-level constraint
--- to an existing table
--- An exception will be thrown if the table
--- contains any rows
--- since the newcol will be initialized to NULL
--- in all existing rows in the table
-ALTER TABLE CITIES ADD COLUMN REGION VARCHAR(26)
- CONSTRAINT NEW_CONSTRAINT CHECK (REGION IS NOT NULL);
-
--- Add a new unique constraint to an existing table
--- An exception will be thrown if duplicate keys are found
-ALTER TABLE SAMP.DEPARTMENT
- ADD CONSTRAINT NEW_UNIQUE UNIQUE (DEPTNO);
-
--- add a new foreign key constraint to the
--- Cities table. Each row in Cities is checked
--- to make sure it satisfied the constraints.
--- if any rows don't satisfy the constraint, the
--- constraint is not added
-ALTER TABLE CITIES ADD CONSTRAINT COUNTRY_FK
- Foreign Key (COUNTRY) REFERENCES COUNTRIES (COUNTRY);
-
--- Add a primary key constraint to a table
--- First, create a new table
-CREATE TABLE ACTIVITIES (CITY_ID INT NOT NULL,
- SEASON CHAR(2), ACTIVITY VARCHAR(32) NOT NULL);
--- You will not be able to add this constraint if the
--- columns you are including in the primary key have
--- null data or duplicate values.
-ALTER TABLE Activities ADD PRIMARY KEY (city_id, activity);
-
--- Drop the city_id column if there are no dependent objects:
-ALTER TABLE Cities DROP COLUMN city_id RESTRICT;
--- Drop the city_id column, also dropping all dependent objects:
-ALTER TABLE Cities DROP COLUMN city_id CASCADE;
-
--- Drop a primary key constraint from the CITIES table
-
-ALTER TABLE Cities DROP CONSTRAINT Cities_PK;
--- Drop a foreign key constraint from the CITIES table
-ALTER TABLE Cities DROP CONSTRAINT COUNTRIES_FK;
--- add a DEPTNO column with a default value of 1
-ALTER TABLE SAMP.EMP_ACT ADD COLUMN DEPTNO INT DEFAULT 1;
--- increase the width of a VARCHAR column
-ALTER TABLE SAMP.EMP_PHOTO ALTER PHOTO_FORMAT SET DATA TYPE VARCHAR(30);
--- change the lock granularity of a table
-ALTER TABLE SAMP.SALES LOCKSIZE TABLE;
-
--- Remove the NOT NULL constraint from the MANAGER column
-ALTER TABLE Employees ALTER COLUMN Manager NULL;
--- Add the NOT NULL constraint to the SSN column
-ALTER TABLE Employees ALTER COLUMN ssn NOT NULL;
-
--- Change the default value for the SALARY column
-ALTER TABLE Employees ALTER COLUMN Salary DEFAULT 1000.0;
-ALTER TABLE Employees ALTER COLUMN Salary DROP DEFAULT;
-
-
-CREATE FUNCTION TO_DEGREES
- ( RADIANS DOUBLE )
- RETURNS DOUBLE
- PARAMETER STYLE JAVA
- NO SQL LANGUAGE JAVA
- EXTERNAL NAME 'java.lang.Math.toDegrees';
-
-
-CREATE FUNCTION PROPERTY_FILE_READER
- ( FILENAME VARCHAR( 32672 ) )
- RETURNS TABLE
- (
- KEY_COL VARCHAR( 10 ),
- VALUE_COL VARCHAR( 1000 )
- )
- LANGUAGE JAVA
- PARAMETER STYLE DERBY_JDBC_RESULT_SET
- NO SQL
- EXTERNAL NAME 'vtis.example.PropertyFileVTI.propertyFileVTI';
-
-CREATE INDEX OrigIndex ON Flights(orig_airport);
-
-CREATE INDEX PAY_DESC ON SAMP.EMPLOYEE (SALARY);
-
-CREATE INDEX IXSALE ON SAMP.SALES (SALES);
-
-CREATE PROCEDURE SALES.TOTAL_REVENUE(IN S_MONTH INTEGER,
- IN S_YEAR INTEGER, OUT TOTAL DECIMAL(10,2))
- PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA EXTERNAL NAME
- 'com.acme.sales.calculateRevenueByMonth';
-
-CREATE ROLE purchases_reader;
-
-CREATE ROLE purchases_reader_role;
-
-CREATE SCHEMA FLIGHTS AUTHORIZATION anita;
-
-CREATE SCHEMA EMP;
-
-CREATE SCHEMA AUTHORIZATION takumi;
-
-CREATE SYNONYM SAMP.T1 FOR SAMP.TABLEWITHLONGNAME;
-
-CREATE TABLE HOTELAVAILABILITY
- (HOTEL_ID INT NOT NULL, BOOKING_DATE DATE NOT NULL,
- ROOMS_TAKEN INT DEFAULT 0, PRIMARY KEY (HOTEL_ID, BOOKING_DATE));
-
-CREATE TABLE PEOPLE
- (PERSON_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY
- CONSTRAINT PEOPLE_PK PRIMARY KEY, PERSON VARCHAR(26));
-
-CREATE TABLE greetings
- (i int generated by default as identity (START WITH 2, INCREMENT BY 1), ch char(50));
-
-CREATE TABLE GROUPS
- (GROUP_ID SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY
- (START WITH 5, INCREMENT BY 5), ADDRESS VARCHAR(100), PHONE VARCHAR(15));
-
-CREATE TRIGGER t1 NO CASCADE BEFORE UPDATE ON x
- FOR EACH ROW MODE DB2SQL
- values app.notifyEmail('Jerry', 'Table x is about to be updated');
-
-
-CREATE TRIGGER FLIGHTSDELETE
- AFTER DELETE ON FLIGHTS
- REFERENCING OLD_TABLE AS DELETEDFLIGHTS
- FOR EACH STATEMENT
- DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID IN
- (SELECT FLIGHT_ID FROM DELETEDFLIGHTS);
-
-CREATE TRIGGER FLIGHTSDELETE3
- AFTER DELETE ON FLIGHTS
- REFERENCING OLD AS OLD
- FOR EACH ROW
- DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID = OLD.FLIGHT_ID;
-
-
-
-CREATE VIEW SAMP.V1 (COL_SUM, COL_DIFF)
- AS SELECT COMM + BONUS, COMM - BONUS
- FROM SAMP.EMPLOYEE;
-
-CREATE VIEW SAMP.VEMP_RES (RESUME)
- AS VALUES 'Delores M. Quintana', 'Heather A. Nicholls', 'Bruce
Adamson';
-
-CREATE VIEW SAMP.PROJ_COMBO
- (PROJNO, PRENDATE, PRSTAFF, MAJPROJ)
- AS SELECT PROJNO, PRENDATE, PRSTAFF, MAJPROJ
- FROM SAMP.PROJECT UNION ALL
- SELECT PROJNO, EMSTDATE, EMPTIME, EMPNO
- FROM SAMP.EMP_ACT
- WHERE EMPNO IS NOT NULL;
-
-CREATE VIEW V1 (C1) AS SELECT SIN(C1) FROM T1;
-
-declare global temporary table SESSION.t1(c11 int) not logged;
--- The SESSION qualification is redundant here because temporary
--- tables can only exist in the SESSION schema.
-
-declare global temporary table t2(c21 int) not logged;
--- The temporary table is not qualified here with SESSION because temporary
--- tables can only exist in the SESSION schema.
-
-DROP FUNCTION some_function_name;
-
-DROP INDEX OrigIndex;
-
-DROP INDEX DestIndex;
-
-DROP PROCEDURE some_procedure_name;
-
-DROP ROLE reader;
-
--- The RESTRICT keyword is required
-DROP SCHEMA SAMP RESTRICT;
-
-DROP SYNONYM some_synonym_name;
-
-DROP TABLE some_table_name;
-
-DROP TRIGGER TRIG1;
-
-DROP VIEW AnIdentifier;
-
-GRANT SELECT ON TABLE t TO maria,harry;
-
-GRANT UPDATE, TRIGGER ON TABLE t TO anita,zhi;
-
-GRANT SELECT ON TABLE s.v to PUBLIC;
-
-GRANT EXECUTE ON PROCEDURE p TO george;
-
-GRANT purchases_reader_role TO george,maria;
-
-GRANT SELECT ON TABLE t TO purchases_reader_role;
-
-INSERT INTO COUNTRIES
- VALUES ('Taiwan', 'TW', 'Asia');
-
-INSERT INTO MA_EMP_ACT
- SELECT * FROM EMP_ACT
- WHERE SUBSTR(PROJNO, 1, 2) = 'MA';
-
--- Insert the DEFAULT value for the LOCATION column
-INSERT INTO DEPARTMENT
- VALUES ('E31', 'ARCHITECTURE', '00390', 'E01',
DEFAULT);
-
-LOCK TABLE FlightAvailability IN EXCLUSIVE MODE;
-
-LOCK TABLE Maps IN EXCLUSIVE MODE;
-
-RENAME INDEX DESTINDEX TO ARRIVALINDEX;
-
-RENAME TABLE SAMP.EMP_ACT TO EMPLOYEE_ACT;
-
-
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdl.cnd
(from rev 1528,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/DerbyDdl.cnd)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdl.cnd
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,102 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+ //------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<ddl='http://www.jboss.org/dna/ddl/1.0'>
+<derbyddl='http://www.jboss.org/dna/ddl/derby/1.0'>
+
+// =============================================================================
+// OPERANDS
+// =============================================================================
+[derbyddl:functionOperand] > ddl:operand abstract
+[derbyddl:indexOperand] > ddl:operand abstract
+[derbyddl:procedureOperand] > ddl:operand abstract
+[derbyddl:roleOperand] > ddl:operand abstract
+[derbyddl:synonymOperand] > ddl:operand abstract
+[derbyddl:triggerOperand] > ddl:operand abstract
+
+[derbyddl:roleName] > derbyddl:roleOperand mixin
+
+// =============================================================================
+// COLUMN
+// =============================================================================
+[derbyddl:columnDefinition] > ddl:columnDefinition mixin
+ - derbyddl:dropDefault (boolean)
+
+[derbyddl:functionParameter] > ddl:columnDefinition mixin
+
+[derbyddl:indexColumnReference] > ddl:columnReference mixin
+ - derbyddl:order (STRING)
+
+// =============================================================================
+// CREATE STATEMENTS
+// =============================================================================
+[derbyddl:createFunctionStatement] > ddl:creatable, ddl:statement,
derbyddl:functionOperand mixin
+ - ddl:datatypeName (STRING) mandatory
+ - ddl:datatypeLength (LONG)
+ - ddl:datatypePrecision (LONG)
+ - ddl:datatypeScale (LONG)
+ - ddl:isTableType (boolean)
+ + * (derbyddl:functionParameter) = derbyddl:functionParameter multiple
+ + * (ddl:statementOption) = ddl:statementOption multiple
+[derbyddl:createIndexStatement] > ddl:statement, ddl:creatable,
derbyddl:indexOperand mixin
+ - derbyddl:tableName (string) mandatory
+ - derbyddl:unique (boolean)
+ + * (derbyddl:indexColumnReference) = derbyddl:indexColumnReference multiple
+[derbyddl:createProcedureStatement] > ddl:creatable, ddl:statement,
derbyddl:procedureOperand mixin
+[derbyddl:createRoleStatement] > ddl:creatable, ddl:statement,
derbyddl:roleOperand mixin
+[derbyddl:createSynonymStatement] > ddl:creatable, ddl:statement,
derbyddl:synonymOperand mixin
+ - derbyddl:tableName (string) mandatory
+[derbyddl:createTriggerStatement] > ddl:creatable, ddl:statement,
derbyddl:triggerOperand mixin
+ - derbyddl:tableName (string) mandatory
+ - ddl:sql (string) mandatory
+ + * (ddl:columnReference) = ddl:columnreference multiple
+[derbyddl:declareGlobalTemporaryTableStatement] > ddl:createTableStatement mixin
+
+// =============================================================================
+// DROP STATEMENTS
+// =============================================================================
+[derbyddl:dropFunctionStatement] > ddl:droppable, derbyddl:functionOperand mixin
+[derbyddl:dropIndexStatement] > ddl:droppable, derbyddl:indexOperand mixin
+[derbyddl:dropProcedureStatement] > ddl:droppable, derbyddl:procedureOperand mixin
+[derbyddl:dropRoleStatement] > ddl:droppable, derbyddl:roleOperand mixin
+[derbyddl:dropSynonymStatement] > ddl:droppable, derbyddl:synonymOperand mixin
+[derbyddl:dropTriggerStatement] > ddl:droppable, derbyddl:triggerOperand mixin
+
+// =============================================================================
+// MISC STATEMENTS
+// =============================================================================
+[derbyddl:lockTableStatement] > ddl:statement, ddl:tableOperand mixin
+[derbyddl:renameTableStatement] > ddl:statement, ddl:renamable, ddl:tableOperand
mixin
+
+[derbyddl:grantOnFunctionStatement] > ddl:grantStatement, derbyddl:functionOperand
mixin
+[derbyddl:grantOnProcedureStatement] > ddl:grantStatement,
derbyddl:procedureOperand mixin
+
+[derbyddl:grantRolesStatement] > ddl:grantStatement mixin
+ + ddl:name (derbyddl:roleName) = derbyddl:roleName multiple
\ No newline at end of file
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/DerbyDdl.cnd
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/derby_test_statements.ddl
(from rev 1494,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/derby_test_statements.ddl)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/derby_test_statements.ddl
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/derby_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,218 @@
+--
+-- SAMPLE DERBY STATEMENTS
+--
+
+-- Add a new column with a column-level constraint
+-- to an existing table
+-- An exception will be thrown if the table
+-- contains any rows
+-- since the newcol will be initialized to NULL
+-- in all existing rows in the table
+ALTER TABLE CITIES ADD COLUMN REGION VARCHAR(26)
+ CONSTRAINT NEW_CONSTRAINT CHECK (REGION IS NOT NULL);
+
+-- Add a new unique constraint to an existing table
+-- An exception will be thrown if duplicate keys are found
+ALTER TABLE SAMP.DEPARTMENT
+ ADD CONSTRAINT NEW_UNIQUE UNIQUE (DEPTNO);
+
+-- add a new foreign key constraint to the
+-- Cities table. Each row in Cities is checked
+-- to make sure it satisfied the constraints.
+-- if any rows don't satisfy the constraint, the
+-- constraint is not added
+ALTER TABLE CITIES ADD CONSTRAINT COUNTRY_FK
+ Foreign Key (COUNTRY) REFERENCES COUNTRIES (COUNTRY);
+
+-- Add a primary key constraint to a table
+-- First, create a new table
+CREATE TABLE ACTIVITIES (CITY_ID INT NOT NULL,
+ SEASON CHAR(2), ACTIVITY VARCHAR(32) NOT NULL);
+-- You will not be able to add this constraint if the
+-- columns you are including in the primary key have
+-- null data or duplicate values.
+ALTER TABLE Activities ADD PRIMARY KEY (city_id, activity);
+
+-- Drop the city_id column if there are no dependent objects:
+ALTER TABLE Cities DROP COLUMN city_id RESTRICT;
+-- Drop the city_id column, also dropping all dependent objects:
+ALTER TABLE Cities DROP COLUMN city_id CASCADE;
+
+-- Drop a primary key constraint from the CITIES table
+
+ALTER TABLE Cities DROP CONSTRAINT Cities_PK;
+-- Drop a foreign key constraint from the CITIES table
+ALTER TABLE Cities DROP CONSTRAINT COUNTRIES_FK;
+-- add a DEPTNO column with a default value of 1
+ALTER TABLE SAMP.EMP_ACT ADD COLUMN DEPTNO INT DEFAULT 1;
+-- increase the width of a VARCHAR column
+ALTER TABLE SAMP.EMP_PHOTO ALTER PHOTO_FORMAT SET DATA TYPE VARCHAR(30);
+-- change the lock granularity of a table
+ALTER TABLE SAMP.SALES LOCKSIZE TABLE;
+
+-- Remove the NOT NULL constraint from the MANAGER column
+ALTER TABLE Employees ALTER COLUMN Manager NULL;
+-- Add the NOT NULL constraint to the SSN column
+ALTER TABLE Employees ALTER COLUMN ssn NOT NULL;
+
+-- Change the default value for the SALARY column
+ALTER TABLE Employees ALTER COLUMN Salary DEFAULT 1000.0;
+ALTER TABLE Employees ALTER COLUMN Salary DROP DEFAULT;
+
+
+CREATE FUNCTION TO_DEGREES
+ ( RADIANS DOUBLE )
+ RETURNS DOUBLE
+ PARAMETER STYLE JAVA
+ NO SQL LANGUAGE JAVA
+ EXTERNAL NAME 'java.lang.Math.toDegrees';
+
+
+CREATE FUNCTION PROPERTY_FILE_READER
+ ( FILENAME VARCHAR( 32672 ) )
+ RETURNS TABLE
+ (
+ KEY_COL VARCHAR( 10 ),
+ VALUE_COL VARCHAR( 1000 )
+ )
+ LANGUAGE JAVA
+ PARAMETER STYLE DERBY_JDBC_RESULT_SET
+ NO SQL
+ EXTERNAL NAME 'vtis.example.PropertyFileVTI.propertyFileVTI';
+
+CREATE INDEX OrigIndex ON Flights(orig_airport);
+
+CREATE INDEX PAY_DESC ON SAMP.EMPLOYEE (SALARY);
+
+CREATE INDEX IXSALE ON SAMP.SALES (SALES);
+
+CREATE PROCEDURE SALES.TOTAL_REVENUE(IN S_MONTH INTEGER,
+ IN S_YEAR INTEGER, OUT TOTAL DECIMAL(10,2))
+ PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA EXTERNAL NAME
+ 'com.acme.sales.calculateRevenueByMonth';
+
+CREATE ROLE purchases_reader;
+
+CREATE ROLE purchases_reader_role;
+
+CREATE SCHEMA FLIGHTS AUTHORIZATION anita;
+
+CREATE SCHEMA EMP;
+
+CREATE SCHEMA AUTHORIZATION takumi;
+
+CREATE SYNONYM SAMP.T1 FOR SAMP.TABLEWITHLONGNAME;
+
+CREATE TABLE HOTELAVAILABILITY
+ (HOTEL_ID INT NOT NULL, BOOKING_DATE DATE NOT NULL,
+ ROOMS_TAKEN INT DEFAULT 0, PRIMARY KEY (HOTEL_ID, BOOKING_DATE));
+
+CREATE TABLE PEOPLE
+ (PERSON_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY
+ CONSTRAINT PEOPLE_PK PRIMARY KEY, PERSON VARCHAR(26));
+
+CREATE TABLE greetings
+ (i int generated by default as identity (START WITH 2, INCREMENT BY 1), ch char(50));
+
+CREATE TABLE GROUPS
+ (GROUP_ID SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY
+ (START WITH 5, INCREMENT BY 5), ADDRESS VARCHAR(100), PHONE VARCHAR(15));
+
+CREATE TRIGGER t1 NO CASCADE BEFORE UPDATE ON x
+ FOR EACH ROW MODE DB2SQL
+ values app.notifyEmail('Jerry', 'Table x is about to be updated');
+
+
+CREATE TRIGGER FLIGHTSDELETE
+ AFTER DELETE ON FLIGHTS
+ REFERENCING OLD_TABLE AS DELETEDFLIGHTS
+ FOR EACH STATEMENT
+ DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID IN
+ (SELECT FLIGHT_ID FROM DELETEDFLIGHTS);
+
+CREATE TRIGGER FLIGHTSDELETE3
+ AFTER DELETE ON FLIGHTS
+ REFERENCING OLD AS OLD
+ FOR EACH ROW
+ DELETE FROM FLIGHTAVAILABILITY WHERE FLIGHT_ID = OLD.FLIGHT_ID;
+
+
+
+CREATE VIEW SAMP.V1 (COL_SUM, COL_DIFF)
+ AS SELECT COMM + BONUS, COMM - BONUS
+ FROM SAMP.EMPLOYEE;
+
+CREATE VIEW SAMP.VEMP_RES (RESUME)
+ AS VALUES 'Delores M. Quintana', 'Heather A. Nicholls', 'Bruce
Adamson';
+
+CREATE VIEW SAMP.PROJ_COMBO
+ (PROJNO, PRENDATE, PRSTAFF, MAJPROJ)
+ AS SELECT PROJNO, PRENDATE, PRSTAFF, MAJPROJ
+ FROM SAMP.PROJECT UNION ALL
+ SELECT PROJNO, EMSTDATE, EMPTIME, EMPNO
+ FROM SAMP.EMP_ACT
+ WHERE EMPNO IS NOT NULL;
+
+CREATE VIEW V1 (C1) AS SELECT SIN(C1) FROM T1;
+
+declare global temporary table SESSION.t1(c11 int) not logged;
+-- The SESSION qualification is redundant here because temporary
+-- tables can only exist in the SESSION schema.
+
+declare global temporary table t2(c21 int) not logged;
+-- The temporary table is not qualified here with SESSION because temporary
+-- tables can only exist in the SESSION schema.
+
+DROP FUNCTION some_function_name;
+
+DROP INDEX OrigIndex;
+
+DROP INDEX DestIndex;
+
+DROP PROCEDURE some_procedure_name;
+
+DROP ROLE reader;
+
+-- The RESTRICT keyword is required
+DROP SCHEMA SAMP RESTRICT;
+
+DROP SYNONYM some_synonym_name;
+
+DROP TABLE some_table_name;
+
+DROP TRIGGER TRIG1;
+
+DROP VIEW AnIdentifier;
+
+GRANT SELECT ON TABLE t TO maria,harry;
+
+GRANT UPDATE, TRIGGER ON TABLE t TO anita,zhi;
+
+GRANT SELECT ON TABLE s.v to PUBLIC;
+
+GRANT EXECUTE ON PROCEDURE p TO george;
+
+GRANT purchases_reader_role TO george,maria;
+
+GRANT SELECT ON TABLE t TO purchases_reader_role;
+
+INSERT INTO COUNTRIES
+ VALUES ('Taiwan', 'TW', 'Asia');
+
+INSERT INTO MA_EMP_ACT
+ SELECT * FROM EMP_ACT
+ WHERE SUBSTR(PROJNO, 1, 2) = 'MA';
+
+-- Insert the DEFAULT value for the LOCATION column
+INSERT INTO DEPARTMENT
+ VALUES ('E31', 'ARCHITECTURE', '00390', 'E01',
DEFAULT);
+
+LOCK TABLE FlightAvailability IN EXCLUSIVE MODE;
+
+LOCK TABLE Maps IN EXCLUSIVE MODE;
+
+RENAME INDEX DESTINDEX TO ARRIVALINDEX;
+
+RENAME TABLE SAMP.EMP_ACT TO EMPLOYEE_ACT;
+
+
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/derby/derby_test_statements.ddl
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdl.cnd
(from rev 1494,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/OracleDdl.cnd)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdl.cnd
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,202 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+ //------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<ddl='http://www.jboss.org/dna/ddl/1.0'>
+<oracleddl='http://www.jboss.org/dna/ddl/oracle/1.0'>
+
+// =============================================================================
+// OPERANDS
+// =============================================================================
+[oracleddl:clusterOperand] > ddl:operand abstract
+[oracleddl:commentOperand] > ddl:operand abstract
+[oracleddl:contextOperand] > ddl:operand abstract
+[oracleddl:controlfileOperand] > ddl:operand abstract
+[oracleddl:databaseOperand] > ddl:operand abstract
+[oracleddl:dimensionOperand] > ddl:operand abstract
+[oracleddl:directoryOperand] > ddl:operand abstract
+[oracleddl:diskgroupOperand] > ddl:operand abstract
+[oracleddl:functionOperand] > ddl:operand abstract
+[oracleddl:indexOperand] > ddl:operand abstract
+[oracleddl:indextypeOperand] > ddl:operand abstract
+[oracleddl:javaOperand] > ddl:operand abstract
+[oracleddl:libraryOperand] > ddl:operand abstract
+[oracleddl:materializedOperand] > ddl:operand abstract
+[oracleddl:operatorOperand] > ddl:operand abstract
+[oracleddl:outlineOperand] > ddl:operand abstract
+[oracleddl:packageOperand] > ddl:operand abstract
+[oracleddl:pfileOperand] > ddl:operand abstract
+[oracleddl:procedureOperand] > ddl:operand abstract
+[oracleddl:profileOperand] > ddl:operand abstract
+[oracleddl:resourceOperand] > ddl:operand abstract
+[oracleddl:roleOperand] > ddl:operand abstract
+[oracleddl:rollbackOperand] > ddl:operand abstract
+[oracleddl:sequenceOperand] > ddl:operand abstract
+[oracleddl:sessionOperand] > ddl:operand abstract
+[oracleddl:spfileOperand] > ddl:operand abstract
+[oracleddl:systemOperand] > ddl:operand abstract
+[oracleddl:synonymOperand] > ddl:operand abstract
+[oracleddl:tablespaceOperand] > ddl:operand abstract
+[oracleddl:triggerOperand] > ddl:operand abstract
+[oracleddl:typeOperand] > ddl:operand abstract
+[oracleddl:userOperand] > ddl:operand abstract
+
+// =============================================================================
+// COLUMN
+// =============================================================================
+[oracleddl:columnDefinition] > ddl:columnDefinition
+ - oracleddl:dropDefault (boolean)
+
+// =============================================================================
+// ALTER STATEMENTS
+// =============================================================================
+[oracleddl:alterClusterStatement] > ddl:alterable, ddl:statement,
oracleddl:clusterOperand mixin
+[oracleddl:alterDatabaseStatement] > ddl:alterable, ddl:statement,
oracleddl:databaseOperand mixin
+[oracleddl:alterDimensionStatement] > ddl:alterable, ddl:statement,
oracleddl:dimensionOperand mixin
+[oracleddl:alterDiskgroupStatement] > ddl:alterable, ddl:statement,
oracleddl:diskgroupOperand mixin
+[oracleddl:alterFunctionStatement] > ddl:alterable, ddl:statement,
oracleddl:functionOperand mixin
+[oracleddl:alterIndexStatement] > ddl:alterable, ddl:statement,
oracleddl:indexOperand mixin
+[oracleddl:alterIndextypeStatement] > ddl:alterable, ddl:statement,
oracleddl:indextypeOperand mixin
+[oracleddl:alterJavaStatement] > ddl:alterable, ddl:statement,
oracleddl:javaOperand mixin
+[oracleddl:alterMaterializedStatement] > ddl:alterable, ddl:statement,
oracleddl:materializedOperand mixin
+[oracleddl:alterOperatorStatement] > ddl:alterable, ddl:statement,
oracleddl:operatorOperand mixin
+[oracleddl:alterOutlineStatement] > ddl:alterable, ddl:statement,
oracleddl:outlineOperand mixin
+[oracleddl:alterPackageStatement] > ddl:alterable, ddl:statement,
oracleddl:packageOperand mixin
+[oracleddl:alterProcedureStatement] > ddl:alterable, ddl:statement,
oracleddl:procedureOperand mixin
+[oracleddl:alterProfileStatement] > ddl:alterable, ddl:statement,
oracleddl:profileOperand mixin
+[oracleddl:alterResourceStatement] > ddl:alterable, ddl:statement,
oracleddl:resourceOperand mixin
+[oracleddl:alterRoleStatement] > ddl:alterable, ddl:statement,
oracleddl:roleOperand mixin
+[oracleddl:alterRollbackStatement] > ddl:alterable, ddl:statement,
oracleddl:rollbackOperand mixin
+[oracleddl:alterSequenceStatement] > ddl:alterable, ddl:statement,
oracleddl:sequenceOperand mixin
+[oracleddl:alterSessionStatement] > ddl:alterable, ddl:statement,
oracleddl:sessionOperand mixin
+[oracleddl:alterSystemStatement] > ddl:alterable, ddl:statement,
oracleddl:systemOperand mixin
+[oracleddl:alterTablespaceStatement] > ddl:alterable, ddl:statement,
oracleddl:tablespaceOperand mixin
+[oracleddl:alterTriggerStatement] > ddl:alterable, ddl:statement,
oracleddl:triggerOperand mixin
+[oracleddl:alterTypeStatement] > ddl:alterable, ddl:statement,
oracleddl:typeOperand mixin
+[oracleddl:alterUserStatement] > ddl:alterable, ddl:statement,
oracleddl:userOperand mixin
+[oracleddl:alterViewStatement] > ddl:alterable, ddl:statement,
ddl:viewOperand mixin
+
+[oracleddl:alterTableStatement] > ddl:alterTableStatement mixin
+ - oracleddl:newTableName (STRING)
+ + oracleddl:renameColumn (ddl:renamable) = ddl:renamable multiple
+ + oracleddl:renameConstraint (ddl:renamable) = ddl:renamable multiple
+
+// =============================================================================
+// CREATE STATEMENTS
+// =============================================================================
+
+[oracleddl:createClusterStatement] > ddl:creatable, ddl:statement,
oracleddl:clusterOperand mixin
+[oracleddl:createContextStatement] > ddl:creatable, ddl:statement,
oracleddl:contextOperand mixin
+[oracleddl:createControlfileStatement] > ddl:creatable, ddl:statement,
oracleddl:controlfileOperand mixin
+[oracleddl:createDatabaseStatement] > ddl:creatable, ddl:statement,
oracleddl:databaseOperand mixin
+[oracleddl:createDimensionStatement] > ddl:creatable, ddl:statement,
oracleddl:dimensionOperand mixin
+[oracleddl:createDirectoryStatement] > ddl:creatable, ddl:statement,
oracleddl:directoryOperand mixin
+[oracleddl:createDiskgroupStatement] > ddl:creatable, ddl:statement,
oracleddl:diskgroupOperand mixin
+[oracleddl:createFunctionStatement] > ddl:creatable, ddl:statement,
oracleddl:functionOperand mixin
+[oracleddl:createIndexStatement] > ddl:creatable, ddl:statement,
oracleddl:indexOperand mixin
+ - oracleddl:tableName (string) mandatory
+ - oracleddl:unique (boolean)
+ - oracleddl:bitmap (boolean)
+ + * (ddl:columnReference) = ddl:columnReference multiple
+[oracleddl:createIndexTypeStatement] > ddl:creatable, ddl:statement,
oracleddl:indextypeOperand mixin
+[oracleddl:createJavaStatement] > ddl:creatable, ddl:statement,
oracleddl:javaOperand mixin
+[oracleddl:createLibraryStatement] > ddl:creatable, ddl:statement,
oracleddl:libraryOperand mixin
+[oracleddl:createMaterializedStatement] > ddl:creatable, ddl:statement,
oracleddl:materializedOperand mixin
+[oracleddl:createOperatorStatement] > ddl:creatable, ddl:statement,
oracleddl:operatorOperand mixin
+[oracleddl:createOutlineStatement] > ddl:creatable, ddl:statement,
oracleddl:outlineOperand mixin
+[oracleddl:createPackageStatement] > ddl:creatable, ddl:statement,
oracleddl:packageOperand mixin
+[oracleddl:createPfileStatement] > ddl:creatable, ddl:statement,
oracleddl:pfileOperand mixin
+[oracleddl:createProcedureStatement] > ddl:creatable, ddl:statement,
oracleddl:procedureOperand mixin
+[oracleddl:createRoleStatement] > ddl:creatable, ddl:statement,
oracleddl:roleOperand mixin
+[oracleddl:createRollbackStatement] > ddl:creatable, ddl:statement,
oracleddl:rollbackOperand mixin
+[oracleddl:createSequenceStatement] > ddl:creatable, ddl:statement,
oracleddl:sequenceOperand mixin
+[oracleddl:createSpfileStatement] > ddl:creatable, ddl:statement,
oracleddl:spfileOperand mixin
+[oracleddl:createSynonymStatement] > ddl:creatable, ddl:statement,
oracleddl:synonymOperand mixin
+[oracleddl:createTablespaceStatement] > ddl:creatable, ddl:statement,
oracleddl:tablespaceOperand mixin
+[oracleddl:createTriggerStatement] > ddl:creatable, ddl:statement,
oracleddl:triggerOperand mixin
+[oracleddl:createTypeStatement] > ddl:creatable, ddl:statement,
oracleddl:typeOperand mixin
+[oracleddl:createUserStatement] > ddl:creatable, ddl:statement,
oracleddl:userOperand mixin
+
+// =============================================================================
+// DROP STATEMENTS
+// =============================================================================
+
+[oracleddl:dropClusterStatement] > ddl:droppable, ddl:statement,
oracleddl:clusterOperand mixin
+[oracleddl:dropContextStatement] > ddl:droppable, ddl:statement,
oracleddl:contextOperand mixin
+[oracleddl:dropDatabaseStatement] > ddl:droppable, ddl:statement,
oracleddl:databaseOperand mixin
+[oracleddl:dropDimensionStatement] > ddl:droppable, ddl:statement,
oracleddl:dimensionOperand mixin
+[oracleddl:dropDirectoryStatement] > ddl:droppable, ddl:statement,
oracleddl:directoryOperand mixin
+[oracleddl:dropDiskgroupStatement] > ddl:droppable, ddl:statement,
oracleddl:diskgroupOperand mixin
+[oracleddl:dropFunctionStatement] > ddl:droppable, ddl:statement,
oracleddl:functionOperand mixin
+[oracleddl:dropIndexStatement] > ddl:droppable, ddl:statement,
oracleddl:indexOperand mixin
+[oracleddl:dropIndextypeStatement] > ddl:droppable, ddl:statement,
oracleddl:indextypeOperand mixin
+[oracleddl:dropJavaStatement] > ddl:droppable, ddl:statement,
oracleddl:javaOperand mixin
+[oracleddl:dropLibraryStatement] > ddl:droppable, ddl:statement,
oracleddl:libraryOperand mixin
+[oracleddl:dropMaterializedStatement] > ddl:droppable, ddl:statement,
oracleddl:materializedOperand mixin
+[oracleddl:dropOperatorStatement] > ddl:droppable, ddl:statement,
oracleddl:operatorOperand mixin
+[oracleddl:dropOutlineStatement] > ddl:droppable, ddl:statement,
oracleddl:outlineOperand mixin
+[oracleddl:dropPackageStatement] > ddl:droppable, ddl:statement,
oracleddl:packageOperand mixin
+[oracleddl:dropProcedureStatement] > ddl:droppable, ddl:statement,
oracleddl:procedureOperand mixin
+[oracleddl:dropProfileStatement] > ddl:droppable, ddl:statement,
oracleddl:profileOperand mixin
+[oracleddl:dropRoleStatement] > ddl:droppable, ddl:statement,
oracleddl:roleOperand mixin
+[oracleddl:dropRollbackStatement] > ddl:droppable, ddl:statement,
oracleddl:rollbackOperand mixin
+[oracleddl:dropSequenceStatement] > ddl:droppable, ddl:statement,
oracleddl:sequenceOperand mixin
+[oracleddl:dropSynonymStatement] > ddl:droppable, ddl:statement,
oracleddl:synonymOperand mixin
+[oracleddl:dropTablespaceStatement] > ddl:droppable, ddl:statement,
oracleddl:tablespaceOperand mixin
+[oracleddl:dropTriggerStatement] > ddl:droppable, ddl:statement,
oracleddl:triggerOperand mixin
+[oracleddl:dropTypeStatement] > ddl:droppable, ddl:statement,
oracleddl:typeOperand mixin
+[oracleddl:dropUserStatement] > ddl:droppable, ddl:statement,
oracleddl:userOperand mixin
+
+// =============================================================================
+// MISC STATEMENTS
+// =============================================================================
+
+[oracleddl:analyzeStatement] > ddl:statement mixin
+[oracleddl:associateStatisticsStatement] > ddl:statement mixin
+[oracleddl:auditStatement] > ddl:statement mixin
+[oracleddl:commitStatement] > ddl:statement mixin
+[oracleddl:commentOnStatement] > ddl:statement, oracleddl:commentOperand mixin
+ - oracleddl:targetObjectType (STRING) mandatory
+ - oracleddl:targetObjectName (STRING)
+ - oracleddl:comment (STRING) mandatory
+[oracleddl:disassociateStatisticsStatement] > ddl:statement mixin
+[oracleddl:explainPlanStatement] > ddl:statement mixin
+[oracleddl:flashbackStatement] > ddl:statement mixin
+[oracleddl:lockTableStatement] > ddl:statement mixin
+[oracleddl:mergeStatement] > ddl:statement mixin
+[oracleddl:nestedTableStatement] > ddl:statement mixin
+[oracleddl:noauditStatement] > ddl:statement mixin
+[oracleddl:purgeStatement] > ddl:statement mixin
+[oracleddl:renameStatement] > ddl:statement mixin
+[oracleddl:revokeStatement] > ddl:statement mixin
+[oracleddl:rollbackStatement] > ddl:statement mixin
+[oracleddl:setConstraintsStatement] > ddl:statement, ddl:settable mixin
+[oracleddl:setRoleStatement] > ddl:statement, ddl:settable mixin
+[oracleddl:setTransactionStatement] > ddl:statement, ddl:settable mixin
+[oracleddl:truncateStatement] > ddl:statement mixin
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/OracleDdl.cnd
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/oracle_test_statements.ddl
(from rev 1494,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/oracle_test_statements.ddl)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/oracle_test_statements.ddl
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/oracle_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,234 @@
+--
+-- SAMPLE ORACLE STATEMENTS
+--
+
+ALTER TABLE employees
+ PCTFREE 30
+ PCTUSED 60;
+
+ALTER TABLE countries
+ ADD (duty_pct NUMBER(2,2) CHECK (duty_pct < 10.5),
+ visa_needed VARCHAR2(3));
+
+ALTER TABLESPACE tbs_01
+ BEGIN BACKUP;
+
+ALTER TABLESPACE omf_ts1 ADD DATAFILE;
+
+ALTER TABLESPACE undots1
+ RETENTION NOGUARANTEE;
+
+ALTER TRIGGER update_job_history DISABLE;
+
+ALTER TYPE data_typ
+ ADD MEMBER FUNCTION qtr(der_qtr DATE)
+ RETURN CHAR CASCADE;
+
+ALTER TYPE cust_address_typ
+ ADD ATTRIBUTE (phone phone_list_typ) CASCADE;
+
+ALTER TYPE phone_list_typ
+ MODIFY ELEMENT TYPE VARCHAR(64) CASCADE;
+
+ALTER USER app_user1
+ GRANT CONNECT THROUGH sh
+ WITH ROLE warehouse_user;
+
+-- 10 Statements
+
+ALTER USER app_user1 IDENTIFIED GLOBALLY AS 'CN=tom,O=oracle,C=US';
+
+ALTER USER sidney
+ IDENTIFIED BY second_2nd_pwd
+ DEFAULT TABLESPACE example;
+
+ALTER VIEW customer_ro
+ COMPILE;
+
+ANALYZE TABLE customers VALIDATE STRUCTURE ONLINE;
+
+ANALYZE TABLE employees VALIDATE STRUCTURE CASCADE;
+
+ANALYZE TABLE orders DELETE STATISTICS;
+
+ASSOCIATE STATISTICS WITH PACKAGES emp_mgmt DEFAULT SELECTIVITY 10;
+
+AUDIT SELECT
+ ON hr.employees
+ WHENEVER SUCCESSFUL;
+
+AUDIT INSERT, UPDATE
+ ON oe.customers;
+
+AUDIT DELETE ANY TABLE;
+
+-- 20 Statements
+
+AUDIT ROLE
+ WHENEVER SUCCESSFUL;
+
+COMMENT ON COLUMN employees.job_id
+ IS 'abbreviated job title';
+
+COMMIT WORK;
+
+COMMIT COMMENT 'In-doubt transaction Code 36, Call (415) 555-2637';
+
+CREATE CLUSTER personnel
+ (department NUMBER(4))
+SIZE 512
+STORAGE (initial 100K next 50K);
+
+CREATE CLUSTER address
+ (postal_code NUMBER, country_id CHAR(2))
+ HASHKEYS 20
+ HASH IS MOD(postal_code + country_id, 101);
+
+CREATE CLUSTER cust_orders (customer_id NUMBER(6))
+ SIZE 512 SINGLE TABLE HASHKEYS 100;
+
+CREATE CONTEXT hr_context USING emp_mgmt;
+
+CREATE CONTROLFILE REUSE DATABASE "demo" NORESETLOGS NOARCHIVELOG
+ MAXLOGFILES 32
+ MAXLOGMEMBERS 2
+ MAXDATAFILES 32
+ MAXINSTANCES 1
+ MAXLOGHISTORY 449
+ LOGFILE
+ GROUP 1 '/path/oracle/dbs/t_log1.f' SIZE 500K,
+ GROUP 2 '/path/oracle/dbs/t_log2.f' SIZE 500K
+ # STANDBY LOGFILE
+ DATAFILE
+ '/path/oracle/dbs/t_db1.f',
+ '/path/oracle/dbs/dbu19i.dbf',
+ '/path/oracle/dbs/tbs_11.f',
+ '/path/oracle/dbs/smundo.dbf',
+ '/path/oracle/dbs/demo.dbf'
+ CHARACTER SET WE8DEC
+ ;
+
+CREATE DATABASE sample
+ CONTROLFILE REUSE
+ LOGFILE
+ GROUP 1 ('diskx:log1.log', 'disky:log1.log') SIZE 50K,
+ GROUP 2 ('diskx:log2.log', 'disky:log2.log') SIZE 50K
+ MAXLOGFILES 5
+ MAXLOGHISTORY 100
+ MAXDATAFILES 10
+ MAXINSTANCES 2
+ ARCHIVELOG
+ CHARACTER SET AL32UTF8
+ NATIONAL CHARACTER SET AL16UTF16
+ DATAFILE
+ 'disk1:df1.dbf' AUTOEXTEND ON,
+ 'disk2:df2.dbf' AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
+ DEFAULT TEMPORARY TABLESPACE temp_ts
+ UNDO TABLESPACE undo_ts
+ SET TIME_ZONE = '+02:00';
+
+-- 30 Statements
+
+CREATE PUBLIC DATABASE LINK remote
+ USING 'remote';
+
+CREATE DATABASE LINK local
+ CONNECT TO hr IDENTIFIED BY hr
+ USING 'local';
+
+CREATE DIMENSION customers_dim
+ LEVEL customer IS (customers.cust_id)
+ LEVEL city IS (customers.cust_city)
+ LEVEL state IS (customers.cust_state_province)
+ LEVEL country IS (countries.country_id)
+ LEVEL subregion IS (countries.country_subregion)
+ LEVEL region IS (countries.country_region)
+ HIERARCHY geog_rollup (
+ customer CHILD OF
+ city CHILD OF
+ state CHILD OF
+ country CHILD OF
+ subregion CHILD OF
+ region
+ JOIN KEY (customers.country_id) REFERENCES country
+ )
+ ATTRIBUTE customer DETERMINES
+ (cust_first_name, cust_last_name, cust_gender,
+ cust_marital_status, cust_year_of_birth,
+ cust_income_level, cust_credit_limit)
+ ATTRIBUTE country DETERMINES (countries.country_name)
+;
+
+CREATE DIRECTORY admin AS 'oracle/admin';
+
+CREATE OR REPLACE DIRECTORY bfile_dir AS '/private1/LOB/files';
+
+CREATE DISKGROUP dgroup_01
+ EXTERNAL REDUNDANCY
+ DISK '$ORACLE_HOME/disks/c*';
+
+CREATE FUNCTION SecondMax (input NUMBER) RETURN NUMBER
+ PARALLEL_ENABLE AGGREGATE USING SecondMaxImpl;
+
+CREATE OR REPLACE FUNCTION text_length(a CLOB)
+ RETURN NUMBER DETERMINISTIC IS
+ BEGIN
+ RETURN DBMS_LOB.GETLENGTH(a);
+ END;
+/
+
+CREATE INDEXTYPE position_indextype
+ FOR position_between(NUMBER, NUMBER, NUMBER)
+ USING position_im;
+
+CREATE JAVA SOURCE NAMED "Hello" AS
+ public class Hello {
+ public static String hello() {
+ return \"Hello World\"; } };
+
+-- 40 Statements
+
+CREATE JAVA RESOURCE NAMED "appText"
+ USING BFILE (bfile_dir, 'textBundle.dat');
+
+CREATE LIBRARY ext_lib AS '/OR/lib/ext_lib.so';
+/
+
+CREATE OR REPLACE LIBRARY ext_lib IS '/OR/newlib/ext_lib.so';
+/
+
+CREATE LIBRARY app_lib as '${ORACLE_HOME}/lib/app_lib.so'
+ AGENT 'sales.hq.acme.com';
+/
+
+CREATE MATERIALIZED VIEW LOG ON employees
+ WITH PRIMARY KEY
+ INCLUDING NEW VALUES;
+
+CREATE MATERIALIZED VIEW all_customers
+ PCTFREE 5 PCTUSED 60
+ TABLESPACE example
+ STORAGE (INITIAL 50K NEXT 50K)
+ USING INDEX STORAGE (INITIAL 25K NEXT 25K)
+ REFRESH START WITH ROUND(SYSDATE + 1) + 11/24
+ NEXT NEXT_DAY(TRUNC(SYSDATE), 'MONDAY') + 15/24
+ AS SELECT * FROM sh.customers@remote
+ UNION
+ SELECT * FROM sh.customers@local;
+
+CREATE MATERIALIZED VIEW LOG ON product_information
+ WITH ROWID, SEQUENCE (list_price, min_price, category_id)
+ INCLUDING NEW VALUES;
+
+CREATE OPERATOR eq_op
+ BINDING (VARCHAR2, VARCHAR2)
+ RETURN NUMBER
+ USING eq_f;
+
+CREATE OUTLINE salaries FOR CATEGORY special
+ ON SELECT last_name, salary FROM employees;
+
+CREATE OR REPLACE OUTLINE public_salaries
+ FROM PRIVATE my_salaries;
+
+-- 50 Statements so far
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/oracle/oracle_test_statements.ddl
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdl.cnd
(from rev 1528,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/PostgresDdl.cnd)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdl.cnd
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdl.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,205 @@
+/*
+ * JBoss DNA (
http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+ //------------------------------------------------------------------------------
+// N A M E S P A C E S
+//------------------------------------------------------------------------------
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<ddl='http://www.jboss.org/dna/ddl/1.0'>
+<postgresddl='http://www.jboss.org/dna/ddl/postgres/1.0'>
+
+// =============================================================================
+// OPERANDS
+// =============================================================================
+[postgresddl:aggregateOperand] > ddl:operand abstract
+[postgresddl:castOperand] > ddl:operand abstract
+[postgresddl:commentOperand] > ddl:operand abstract
+[postgresddl:constraintTriggerOperand] > ddl:operand abstract
+[postgresddl:conversionOperand] > ddl:operand abstract
+[postgresddl:databaseOperand] > ddl:operand abstract
+[postgresddl:foreignDataOperand] > ddl:operand abstract
+[postgresddl:groupOperand] > ddl:operand abstract
+[postgresddl:functionOperand] > ddl:operand abstract
+[postgresddl:indexOperand] > ddl:operand abstract
+[postgresddl:languageOperand] > ddl:operand abstract
+[postgresddl:operatorOperand] > ddl:operand abstract
+[postgresddl:ownedByOperand] > ddl:operand abstract
+[postgresddl:roleOperand] > ddl:operand abstract
+[postgresddl:ruleOperand] > ddl:operand abstract
+[postgresddl:sequenceOperand] > ddl:operand abstract
+[postgresddl:serverOperand] > ddl:operand abstract
+[postgresddl:tablespaceOperand] > ddl:operand abstract
+[postgresddl:textSearchOperand] > ddl:operand abstract
+[postgresddl:triggerOperand] > ddl:operand abstract
+[postgresddl:typeOperand] > ddl:operand abstract
+[postgresddl:userOperand] > ddl:operand abstract
+[postgresddl:userMappingOperand] > ddl:operand abstract
+[postgresddl:parameterOperand] > ddl:operand abstract
+
+[postgresddl:functionParameter] > postgresddl:parameterOperand mixin
+ - ddl:datatypeName (STRING) mandatory
+ - ddl:datatypeLength (LONG)
+ - ddl:datatypePrecision (LONG)
+ - ddl:datatypeScale (LONG)
+ - ddl:nullable (STRING)
+ - ddl:defaultOption (STRING)
+ - postgresddl:mode (STRING)
+
+[postgresddl:role] > postgresddl:roleOperand mixin
+
+[postgresddl:renamedColumn] > ddl:renamable mixin
+
+// =============================================================================
+// ALTER STATEMENTS
+// =============================================================================
+[postgresddl:alterAggregateStatement] > ddl:alterable, ddl:statement,
postgresddl:aggregateOperand mixin
+[postgresddl:alterConversionStatement] > ddl:alterable, ddl:statement,
postgresddl:conversionOperand mixin
+[postgresddl:alterDatabaseStatement] > ddl:alterable, ddl:statement,
postgresddl:databaseOperand mixin
+[postgresddl:alterForeignDataWrapperStatement] > ddl:alterable, ddl:statement,
postgresddl:foreignDataOperand mixin
+[postgresddl:alterFunctionStatement] > ddl:alterable, ddl:statement,
postgresddl:functionOperand mixin
+[postgresddl:alterGroupStatement] > ddl:alterable, ddl:statement,
postgresddl:groupOperand mixin
+[postgresddl:alterIndexStatement] > ddl:alterable, ddl:statement,
postgresddl:indexOperand mixin
+[postgresddl:alterLanguageStatement] > ddl:alterable, ddl:statement,
postgresddl:languageOperand mixin
+[postgresddl:alterOperatorStatement] > ddl:alterable, ddl:statement,
postgresddl:operatorOperand mixin
+[postgresddl:alterRoleStatement] > ddl:alterable, ddl:statement,
postgresddl:roleOperand mixin
+[postgresddl:alterSchemaStatement] > ddl:alterable, ddl:statement,
ddl:schemaOperand mixin
+[postgresddl:alterSequenceStatement] > ddl:alterable, ddl:statement,
postgresddl:sequenceOperand mixin
+[postgresddl:alterServerStatement] > ddl:alterable, ddl:statement,
postgresddl:serverOperand mixin
+[postgresddl:alterTablespaceStatement] > ddl:alterable, ddl:statement,
postgresddl:tablespaceOperand mixin
+[postgresddl:alterTextSearchStatement] > ddl:alterable, ddl:statement,
postgresddl:textSearchOperand mixin
+[postgresddl:alterTriggerStatement] > ddl:alterable, ddl:statement,
postgresddl:triggerOperand mixin
+[postgresddl:alterTypeStatement] > ddl:alterable, ddl:statement,
postgresddl:typeOperand mixin
+[postgresddl:alterUserStatement] > ddl:alterable, ddl:statement,
postgresddl:userOperand mixin
+[postgresddl:alterUserMappingStatement] > ddl:alterable, ddl:statement,
postgresddl:userMappingOperand mixin
+[postgresddl:alterViewStatement] > ddl:alterable, ddl:statement,
ddl:viewOperand mixin
+
+[postgresddl:alterTableStatement] > ddl:alterTableStatement mixin
+ - postgresddl:newTableName (STRING)
+ - postgresddl:schemaName (STRING)
+ + postgresddl:renameColumn (postgresddl:renamedColumn) = postgresddl:renamedColumn
multiple
+
+
+// =============================================================================
+// CREATE STATEMENTS
+// =============================================================================
+
+[postgresddl:createAggregateStatement] > ddl:creatable, ddl:statement,
postgresddl:aggregateOperand mixin
+[postgresddl:createCastStatement] > ddl:creatable, ddl:statement,
postgresddl:castOperand mixin
+[postgresddl:createConstraintTriggerStatement] > ddl:creatable, ddl:statement,
postgresddl:constraintTriggerOperand mixin
+[postgresddl:createConversionStatement] > ddl:creatable, ddl:statement,
postgresddl:conversionOperand mixin
+[postgresddl:createDatabaseStatement] > ddl:creatable, ddl:statement,
postgresddl:databaseOperand mixin
+[postgresddl:createForeignDataWrapperStatement] > ddl:creatable, ddl:statement,
postgresddl:foreignDataOperand mixin
+[postgresddl:createFunctionStatement] > ddl:creatable, ddl:statement,
postgresddl:functionOperand mixin
+[postgresddl:createGroupStatement] > ddl:creatable, ddl:statement,
postgresddl:groupOperand mixin
+[postgresddl:createIndexStatement] > ddl:creatable, ddl:statement,
postgresddl:indexOperand mixin
+[postgresddl:createLanguageStatement] > ddl:creatable, ddl:statement,
postgresddl:languageOperand mixin
+[postgresddl:createOperatorStatement] > ddl:creatable, ddl:statement,
postgresddl:operatorOperand mixin
+[postgresddl:createRoleStatement] > ddl:creatable, ddl:statement,
postgresddl:roleOperand mixin
+[postgresddl:createRuleStatement] > ddl:creatable, ddl:statement,
postgresddl:ruleOperand mixin
+[postgresddl:createSequenceStatement] > ddl:creatable, ddl:statement,
postgresddl:sequenceOperand mixin
+[postgresddl:createServerStatement] > ddl:creatable, ddl:statement,
postgresddl:serverOperand mixin
+[postgresddl:createTablespaceStatement] > ddl:creatable, ddl:statement,
postgresddl:tablespaceOperand mixin
+[postgresddl:createTextSearchStatement] > ddl:creatable, ddl:statement,
postgresddl:textSearchOperand mixin
+[postgresddl:createTriggerStatement] > ddl:creatable, ddl:statement,
postgresddl:triggerOperand mixin
+[postgresddl:createTypeStatement] > ddl:creatable, ddl:statement,
postgresddl:typeOperand mixin
+[postgresddl:createUserStatement] > ddl:creatable, ddl:statement,
postgresddl:userOperand mixin
+[postgresddl:createUserMappingStatement] > ddl:creatable, ddl:statement,
postgresddl:userMappingOperand mixin
+
+// =============================================================================
+// DROP STATEMENTS
+// =============================================================================
+
+[postgresddl:dropAggregateStatement] > ddl:droppable, ddl:statement,
postgresddl:aggregateOperand mixin
+[postgresddl:dropCastStatement] > ddl:droppable, ddl:statement,
postgresddl:castOperand mixin
+[postgresddl:dropConstraintTriggerStatement] > ddl:droppable, ddl:statement,
postgresddl:constraintTriggerOperand mixin
+[postgresddl:dropConversionStatement] > ddl:droppable, ddl:statement,
postgresddl:conversionOperand mixin
+[postgresddl:dropDatabaseStatement] > ddl:droppable, ddl:statement,
postgresddl:databaseOperand mixin
+[postgresddl:dropForeignDataWrapperStatement] > ddl:droppable, ddl:statement,
postgresddl:foreignDataOperand mixin
+[postgresddl:dropFunctionStatement] > ddl:droppable, ddl:statement,
postgresddl:functionOperand mixin
+[postgresddl:dropGroupStatement] > ddl:droppable, ddl:statement,
postgresddl:groupOperand mixin
+[postgresddl:dropIndexStatement] > ddl:droppable, ddl:statement,
postgresddl:indexOperand mixin
+[postgresddl:dropLanguageStatement] > ddl:droppable, ddl:statement,
postgresddl:languageOperand mixin
+[postgresddl:dropOperatorStatement] > ddl:droppable, ddl:statement,
postgresddl:operatorOperand mixin
+[postgresddl:dropOwnedByStatement] > ddl:droppable, ddl:statement,
postgresddl:ownedByOperand mixin
+[postgresddl:dropRoleStatement] > ddl:droppable, ddl:statement,
postgresddl:roleOperand mixin
+[postgresddl:dropRuleStatement] > ddl:droppable, ddl:statement,
postgresddl:ruleOperand mixin
+[postgresddl:dropSequenceStatement] > ddl:droppable, ddl:statement,
postgresddl:sequenceOperand mixin
+[postgresddl:dropServerStatement] > ddl:droppable, ddl:statement,
postgresddl:serverOperand mixin
+[postgresddl:dropTablespaceStatement] > ddl:droppable, ddl:statement,
postgresddl:tablespaceOperand mixin
+[postgresddl:dropTextSearchStatement] > ddl:droppable, ddl:statement,
postgresddl:textSearchOperand mixin
+[postgresddl:dropTriggerStatement] > ddl:droppable, ddl:statement,
postgresddl:triggerOperand mixin
+[postgresddl:dropTypeStatement] > ddl:droppable, ddl:statement,
postgresddl:typeOperand mixin
+[postgresddl:dropUserStatement] > ddl:droppable, ddl:statement,
postgresddl:userOperand mixin
+[postgresddl:dropUserMappingStatement] > ddl:droppable, ddl:statement,
postgresddl:userMappingOperand mixin
+
+// =============================================================================
+// MISC STATEMENTS
+// =============================================================================
+
+[postgresddl:abortStatement] > ddl:statement mixin
+[postgresddl:analyzeStatement] > ddl:statement mixin
+[postgresddl:clusterStatement] > ddl:statement mixin
+[postgresddl:commentOnStatement] > ddl:statement, postgresddl:commentOperand
mixin
+ - postgresddl:targetObjectType (STRING) mandatory
+ - postgresddl:targetObjectName (STRING)
+ - postgresddl:comment (STRING) mandatory
+[postgresddl:copyStatement] > ddl:statement mixin
+[postgresddl:deallocateStatement] > ddl:statement mixin
+[postgresddl:declareStatement] > ddl:statement mixin
+[postgresddl:discardStatement] > ddl:statement mixin
+[postgresddl:explainStatement] > ddl:statement mixin
+[postgresddl:fetchStatement] > ddl:statement mixin
+[postgresddl:listenStatement] > ddl:statement mixin
+[postgresddl:loadStatement] > ddl:statement mixin
+[postgresddl:lockTableStatement] > ddl:statement mixin
+[postgresddl:moveStatement] > ddl:statement mixin
+[postgresddl:notifyStatement] > ddl:statement mixin
+[postgresddl:prepareStatement] > ddl:statement mixin
+[postgresddl:reassignOwnedStatement] > ddl:statement mixin
+[postgresddl:reindexStatement] > ddl:statement mixin
+[postgresddl:releaseSavepointStatement] > ddl:statement mixin
+[postgresddl:rollbackStatement] > ddl:statement mixin
+[postgresddl:selectIntoStatement] > ddl:statement mixin
+[postgresddl:showStatement] > ddl:statement mixin
+[postgresddl:truncateStatement] > ddl:statement mixin
+[postgresddl:unlistenStatement] > ddl:statement mixin
+[postgresddl:vacuumStatement] > ddl:statement mixin
+
+// =============================================================================
+// GRANT STATEMENTS
+// =============================================================================
+[postgresddl:grantOnTableStatement] > ddl:grantStatement, ddl:tableOperand
mixin
+[postgresddl:grantOnSequenceStatement] > ddl:grantStatement,
postgresddl:sequenceOperand mixin
+[postgresddl:grantOnDatabaseStatement] > ddl:grantStatement,
postgresddl:databaseOperand mixin
+[postgresddl:grantOnForeignDataWrapperStatement] > ddl:grantStatement,
postgresddl:foreignDataOperand mixin
+[postgresddl:grantOnForeignServerStatement] > ddl:grantStatement,
postgresddl:serverOperand mixin
+[postgresddl:grantOnFunctionStatement] > ddl:grantStatement,
postgresddl:functionOperand mixin
+ + postgresddl:parameter (postgresddl:functionParameter) = postgresddl:functionParameter
multiple
+[postgresddl:grantOnLanguageStatement] > ddl:grantStatement,
postgresddl:languageOperand mixin
+[postgresddl:grantOnSchemaStatement] > ddl:grantStatement, ddl:schemaOperand
mixin
+[postgresddl:grantOnTablespaceStatement] > ddl:grantStatement,
postgresddl:tablespaceOperand mixin
+[postgresddl:grantRolesStatement] > ddl:grantStatement mixin
+ + postgresddl:grantRole (postgresddl:role) = postgresddl:role multiple
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/PostgresDdl.cnd
___________________________________________________________________
Name: svn:executable
+ *
Copied:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/postgres_test_statements.ddl
(from rev 1528,
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/postgres_test_statements.ddl)
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/postgres_test_statements.ddl
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/postgres_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,609 @@
+-- Postgres SQL Statements from postgressql-8.4.1-US.pdf
+--
+-- Extracted 10/5/2009
+
+--COMMENT ON
+--{
+-- TABLE object_name |
+-- COLUMN table_name.column_name |
+-- AGGREGATE agg_name (agg_type [, ...] ) |
+-- CAST (sourcetype AS targettype) |
+-- CONSTRAINT constraint_name ON table_name |
+-- CONVERSION object_name |
+-- DATABASE object_name |
+-- DOMAIN object_name |
+-- FUNCTION func_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
+-- INDEX object_name |
+-- LARGE OBJECT large_object_oid |
+-- OPERATOR op (leftoperand_type, rightoperand_type) |
+-- OPERATOR CLASS object_name USING index_method |
+-- OPERATOR FAMILY object_name USING index_method |
+-- [ PROCEDURAL ] LANGUAGE object_name |
+-- ROLE object_name |
+-- RULE rule_name ON table_name |
+-- SCHEMA object_name |
+-- SEQUENCE object_name |
+-- TABLESPACE object_name |
+-- TEXT SEARCH CONFIGURATION object_name |
+-- TEXT SEARCH DICTIONARY object_name |
+-- TEXT SEARCH PARSER object_name |
+-- TEXT SEARCH TEMPLATE object_name |
+-- TRIGGER trigger_name ON table_name |
+-- TYPE object_name |
+-- VIEW object_name
+--} IS 'text'
+
+COMMENT ON TABLE mytable IS 'This is my table.';
+COMMENT ON TABLE mytable IS NULL;
+COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample
variance';
+COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4';
+COMMENT ON COLUMN my_table.my_column IS 'Employee ID number';
+COMMENT ON CONVERSION my_conv IS 'Conversion to UTF8';
+COMMENT ON DATABASE my_database IS 'Development Database';
+COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
+COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
+COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee ID';
+-- 10 STATEMENTS *******************************************************
+COMMENT ON LANGUAGE plpython IS 'Python support for stored procedures';
+COMMENT ON LARGE OBJECT 346344 IS 'Planning document';
+COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
+COMMENT ON OPERATOR - (NONE, text) IS 'This is a prefix operator on text';
+COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for
btrees';
+COMMENT ON OPERATOR FAMILY integer_ops USING btree IS 'all integer operators for
btrees';
+COMMENT ON ROLE my_role IS 'Administration group for finance tables';
+COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
+COMMENT ON SCHEMA my_schema IS 'Departmental data';
+COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
+-- 20 STATEMENTS *******************************************************
+COMMENT ON TABLE my_schema.my_table IS 'Employee Information';
+COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';
+COMMENT ON TEXT SEARCH CONFIGURATION my_config IS 'Special word filtering';
+COMMENT ON TEXT SEARCH DICTIONARY swedish IS 'Snowball stemmer for swedish
language';
+COMMENT ON TEXT SEARCH PARSER my_parser IS 'Splits text into words';
+COMMENT ON TEXT SEARCH TEMPLATE snowball IS 'Snowball stemmer';
+COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI';
+COMMENT ON TYPE complex IS 'Complex number data type';
+COMMENT ON VIEW my_view IS 'View of departmental costs';
+--COMMIT [ WORK | TRANSACTION ]
+
+COMMIT WORK;
+-- 30 STATEMENTS *******************************************************
+COMMIT TRANSACTION;
+
+COMMIT;
+
+--COMMIT PREPARED transaction_id;
+
+COMMIT PREPARED 'foobar';
+
+--COPY tablename [ ( column [, ...] ) ]
+-- FROM { 'filename' | STDIN }
+-- [ [ WITH ]
+-- [ BINARY ]
+-- [ OIDS ]
+-- [ DELIMITER [ AS ] 'delimiter ' ]
+-- [ NULL [ AS ] 'null string ' ]
+-- [ CSV [ HEADER ]
+-- [ QUOTE [ AS ] 'quote' ]
+-- [ ESCAPE [ AS ] 'escape' ]
+-- [ FORCE NOT NULL column [, ...] ]
+--COPY { tablename [ ( column [, ...] ) ] | ( query ) }
+-- TO { 'filename' | STDOUT }
+-- [ [ WITH ]
+-- [ BINARY ]
+-- [ OIDS ]
+-- [ DELIMITER [ AS ] 'delimiter ' ]
+-- [ NULL [ AS ] 'null string ' ]
+-- [ CSV [ HEADER ]
+-- [ QUOTE [ AS ] 'quote' ]
+-- [ ESCAPE [ AS ] 'escape' ]
+-- [ FORCE QUOTE column [, ...] ]
+
+COPY country TO STDOUT WITH DELIMITER '|';
+
+COPY country FROM '/usr1/proj/bray/sql/country_data';
+
+COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO
'/usr1/proj/bray/sql/a_list_co';
+
+--CREATE AGGREGATE name ( input_data_type [ , ... ] ) (
+-- SFUNC = sfunc,
+-- STYPE = state_data_type
+-- [ , FINALFUNC = ffunc ]
+-- [ , INITCOND = initial_condition ]
+-- [ , SORTOP = sort_operator ]
+--)
+--or the old syntax
+--CREATE AGGREGATE name (
+-- BASETYPE = base_type,
+-- SFUNC = sfunc,
+-- STYPE = state_data_type
+-- [ , FINALFUNC = ffunc ]
+-- [ , INITCOND = initial_condition ]
+-- [ , SORTOP = sort_operator ]
+--)
+
+
+--CREATE CAST (sourcetype AS targettype)
+-- WITH FUNCTION funcname (argtypes)
+-- [ AS ASSIGNMENT | AS IMPLICIT ]
+--CREATE CAST (sourcetype AS targettype)
+-- WITHOUT FUNCTION
+-- [ AS ASSIGNMENT | AS IMPLICIT ]
+--CREATE CAST (sourcetype AS targettype)
+-- WITH INOUT
+-- [ AS ASSIGNMENT | AS IMPLICIT ]
+
+CREATE CAST (bigint AS int4) WITH FUNCTION int4(bigint) AS ASSIGNMENT;
+
+--CREATE CONSTRAINT TRIGGER name
+-- AFTER event [ OR ... ]
+-- ON table_name
+-- [ FROM referenced_table_name ]
+-- { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
+-- FOR EACH ROW
+-- EXECUTE PROCEDURE funcname ( arguments )
+
+--CREATE [ DEFAULT ] CONVERSION name
+-- FOR source_encoding TO dest_encoding FROM funcname
+
+CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
+
+--CREATE DATABASE name
+-- [ [ WITH ] [ OWNER [=] dbowner ]
+-- [ TEMPLATE [=] template ]
+-- [ ENCODING [=] encoding ]
+-- [ LC_COLLATE [=] lc_collate ]
+-- [ LC_CTYPE [=] lc_ctype ]
+-- [ TABLESPACE [=] tablespace ]
+-- [ CONNECTION LIMIT [=] connlimit ] ]
+
+CREATE DATABASE lusiadas;
+
+CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
+-- 40 STATEMENTS *******************************************************
+CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
+
+
+--CREATE DOMAIN name [ AS ] data_type
+-- [ DEFAULT expression ]
+-- [ constraint [ ... ] ]
+--where constraint is:
+--[ CONSTRAINT constraint_name ]
+--{ NOT NULL | NULL | CHECK (expression) }
+
+CREATE DOMAIN us_postal_code AS TEXT
+ CHECK(
+ VALUE ~ '^\\d{5}$'
+ OR VALUE ~ '^\\d{5}-\\d{4}$'
+ );
+
+--CREATE FOREIGN DATA WRAPPER name
+-- [ VALIDATOR valfunction | NO VALIDATOR ]
+-- [ OPTIONS ( option 'value' [, ... ] ) ]
+
+CREATE FOREIGN DATA WRAPPER dummy;
+
+CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;
+
+CREATE FOREIGN DATA WRAPPER mywrapper
+ OPTIONS (debug 'true');
+
+--CREATE [ OR REPLACE ] FUNCTION
+-- name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } defexpr ] [, ...] ] )
+-- [ RETURNS rettype
+-- | RETURNS TABLE ( colname coltype [, ...] ) ]
+-- { LANGUAGE langname
+-- | WINDOW
+-- | IMMUTABLE | STABLE | VOLATILE
+-- | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
+-- | [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
+-- | COST execution_cost
+-- | ROWS result_rows
+-- | SET configuration_parameter { TO value | = value | FROM CURRENT }
+-- | AS 'definition'
+-- | AS 'obj_file', 'link_symbol'
+-- } ...
+-- [ WITH ( attribute [, ...] ) ]
+
+CREATE FUNCTION add(integer, integer) RETURNS integer
+ AS 'select $1 + $2;'
+ LANGUAGE SQL
+ IMMUTABLE
+ RETURNS NULL ON NULL INPUT;
+
+CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$
+ BEGIN
+ RETURN i + 1;
+ END;
+
+CREATE FUNCTION dup(in int, out f1 int, out f2 text)
+ AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
+ LANGUAGE SQL;
+
+CREATE FUNCTION dup(int) RETURNS dup_result
+ AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
+ LANGUAGE SQL;
+
+CREATE FUNCTION dup(int) RETURNS TABLE(f1 int, f2 text)
+ AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
+ LANGUAGE SQL;
+-- 50 STATEMENTS *******************************************************
+--CREATE GROUP name [ [ WITH ] option [ ... ] ]
+--where option can be:
+-- SUPERUSER | NOSUPERUSER
+-- | CREATEDB | NOCREATEDB
+-- | CREATEROLE | NOCREATEROLE
+-- | CREATEUSER | NOCREATEUSER
+-- | INHERIT | NOINHERIT
+-- | LOGIN | NOLOGIN
+-- | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password '
+-- | VALID UNTIL 'timestamp'
+-- | IN ROLE rolename [, ...]
+-- | IN GROUP rolename [, ...]
+-- | ROLE rolename [, ...]
+-- | ADMIN rolename [, ...]
+-- | USER rolename [, ...]
+-- | SYSID uid
+
+--CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] name ON table [ USING method ]
+-- ( { column | ( expression ) } [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
[, ..
+-- [ WITH ( storage_parameter = value [, ... ] ) ]
+-- [ TABLESPACE tablespace ]
+-- [ WHERE predicate ]
+
+CREATE UNIQUE INDEX title_idx ON films (title);
+
+CREATE INDEX lower_title_idx ON films ((lower(title)));
+
+CREATE INDEX title_idx_nulls_low ON films (title NULLS FIRST);
+
+CREATE UNIQUE INDEX title_idx ON films (title) WITH (fillfactor = 70);
+
+CREATE INDEX gin_idx ON documents_table (locations) WITH (fastupdate = off);
+
+CREATE INDEX code_idx ON films(code) TABLESPACE indexspace;
+
+CREATE INDEX CONCURRENTLY sales_quantity_index ON sales_table (quantity);
+
+--CREATE [ PROCEDURAL ] LANGUAGE name
+--CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
+-- HANDLER call_handler [ VALIDATOR valfunction ]
+
+CREATE LANGUAGE plpgsql;
+
+CREATE PROCEDURAL LANGUAGE plpgsql;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql;
+-- 60 STATEMENTS *******************************************************
+CREATE LANGUAGE plsample
+ HANDLER plsample_call_handler;
+
+--CREATE OPERATOR name (
+-- PROCEDURE = funcname
+-- [, LEFTARG = lefttype ] [, RIGHTARG = righttype ]
+-- [, COMMUTATOR = com_op ] [, NEGATOR = neg_op ]
+-- [, RESTRICT = res_proc ] [, JOIN = join_proc ]
+-- [, HASHES ] [, MERGES ]
+--)
+
+CREATE OPERATOR === (
+ LEFTARG = box,
+ RIGHTARG = box,
+ PROCEDURE = area_equal_procedure,
+ COMMUTATOR = ===,
+ NEGATOR = !==,
+ RESTRICT = area_restriction_procedure,
+ JOIN = area_join_procedure,
+ HASHES, MERGES
+);
+
+--CREATE OPERATOR CLASS name [ DEFAULT ] FOR TYPE data_type
+-- USING index_method [ FAMILY family_name ] AS
+-- { OPERATOR strategy_number operator_name [ ( op_type, op_type ) ]
+-- | FUNCTION support_number [ ( op_type [ , op_type ] ) ] funcname ( argument_type [,
...] )
+-- | STORAGE storage_type
+-- } [, ... ]
+
+CREATE OPERATOR CLASS gist__int_ops
+ DEFAULT FOR TYPE _int4 USING gist AS
+ OPERATOR 3 &&,
+ OPERATOR 6 = (anyarray, anyarray),
+ OPERATOR 7 @>,
+ <@,
+ OPERATOR 8
+ OPERATOR 20 @@ (_int4, query_int),
+ FUNCTION 1 g_int_consistent (internal, _int4, int, oid, internal),
+ FUNCTION 2 g_int_union (internal, internal),
+ FUNCTION 3 g_int_compress (internal),
+ FUNCTION 4 g_int_decompress (internal),
+ FUNCTION 5 g_int_penalty (internal, internal, internal),
+ FUNCTION 6 g_int_picksplit (internal, internal),
+ FUNCTION 7 g_int_same (_int4, _int4, internal);
+
+--CREATE OPERATOR FAMILY name USING index_method
+
+CREATE OPERATOR FAMILY name USING index_method;
+
+--CREATE ROLE name [ [ WITH ] option [ ... ] ]
+--where option can be:
+-- SUPERUSER | NOSUPERUSER
+-- | CREATEDB | NOCREATEDB
+-- | CREATEROLE | NOCREATEROLE
+-- | CREATEUSER | NOCREATEUSER
+-- | INHERIT | NOINHERIT
+-- | LOGIN | NOLOGIN
+-- | CONNECTION LIMIT connlimit
+-- | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password '
+-- | VALID UNTIL 'timestamp'
+-- | IN ROLE rolename [, ...]
+-- | IN GROUP rolename [, ...]
+-- | ROLE rolename [, ...]
+-- | ADMIN rolename [, ...]
+-- | USER rolename [, ...]
+-- | SYSID uid
+
+CREATE ROLE jonathan LOGIN;
+
+CREATE USER davide WITH PASSWORD 'jw8s0F4';
+
+CREATE ROLE miriam WITH LOGIN PASSWORD 'jw8s0F4' VALID UNTIL
'2005-01-01';
+
+CREATE ROLE admin WITH CREATEDB CREATEROLE;
+
+--CREATE [ OR REPLACE ] RULE name AS ON event
+-- TO table [ WHERE condition ]
+-- DO [ ALSO | INSTEAD ] { NOTHING | command | ( command ; command ... ) }
+
+CREATE RULE "_RETURN" AS
+ ON SELECT TO t1
+ DO INSTEAD
+ SELECT * FROM t2;
+
+CREATE RULE "_RETURN" AS
+ ON SELECT TO t2
+ DO INSTEAD
+ SELECT * FROM t1;
+-- 70 STATEMENTS *******************************************************
+CREATE RULE notify_me AS ON UPDATE TO mytable DO ALSO NOTIFY mytable;
+
+--CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ ... ] ]
+--CREATE SCHEMA AUTHORIZATION username [ schema_element [ ... ] ]
+
+CREATE SCHEMA myschema;
+
+CREATE SCHEMA AUTHORIZATION joe;
+
+CREATE SCHEMA hollywood
+ CREATE TABLE films (title text, release date, awards text[])
+ CREATE VIEW winners AS
+ SELECT title, release FROM films WHERE awards IS NOT NULL;
+
+--CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
+-- [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
+-- [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
+-- [ OWNED BY { table.column | NONE } ]
+
+CREATE SEQUENCE serial START 101;
+
+--CREATE SERVER servername [ TYPE 'servertype' ] [ VERSION
'serverversion' ]
+-- FOREIGN DATA WRAPPER fdwname
+-- [ OPTIONS ( option 'value' [, ... ] ) ]
+
+CREATE SERVER foo FOREIGN DATA WRAPPER "default";
+
+CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname
'foodb', port);
+
+--CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name
+-- ( [
+-- { column_name data_type [ DEFAULT default_expr ] [ column_constraint [ ... ] ]
+-- | table_constraint
+-- | LIKE parent_table [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS |
INDEXES } ] .
+-- [, ... ]
+-- ] )
+--[ INHERITS ( parent_table [, ... ] ) ]
+--[ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+--[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
+--[ TABLESPACE tablespace ]
+--where column_constraint is:
+--[ CONSTRAINT constraint_name ]
+--{ NOT NULL |
+-- NULL |
+-- UNIQUE index_parameters |
+-- PRIMARY KEY index_parameters |
+-- CHECK ( expression ) |
+-- REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
+-- [ ON DELETE action ] [ ON UPDATE action ] }
+--[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+--and table_constraint is:
+--[ CONSTRAINT constraint_name ]
+--{ UNIQUE ( column_name [, ... ] ) index_parameters |
+-- PRIMARY KEY ( column_name [, ... ] ) index_parameters |
+-- CHECK ( expression ) |
+-- FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
+-- [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE
action ]
+--[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
+--index_parameters in UNIQUE and PRIMARY KEY constraints are:
+--[ WITH ( storage_parameter [= value] [, ... ] ) ]
+--[ USING INDEX TABLESPACE tablespace ]
+
+CREATE TABLE films (
+ code char(5) CONSTRAINT firstkey PRIMARY KEY,
+ title varchar(40) NOT NULL,
+ did integer NOT NULL,
+ date_prod date,
+ kind varchar(10),
+ len interval hour to minute
+);
+
+CREATE TABLE distributors (
+ did integer PRIMARY KEY DEFAULT nextval('serial'),
+ name varchar(40) NOT NULL CHECK (name <> ”)
+
+);
+
+CREATE TABLE array_int (
+ vector int[][]
+);
+-- 80 STATEMENTS *******************************************************
+CREATE TABLE films (
+ code char(5),
+ title varchar(40),
+ did integer,
+ date_prod date,
+ kind varchar(10),
+ len interval hour to minute,
+ CONSTRAINT production UNIQUE(date_prod)
+);
+
+CREATE TABLE distributors (
+ did integer CHECK (did > 100),
+ name varchar(40)
+);
+
+CREATE TABLE distributors (
+ did integer,
+ name varchar(40)
+ CONSTRAINT con1 CHECK (did > 100 AND name <> ”)
+);
+
+CREATE TABLE films (
+ code char(5),
+ title varchar(40),
+ did integer,
+ date_prod date,
+ kind varchar(10),
+ len interval hour to minute,
+ CONSTRAINT code_title PRIMARY KEY(code,title)
+);
+
+CREATE TABLE films (
+ code char(5),
+ title varchar(40),
+ did integer,
+ date_prod date,
+ kind varchar(10),
+ len interval hour to minute,
+ CONSTRAINT code_title PRIMARY KEY(code,title)
+);
+
+CREATE TABLE distributors (
+ name varchar(40) DEFAULT 'Luso Films',
+ did integer DEFAULT nextval('distributors_serial'),
+ modtime timestamp DEFAULT current_timestamp
+);
+
+CREATE TABLE distributors (
+ did integer CONSTRAINT no_null NOT NULL,
+ name varchar(40) NOT NULL
+);
+
+CREATE TABLE distributors (
+ did integer,
+ name varchar(40) UNIQUE
+);
+
+CREATE TABLE distributors (
+ did integer,
+ name varchar(40),
+ UNIQUE(name)
+);
+
+CREATE TABLE distributors (
+ did integer,
+ name varchar(40),
+ UNIQUE(name) WITH (fillfactor=70)
+)
+WITH (fillfactor=70);
+-- 90 STATEMENTS *******************************************************
+CREATE TABLE cinemas (
+ id serial,
+ name text,
+ location text
+) TABLESPACE diskvol1;
+
+--CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name
+-- [ (column_name [, ...] ) ]
+-- [ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
+-- [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
+-- [ TABLESPACE tablespace ]
+-- AS query
+-- [ WITH [ NO ] DATA ]
+
+CREATE TABLE films_recent AS
+ SELECT * FROM films WHERE date_prod >= '2002-01-01';
+
+CREATE TABLE films2 AS
+ TABLE films;
+
+CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS
+ EXECUTE recentfilms('2002-01-01');
+
+--CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory '
+
+CREATE TABLESPACE dbspace LOCATION '/data/dbs';
+
+CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
+
+--CREATE TEXT SEARCH CONFIGURATION name (
+-- PARSER = parser_name |
+-- COPY = source_config
+--)
+
+CREATE TEXT SEARCH CONFIGURATION my_search_config (
+ PARSER = my_parser
+);
+
+--CREATE TEXT SEARCH DICTIONARY name (
+-- TEMPLATE = template
+-- [, option = value [, ... ]]
+--)
+
+CREATE TEXT SEARCH DICTIONARY my_russian (
+ template = snowball,
+ language = russian,
+ stopwords = myrussian
+);
+
+--CREATE TEXT SEARCH PARSER name (
+-- START = start_function ,
+-- GETTOKEN = gettoken_function ,
+-- END = end_function ,
+-- LEXTYPES = lextypes_function
+-- [, HEADLINE = headline_function ]
+--)
+
+CREATE TEXT SEARCH PARSER my_search_parser (
+ START = startNow(),
+ GETTOKEN = getToken(),
+ END = end(),
+ LEXTYPES = getLexTypes()
+);
+
+--CREATE TEXT SEARCH TEMPLATE name (
+-- [ INIT = init_function , ]
+-- LEXIZE = lexize_function
+--)
+
+CREATE TEXT SEARCH TEMPLATE my_search_template (
+ LEXIZE = lexizeNow()
+);
+
+--CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] }
+-- ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
+-- EXECUTE PROCEDURE funcname ( arguments )
+-- 100 STATEMENTS *******************************************************
+CREATE TRIGGER trigger_name BEFORE dawn
+ ON table
+ EXECUTE PROCEDURE funcname ( 'arg1', 'arg2' );
+
+ALTER TABLE foreign_companies RENAME COLUMN address TO city;
+
+ALTER TABLE us_companies RENAME TO suppliers;
+
+ALTER TABLE old_addresses ALTER COLUMN street SET NOT NULL;
+
+ALTER TABLE new_addresses ALTER COLUMN street DROP NOT NULL;
+
+GRANT EXECUTE ON FUNCTION divideByTwo(numerator int, IN demoninator int) TO george;
+
+-- 106 STATEMENTS *******************************************************
Property changes on:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/dialect/postgres/postgres_test_statements.ddl
___________________________________________________________________
Name: svn:executable
+ *
Added:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/grant_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/grant_test_statements.ddl
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/grant_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,7 @@
+GRANT SELECT ON TABLE purchaseOrders TO maria,harry;
+
+GRANT UPDATE, USAGE ON TABLE billedOrders TO anita,zhi;
+
+GRANT SELECT ON TABLE orders.bills to PUBLIC;
+
+GRANT INSERT(a, b, c) ON TABLE purchaseOrders TO purchases_reader_role;
\ No newline at end of file
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/oracle_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/oracle_test_statements.ddl 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/oracle_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,234 +0,0 @@
---
--- SAMPLE ORACLE STATEMENTS
---
-
-ALTER TABLE employees
- PCTFREE 30
- PCTUSED 60;
-
-ALTER TABLE countries
- ADD (duty_pct NUMBER(2,2) CHECK (duty_pct < 10.5),
- visa_needed VARCHAR2(3));
-
-ALTER TABLESPACE tbs_01
- BEGIN BACKUP;
-
-ALTER TABLESPACE omf_ts1 ADD DATAFILE;
-
-ALTER TABLESPACE undots1
- RETENTION NOGUARANTEE;
-
-ALTER TRIGGER update_job_history DISABLE;
-
-ALTER TYPE data_typ
- ADD MEMBER FUNCTION qtr(der_qtr DATE)
- RETURN CHAR CASCADE;
-
-ALTER TYPE cust_address_typ
- ADD ATTRIBUTE (phone phone_list_typ) CASCADE;
-
-ALTER TYPE phone_list_typ
- MODIFY ELEMENT TYPE VARCHAR(64) CASCADE;
-
-ALTER USER app_user1
- GRANT CONNECT THROUGH sh
- WITH ROLE warehouse_user;
-
--- 10 Statements
-
-ALTER USER app_user1 IDENTIFIED GLOBALLY AS 'CN=tom,O=oracle,C=US';
-
-ALTER USER sidney
- IDENTIFIED BY second_2nd_pwd
- DEFAULT TABLESPACE example;
-
-ALTER VIEW customer_ro
- COMPILE;
-
-ANALYZE TABLE customers VALIDATE STRUCTURE ONLINE;
-
-ANALYZE TABLE employees VALIDATE STRUCTURE CASCADE;
-
-ANALYZE TABLE orders DELETE STATISTICS;
-
-ASSOCIATE STATISTICS WITH PACKAGES emp_mgmt DEFAULT SELECTIVITY 10;
-
-AUDIT SELECT
- ON hr.employees
- WHENEVER SUCCESSFUL;
-
-AUDIT INSERT, UPDATE
- ON oe.customers;
-
-AUDIT DELETE ANY TABLE;
-
--- 20 Statements
-
-AUDIT ROLE
- WHENEVER SUCCESSFUL;
-
-COMMENT ON COLUMN employees.job_id
- IS 'abbreviated job title';
-
-COMMIT WORK;
-
-COMMIT COMMENT 'In-doubt transaction Code 36, Call (415) 555-2637';
-
-CREATE CLUSTER personnel
- (department NUMBER(4))
-SIZE 512
-STORAGE (initial 100K next 50K);
-
-CREATE CLUSTER address
- (postal_code NUMBER, country_id CHAR(2))
- HASHKEYS 20
- HASH IS MOD(postal_code + country_id, 101);
-
-CREATE CLUSTER cust_orders (customer_id NUMBER(6))
- SIZE 512 SINGLE TABLE HASHKEYS 100;
-
-CREATE CONTEXT hr_context USING emp_mgmt;
-
-CREATE CONTROLFILE REUSE DATABASE "demo" NORESETLOGS NOARCHIVELOG
- MAXLOGFILES 32
- MAXLOGMEMBERS 2
- MAXDATAFILES 32
- MAXINSTANCES 1
- MAXLOGHISTORY 449
- LOGFILE
- GROUP 1 '/path/oracle/dbs/t_log1.f' SIZE 500K,
- GROUP 2 '/path/oracle/dbs/t_log2.f' SIZE 500K
- # STANDBY LOGFILE
- DATAFILE
- '/path/oracle/dbs/t_db1.f',
- '/path/oracle/dbs/dbu19i.dbf',
- '/path/oracle/dbs/tbs_11.f',
- '/path/oracle/dbs/smundo.dbf',
- '/path/oracle/dbs/demo.dbf'
- CHARACTER SET WE8DEC
- ;
-
-CREATE DATABASE sample
- CONTROLFILE REUSE
- LOGFILE
- GROUP 1 ('diskx:log1.log', 'disky:log1.log') SIZE 50K,
- GROUP 2 ('diskx:log2.log', 'disky:log2.log') SIZE 50K
- MAXLOGFILES 5
- MAXLOGHISTORY 100
- MAXDATAFILES 10
- MAXINSTANCES 2
- ARCHIVELOG
- CHARACTER SET AL32UTF8
- NATIONAL CHARACTER SET AL16UTF16
- DATAFILE
- 'disk1:df1.dbf' AUTOEXTEND ON,
- 'disk2:df2.dbf' AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
- DEFAULT TEMPORARY TABLESPACE temp_ts
- UNDO TABLESPACE undo_ts
- SET TIME_ZONE = '+02:00';
-
--- 30 Statements
-
-CREATE PUBLIC DATABASE LINK remote
- USING 'remote';
-
-CREATE DATABASE LINK local
- CONNECT TO hr IDENTIFIED BY hr
- USING 'local';
-
-CREATE DIMENSION customers_dim
- LEVEL customer IS (customers.cust_id)
- LEVEL city IS (customers.cust_city)
- LEVEL state IS (customers.cust_state_province)
- LEVEL country IS (countries.country_id)
- LEVEL subregion IS (countries.country_subregion)
- LEVEL region IS (countries.country_region)
- HIERARCHY geog_rollup (
- customer CHILD OF
- city CHILD OF
- state CHILD OF
- country CHILD OF
- subregion CHILD OF
- region
- JOIN KEY (customers.country_id) REFERENCES country
- )
- ATTRIBUTE customer DETERMINES
- (cust_first_name, cust_last_name, cust_gender,
- cust_marital_status, cust_year_of_birth,
- cust_income_level, cust_credit_limit)
- ATTRIBUTE country DETERMINES (countries.country_name)
-;
-
-CREATE DIRECTORY admin AS 'oracle/admin';
-
-CREATE OR REPLACE DIRECTORY bfile_dir AS '/private1/LOB/files';
-
-CREATE DISKGROUP dgroup_01
- EXTERNAL REDUNDANCY
- DISK '$ORACLE_HOME/disks/c*';
-
-CREATE FUNCTION SecondMax (input NUMBER) RETURN NUMBER
- PARALLEL_ENABLE AGGREGATE USING SecondMaxImpl;
-
-CREATE OR REPLACE FUNCTION text_length(a CLOB)
- RETURN NUMBER DETERMINISTIC IS
- BEGIN
- RETURN DBMS_LOB.GETLENGTH(a);
- END;
-/
-
-CREATE INDEXTYPE position_indextype
- FOR position_between(NUMBER, NUMBER, NUMBER)
- USING position_im;
-
-CREATE JAVA SOURCE NAMED "Hello" AS
- public class Hello {
- public static String hello() {
- return \"Hello World\"; } };
-
--- 40 Statements
-
-CREATE JAVA RESOURCE NAMED "appText"
- USING BFILE (bfile_dir, 'textBundle.dat');
-
-CREATE LIBRARY ext_lib AS '/OR/lib/ext_lib.so';
-/
-
-CREATE OR REPLACE LIBRARY ext_lib IS '/OR/newlib/ext_lib.so';
-/
-
-CREATE LIBRARY app_lib as '${ORACLE_HOME}/lib/app_lib.so'
- AGENT 'sales.hq.acme.com';
-/
-
-CREATE MATERIALIZED VIEW LOG ON employees
- WITH PRIMARY KEY
- INCLUDING NEW VALUES;
-
-CREATE MATERIALIZED VIEW all_customers
- PCTFREE 5 PCTUSED 60
- TABLESPACE example
- STORAGE (INITIAL 50K NEXT 50K)
- USING INDEX STORAGE (INITIAL 25K NEXT 25K)
- REFRESH START WITH ROUND(SYSDATE + 1) + 11/24
- NEXT NEXT_DAY(TRUNC(SYSDATE), 'MONDAY') + 15/24
- AS SELECT * FROM sh.customers@remote
- UNION
- SELECT * FROM sh.customers@local;
-
-CREATE MATERIALIZED VIEW LOG ON product_information
- WITH ROWID, SEQUENCE (list_price, min_price, category_id)
- INCLUDING NEW VALUES;
-
-CREATE OPERATOR eq_op
- BINDING (VARCHAR2, VARCHAR2)
- RETURN NUMBER
- USING eq_f;
-
-CREATE OUTLINE salaries FOR CATEGORY special
- ON SELECT last_name, salary FROM employees;
-
-CREATE OR REPLACE OUTLINE public_salaries
- FROM PRIVATE my_salaries;
-
--- 50 Statements so far
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/postgres_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/postgres_test_statements.ddl 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/postgres_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,609 +0,0 @@
--- Postgres SQL Statements from postgressql-8.4.1-US.pdf
---
--- Extracted 10/5/2009
-
---COMMENT ON
---{
--- TABLE object_name |
--- COLUMN table_name.column_name |
--- AGGREGATE agg_name (agg_type [, ...] ) |
--- CAST (sourcetype AS targettype) |
--- CONSTRAINT constraint_name ON table_name |
--- CONVERSION object_name |
--- DATABASE object_name |
--- DOMAIN object_name |
--- FUNCTION func_name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) |
--- INDEX object_name |
--- LARGE OBJECT large_object_oid |
--- OPERATOR op (leftoperand_type, rightoperand_type) |
--- OPERATOR CLASS object_name USING index_method |
--- OPERATOR FAMILY object_name USING index_method |
--- [ PROCEDURAL ] LANGUAGE object_name |
--- ROLE object_name |
--- RULE rule_name ON table_name |
--- SCHEMA object_name |
--- SEQUENCE object_name |
--- TABLESPACE object_name |
--- TEXT SEARCH CONFIGURATION object_name |
--- TEXT SEARCH DICTIONARY object_name |
--- TEXT SEARCH PARSER object_name |
--- TEXT SEARCH TEMPLATE object_name |
--- TRIGGER trigger_name ON table_name |
--- TYPE object_name |
--- VIEW object_name
---} IS 'text'
-
-COMMENT ON TABLE mytable IS 'This is my table.';
-COMMENT ON TABLE mytable IS NULL;
-COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample
variance';
-COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4';
-COMMENT ON COLUMN my_table.my_column IS 'Employee ID number';
-COMMENT ON CONVERSION my_conv IS 'Conversion to UTF8';
-COMMENT ON DATABASE my_database IS 'Development Database';
-COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
-COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
-COMMENT ON INDEX my_index IS 'Enforces uniqueness on employee ID';
--- 10 STATEMENTS *******************************************************
-COMMENT ON LANGUAGE plpython IS 'Python support for stored procedures';
-COMMENT ON LARGE OBJECT 346344 IS 'Planning document';
-COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two texts';
-COMMENT ON OPERATOR - (NONE, text) IS 'This is a prefix operator on text';
-COMMENT ON OPERATOR CLASS int4ops USING btree IS '4 byte integer operators for
btrees';
-COMMENT ON OPERATOR FAMILY integer_ops USING btree IS 'all integer operators for
btrees';
-COMMENT ON ROLE my_role IS 'Administration group for finance tables';
-COMMENT ON RULE my_rule ON my_table IS 'Logs updates of employee records';
-COMMENT ON SCHEMA my_schema IS 'Departmental data';
-COMMENT ON SEQUENCE my_sequence IS 'Used to generate primary keys';
--- 20 STATEMENTS *******************************************************
-COMMENT ON TABLE my_schema.my_table IS 'Employee Information';
-COMMENT ON TABLESPACE my_tablespace IS 'Tablespace for indexes';
-COMMENT ON TEXT SEARCH CONFIGURATION my_config IS 'Special word filtering';
-COMMENT ON TEXT SEARCH DICTIONARY swedish IS 'Snowball stemmer for swedish
language';
-COMMENT ON TEXT SEARCH PARSER my_parser IS 'Splits text into words';
-COMMENT ON TEXT SEARCH TEMPLATE snowball IS 'Snowball stemmer';
-COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI';
-COMMENT ON TYPE complex IS 'Complex number data type';
-COMMENT ON VIEW my_view IS 'View of departmental costs';
---COMMIT [ WORK | TRANSACTION ]
-
-COMMIT WORK;
--- 30 STATEMENTS *******************************************************
-COMMIT TRANSACTION;
-
-COMMIT;
-
---COMMIT PREPARED transaction_id;
-
-COMMIT PREPARED 'foobar';
-
---COPY tablename [ ( column [, ...] ) ]
--- FROM { 'filename' | STDIN }
--- [ [ WITH ]
--- [ BINARY ]
--- [ OIDS ]
--- [ DELIMITER [ AS ] 'delimiter ' ]
--- [ NULL [ AS ] 'null string ' ]
--- [ CSV [ HEADER ]
--- [ QUOTE [ AS ] 'quote' ]
--- [ ESCAPE [ AS ] 'escape' ]
--- [ FORCE NOT NULL column [, ...] ]
---COPY { tablename [ ( column [, ...] ) ] | ( query ) }
--- TO { 'filename' | STDOUT }
--- [ [ WITH ]
--- [ BINARY ]
--- [ OIDS ]
--- [ DELIMITER [ AS ] 'delimiter ' ]
--- [ NULL [ AS ] 'null string ' ]
--- [ CSV [ HEADER ]
--- [ QUOTE [ AS ] 'quote' ]
--- [ ESCAPE [ AS ] 'escape' ]
--- [ FORCE QUOTE column [, ...] ]
-
-COPY country TO STDOUT WITH DELIMITER '|';
-
-COPY country FROM '/usr1/proj/bray/sql/country_data';
-
-COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO
'/usr1/proj/bray/sql/a_list_co';
-
---CREATE AGGREGATE name ( input_data_type [ , ... ] ) (
--- SFUNC = sfunc,
--- STYPE = state_data_type
--- [ , FINALFUNC = ffunc ]
--- [ , INITCOND = initial_condition ]
--- [ , SORTOP = sort_operator ]
---)
---or the old syntax
---CREATE AGGREGATE name (
--- BASETYPE = base_type,
--- SFUNC = sfunc,
--- STYPE = state_data_type
--- [ , FINALFUNC = ffunc ]
--- [ , INITCOND = initial_condition ]
--- [ , SORTOP = sort_operator ]
---)
-
-
---CREATE CAST (sourcetype AS targettype)
--- WITH FUNCTION funcname (argtypes)
--- [ AS ASSIGNMENT | AS IMPLICIT ]
---CREATE CAST (sourcetype AS targettype)
--- WITHOUT FUNCTION
--- [ AS ASSIGNMENT | AS IMPLICIT ]
---CREATE CAST (sourcetype AS targettype)
--- WITH INOUT
--- [ AS ASSIGNMENT | AS IMPLICIT ]
-
-CREATE CAST (bigint AS int4) WITH FUNCTION int4(bigint) AS ASSIGNMENT;
-
---CREATE CONSTRAINT TRIGGER name
--- AFTER event [ OR ... ]
--- ON table_name
--- [ FROM referenced_table_name ]
--- { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } }
--- FOR EACH ROW
--- EXECUTE PROCEDURE funcname ( arguments )
-
---CREATE [ DEFAULT ] CONVERSION name
--- FOR source_encoding TO dest_encoding FROM funcname
-
-CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
-
---CREATE DATABASE name
--- [ [ WITH ] [ OWNER [=] dbowner ]
--- [ TEMPLATE [=] template ]
--- [ ENCODING [=] encoding ]
--- [ LC_COLLATE [=] lc_collate ]
--- [ LC_CTYPE [=] lc_ctype ]
--- [ TABLESPACE [=] tablespace ]
--- [ CONNECTION LIMIT [=] connlimit ] ]
-
-CREATE DATABASE lusiadas;
-
-CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
--- 40 STATEMENTS *******************************************************
-CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
-
-
---CREATE DOMAIN name [ AS ] data_type
--- [ DEFAULT expression ]
--- [ constraint [ ... ] ]
---where constraint is:
---[ CONSTRAINT constraint_name ]
---{ NOT NULL | NULL | CHECK (expression) }
-
-CREATE DOMAIN us_postal_code AS TEXT
- CHECK(
- VALUE ~ '^\\d{5}$'
- OR VALUE ~ '^\\d{5}-\\d{4}$'
- );
-
---CREATE FOREIGN DATA WRAPPER name
--- [ VALIDATOR valfunction | NO VALIDATOR ]
--- [ OPTIONS ( option 'value' [, ... ] ) ]
-
-CREATE FOREIGN DATA WRAPPER dummy;
-
-CREATE FOREIGN DATA WRAPPER postgresql VALIDATOR postgresql_fdw_validator;
-
-CREATE FOREIGN DATA WRAPPER mywrapper
- OPTIONS (debug 'true');
-
---CREATE [ OR REPLACE ] FUNCTION
--- name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } defexpr ] [, ...] ] )
--- [ RETURNS rettype
--- | RETURNS TABLE ( colname coltype [, ...] ) ]
--- { LANGUAGE langname
--- | WINDOW
--- | IMMUTABLE | STABLE | VOLATILE
--- | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
--- | [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
--- | COST execution_cost
--- | ROWS result_rows
--- | SET configuration_parameter { TO value | = value | FROM CURRENT }
--- | AS 'definition'
--- | AS 'obj_file', 'link_symbol'
--- } ...
--- [ WITH ( attribute [, ...] ) ]
-
-CREATE FUNCTION add(integer, integer) RETURNS integer
- AS 'select $1 + $2;'
- LANGUAGE SQL
- IMMUTABLE
- RETURNS NULL ON NULL INPUT;
-
-CREATE OR REPLACE FUNCTION increment(i integer) RETURNS integer AS $$
- BEGIN
- RETURN i + 1;
- END;
-
-CREATE FUNCTION dup(in int, out f1 int, out f2 text)
- AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
- LANGUAGE SQL;
-
-CREATE FUNCTION dup(int) RETURNS dup_result
- AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
- LANGUAGE SQL;
-
-CREATE FUNCTION dup(int) RETURNS TABLE(f1 int, f2 text)
- AS $$ SELECT $1, CAST($1 AS text) || ' is text' $$
- LANGUAGE SQL;
--- 50 STATEMENTS *******************************************************
---CREATE GROUP name [ [ WITH ] option [ ... ] ]
---where option can be:
--- SUPERUSER | NOSUPERUSER
--- | CREATEDB | NOCREATEDB
--- | CREATEROLE | NOCREATEROLE
--- | CREATEUSER | NOCREATEUSER
--- | INHERIT | NOINHERIT
--- | LOGIN | NOLOGIN
--- | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password '
--- | VALID UNTIL 'timestamp'
--- | IN ROLE rolename [, ...]
--- | IN GROUP rolename [, ...]
--- | ROLE rolename [, ...]
--- | ADMIN rolename [, ...]
--- | USER rolename [, ...]
--- | SYSID uid
-
---CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] name ON table [ USING method ]
--- ( { column | ( expression ) } [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ]
[, ..
--- [ WITH ( storage_parameter = value [, ... ] ) ]
--- [ TABLESPACE tablespace ]
--- [ WHERE predicate ]
-
-CREATE UNIQUE INDEX title_idx ON films (title);
-
-CREATE INDEX lower_title_idx ON films ((lower(title)));
-
-CREATE INDEX title_idx_nulls_low ON films (title NULLS FIRST);
-
-CREATE UNIQUE INDEX title_idx ON films (title) WITH (fillfactor = 70);
-
-CREATE INDEX gin_idx ON documents_table (locations) WITH (fastupdate = off);
-
-CREATE INDEX code_idx ON films(code) TABLESPACE indexspace;
-
-CREATE INDEX CONCURRENTLY sales_quantity_index ON sales_table (quantity);
-
---CREATE [ PROCEDURAL ] LANGUAGE name
---CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
--- HANDLER call_handler [ VALIDATOR valfunction ]
-
-CREATE LANGUAGE plpgsql;
-
-CREATE PROCEDURAL LANGUAGE plpgsql;
-
-CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql;
--- 60 STATEMENTS *******************************************************
-CREATE LANGUAGE plsample
- HANDLER plsample_call_handler;
-
---CREATE OPERATOR name (
--- PROCEDURE = funcname
--- [, LEFTARG = lefttype ] [, RIGHTARG = righttype ]
--- [, COMMUTATOR = com_op ] [, NEGATOR = neg_op ]
--- [, RESTRICT = res_proc ] [, JOIN = join_proc ]
--- [, HASHES ] [, MERGES ]
---)
-
-CREATE OPERATOR === (
- LEFTARG = box,
- RIGHTARG = box,
- PROCEDURE = area_equal_procedure,
- COMMUTATOR = ===,
- NEGATOR = !==,
- RESTRICT = area_restriction_procedure,
- JOIN = area_join_procedure,
- HASHES, MERGES
-);
-
---CREATE OPERATOR CLASS name [ DEFAULT ] FOR TYPE data_type
--- USING index_method [ FAMILY family_name ] AS
--- { OPERATOR strategy_number operator_name [ ( op_type, op_type ) ]
--- | FUNCTION support_number [ ( op_type [ , op_type ] ) ] funcname ( argument_type [,
...] )
--- | STORAGE storage_type
--- } [, ... ]
-
-CREATE OPERATOR CLASS gist__int_ops
- DEFAULT FOR TYPE _int4 USING gist AS
- OPERATOR 3 &&,
- OPERATOR 6 = (anyarray, anyarray),
- OPERATOR 7 @>,
- <@,
- OPERATOR 8
- OPERATOR 20 @@ (_int4, query_int),
- FUNCTION 1 g_int_consistent (internal, _int4, int, oid, internal),
- FUNCTION 2 g_int_union (internal, internal),
- FUNCTION 3 g_int_compress (internal),
- FUNCTION 4 g_int_decompress (internal),
- FUNCTION 5 g_int_penalty (internal, internal, internal),
- FUNCTION 6 g_int_picksplit (internal, internal),
- FUNCTION 7 g_int_same (_int4, _int4, internal);
-
---CREATE OPERATOR FAMILY name USING index_method
-
-CREATE OPERATOR FAMILY name USING index_method;
-
---CREATE ROLE name [ [ WITH ] option [ ... ] ]
---where option can be:
--- SUPERUSER | NOSUPERUSER
--- | CREATEDB | NOCREATEDB
--- | CREATEROLE | NOCREATEROLE
--- | CREATEUSER | NOCREATEUSER
--- | INHERIT | NOINHERIT
--- | LOGIN | NOLOGIN
--- | CONNECTION LIMIT connlimit
--- | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password '
--- | VALID UNTIL 'timestamp'
--- | IN ROLE rolename [, ...]
--- | IN GROUP rolename [, ...]
--- | ROLE rolename [, ...]
--- | ADMIN rolename [, ...]
--- | USER rolename [, ...]
--- | SYSID uid
-
-CREATE ROLE jonathan LOGIN;
-
-CREATE USER davide WITH PASSWORD 'jw8s0F4';
-
-CREATE ROLE miriam WITH LOGIN PASSWORD 'jw8s0F4' VALID UNTIL
'2005-01-01';
-
-CREATE ROLE admin WITH CREATEDB CREATEROLE;
-
---CREATE [ OR REPLACE ] RULE name AS ON event
--- TO table [ WHERE condition ]
--- DO [ ALSO | INSTEAD ] { NOTHING | command | ( command ; command ... ) }
-
-CREATE RULE "_RETURN" AS
- ON SELECT TO t1
- DO INSTEAD
- SELECT * FROM t2;
-
-CREATE RULE "_RETURN" AS
- ON SELECT TO t2
- DO INSTEAD
- SELECT * FROM t1;
--- 70 STATEMENTS *******************************************************
-CREATE RULE notify_me AS ON UPDATE TO mytable DO ALSO NOTIFY mytable;
-
---CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ ... ] ]
---CREATE SCHEMA AUTHORIZATION username [ schema_element [ ... ] ]
-
-CREATE SCHEMA myschema;
-
-CREATE SCHEMA AUTHORIZATION joe;
-
-CREATE SCHEMA hollywood
- CREATE TABLE films (title text, release date, awards text[])
- CREATE VIEW winners AS
- SELECT title, release FROM films WHERE awards IS NOT NULL;
-
---CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
--- [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
--- [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
--- [ OWNED BY { table.column | NONE } ]
-
-CREATE SEQUENCE serial START 101;
-
---CREATE SERVER servername [ TYPE 'servertype' ] [ VERSION
'serverversion' ]
--- FOREIGN DATA WRAPPER fdwname
--- [ OPTIONS ( option 'value' [, ... ] ) ]
-
-CREATE SERVER foo FOREIGN DATA WRAPPER "default";
-
-CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname
'foodb', port);
-
---CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name
--- ( [
--- { column_name data_type [ DEFAULT default_expr ] [ column_constraint [ ... ] ]
--- | table_constraint
--- | LIKE parent_table [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS |
INDEXES } ] .
--- [, ... ]
--- ] )
---[ INHERITS ( parent_table [, ... ] ) ]
---[ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
---[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
---[ TABLESPACE tablespace ]
---where column_constraint is:
---[ CONSTRAINT constraint_name ]
---{ NOT NULL |
--- NULL |
--- UNIQUE index_parameters |
--- PRIMARY KEY index_parameters |
--- CHECK ( expression ) |
--- REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ]
--- [ ON DELETE action ] [ ON UPDATE action ] }
---[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
---and table_constraint is:
---[ CONSTRAINT constraint_name ]
---{ UNIQUE ( column_name [, ... ] ) index_parameters |
--- PRIMARY KEY ( column_name [, ... ] ) index_parameters |
--- CHECK ( expression ) |
--- FOREIGN KEY ( column_name [, ... ] ) REFERENCES reftable [ ( refcolumn [, ... ] ) ]
--- [ MATCH FULL | MATCH PARTIAL | MATCH SIMPLE ] [ ON DELETE action ] [ ON UPDATE
action ]
---[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
---index_parameters in UNIQUE and PRIMARY KEY constraints are:
---[ WITH ( storage_parameter [= value] [, ... ] ) ]
---[ USING INDEX TABLESPACE tablespace ]
-
-CREATE TABLE films (
- code char(5) CONSTRAINT firstkey PRIMARY KEY,
- title varchar(40) NOT NULL,
- did integer NOT NULL,
- date_prod date,
- kind varchar(10),
- len interval hour to minute
-);
-
-CREATE TABLE distributors (
- did integer PRIMARY KEY DEFAULT nextval('serial'),
- name varchar(40) NOT NULL CHECK (name <> ”)
-
-);
-
-CREATE TABLE array_int (
- vector int[][]
-);
--- 80 STATEMENTS *******************************************************
-CREATE TABLE films (
- code char(5),
- title varchar(40),
- did integer,
- date_prod date,
- kind varchar(10),
- len interval hour to minute,
- CONSTRAINT production UNIQUE(date_prod)
-);
-
-CREATE TABLE distributors (
- did integer CHECK (did > 100),
- name varchar(40)
-);
-
-CREATE TABLE distributors (
- did integer,
- name varchar(40)
- CONSTRAINT con1 CHECK (did > 100 AND name <> ”)
-);
-
-CREATE TABLE films (
- code char(5),
- title varchar(40),
- did integer,
- date_prod date,
- kind varchar(10),
- len interval hour to minute,
- CONSTRAINT code_title PRIMARY KEY(code,title)
-);
-
-CREATE TABLE films (
- code char(5),
- title varchar(40),
- did integer,
- date_prod date,
- kind varchar(10),
- len interval hour to minute,
- CONSTRAINT code_title PRIMARY KEY(code,title)
-);
-
-CREATE TABLE distributors (
- name varchar(40) DEFAULT 'Luso Films',
- did integer DEFAULT nextval('distributors_serial'),
- modtime timestamp DEFAULT current_timestamp
-);
-
-CREATE TABLE distributors (
- did integer CONSTRAINT no_null NOT NULL,
- name varchar(40) NOT NULL
-);
-
-CREATE TABLE distributors (
- did integer,
- name varchar(40) UNIQUE
-);
-
-CREATE TABLE distributors (
- did integer,
- name varchar(40),
- UNIQUE(name)
-);
-
-CREATE TABLE distributors (
- did integer,
- name varchar(40),
- UNIQUE(name) WITH (fillfactor=70)
-)
-WITH (fillfactor=70);
--- 90 STATEMENTS *******************************************************
-CREATE TABLE cinemas (
- id serial,
- name text,
- location text
-) TABLESPACE diskvol1;
-
---CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name
--- [ (column_name [, ...] ) ]
--- [ WITH ( storage_parameter [= value] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
--- [ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
--- [ TABLESPACE tablespace ]
--- AS query
--- [ WITH [ NO ] DATA ]
-
-CREATE TABLE films_recent AS
- SELECT * FROM films WHERE date_prod >= '2002-01-01';
-
-CREATE TABLE films2 AS
- TABLE films;
-
-CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS
- EXECUTE recentfilms('2002-01-01');
-
---CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory '
-
-CREATE TABLESPACE dbspace LOCATION '/data/dbs';
-
-CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes';
-
---CREATE TEXT SEARCH CONFIGURATION name (
--- PARSER = parser_name |
--- COPY = source_config
---)
-
-CREATE TEXT SEARCH CONFIGURATION my_search_config (
- PARSER = my_parser
-);
-
---CREATE TEXT SEARCH DICTIONARY name (
--- TEMPLATE = template
--- [, option = value [, ... ]]
---)
-
-CREATE TEXT SEARCH DICTIONARY my_russian (
- template = snowball,
- language = russian,
- stopwords = myrussian
-);
-
---CREATE TEXT SEARCH PARSER name (
--- START = start_function ,
--- GETTOKEN = gettoken_function ,
--- END = end_function ,
--- LEXTYPES = lextypes_function
--- [, HEADLINE = headline_function ]
---)
-
-CREATE TEXT SEARCH PARSER my_search_parser (
- START = startNow(),
- GETTOKEN = getToken(),
- END = end(),
- LEXTYPES = getLexTypes()
-);
-
---CREATE TEXT SEARCH TEMPLATE name (
--- [ INIT = init_function , ]
--- LEXIZE = lexize_function
---)
-
-CREATE TEXT SEARCH TEMPLATE my_search_template (
- LEXIZE = lexizeNow()
-);
-
---CREATE TRIGGER name { BEFORE | AFTER } { event [ OR ... ] }
--- ON table [ FOR [ EACH ] { ROW | STATEMENT } ]
--- EXECUTE PROCEDURE funcname ( arguments )
--- 100 STATEMENTS *******************************************************
-CREATE TRIGGER trigger_name BEFORE dawn
- ON table
- EXECUTE PROCEDURE funcname ( 'arg1', 'arg2' );
-
-ALTER TABLE foreign_companies RENAME COLUMN address TO city;
-
-ALTER TABLE us_companies RENAME TO suppliers;
-
-ALTER TABLE old_addresses ALTER COLUMN street SET NOT NULL;
-
-ALTER TABLE new_addresses ALTER COLUMN street DROP NOT NULL;
-
-GRANT EXECUTE ON FUNCTION divideByTwo(numerator int, IN demoninator int) TO george;
-
--- 106 STATEMENTS *******************************************************
Added:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/revoke_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/revoke_test_statements.ddl
(rev 0)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/revoke_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -0,0 +1,7 @@
+REVOKE SELECT ON TABLE purchaseOrders FROM maria,harry;
+
+REVOKE UPDATE, USAGE ON TABLE orderDetails FROM anita,zhi CASCADE;
+
+REVOKE SELECT ON TABLE orders.bills FROM PUBLIC RESTRICT;
+
+REVOKE INSERT(a, b, c) ON TABLE orderSummaries FROM purchases_reader_role;
\ No newline at end of file
Modified:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/standard_test_statements.ddl
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/standard_test_statements.ddl 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/sequencer/ddl/standard_test_statements.ddl 2010-01-05
20:33:13 UTC (rev 1530)
@@ -36,14 +36,3 @@
CREATE TABLE HOTELAVAILABILITY
(HOTEL_ID INT NOT NULL, BOOKING_DATE DATE NOT NULL,
ROOMS_TAKEN INT DEFAULT 0, PRIMARY KEY (HOTEL_ID, BOOKING_DATE));
-
-GRANT SELECT ON TABLE purchaseOrders TO maria,harry;
-
-GRANT UPDATE, USAGE ON TABLE billedOrders TO anita,zhi;
-
-GRANT SELECT ON TABLE orders.bills to PUBLIC;
-
-GRANT INSERT(a, b, c) ON TABLE purchaseOrders TO purchases_reader_role;
-
-
-
Deleted:
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/test_cnd.cnd
===================================================================
---
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/test_cnd.cnd 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/dna-integration-tests/src/test/resources/org/jboss/dna/test/integration/test_cnd.cnd 2010-01-05
20:33:13 UTC (rev 1530)
@@ -1,32 +0,0 @@
-//------------------------------------------------------------------------------
-// N A M E S P A C E S
-//------------------------------------------------------------------------------
-<jcr='http://www.jcp.org/jcr/1.0'>
-<nt='http://www.jcp.org/jcr/nt/1.0'>
-<mix='http://www.jcp.org/jcr/mix/1.0'>
-<ddl='http://www.jboss.org/dna/ddl/1.0'>
-
-//------------------------------------------------------------------------------
-// N O D E T Y P E S
-//------------------------------------------------------------------------------
-
-// =============================================================================
-// STATEMENT
-// =============================================================================
-[ddl:statement] mixin abstract
- - ddl:expression (string) mandatory
- + * (ddl:ddlProblem) = ddl:ddlProblem multiple
-
-// =============================================================================
-// CREATE SCHEMA
-// =============================================================================
-[ddl:schemaDefinition] > ddl:statement mixin
- - ddl:defaultCharacterSetName (STRING)
- + * (ddl:statement) = ddl:statement multiple
-
-// =============================================================================
-// DDL PROBLEM
-// =============================================================================
-[ddl:ddlProblem] mixin
- - ddl:problemLevel (LONG) mandatory
- - ddl:message (STRING) mandatory
\ No newline at end of file
Modified:
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlConstants.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlConstants.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/DdlConstants.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -38,6 +38,7 @@
public static final String DROP = "DROP";
public static final String FOREIGN = "FOREIGN";
public static final String GRANT = "GRANT";
+ public static final String REVOKE = "REVOKE";
public static final String INDEX = "INDEX";
public static final String INSERT = "INSERT";
public static final String UPDATE = "UPDATE";
@@ -99,7 +100,8 @@
public static final String[] STMT_CREATE_TRANSLATION = {CREATE,
"TRANSLATION"};
public static final String[] STMT_ALTER_TABLE = {ALTER, TABLE};
public static final String[] STMT_ALTER_DOMAIN = {ALTER, "DOMAIN"};
- public static final String[] STMT_GRANT = {"GRANT"};
+ public static final String[] STMT_GRANT = {GRANT};
+ public static final String[] STMT_REVOKE = {REVOKE};
public static final String[] STMT_DROP_SCHEMA = {DROP, SCHEMA};
public static final String[] STMT_DROP_TABLE = {DROP, TABLE};
public static final String[] STMT_DROP_VIEW = {DROP, VIEW};
@@ -114,9 +116,9 @@
public final static String[][] SQL_92_ALL_PHRASES = {STMT_CREATE_SCHEMA,
STMT_CREATE_TABLE,
STMT_CREATE_GLOBAL_TEMPORARY_TABLE, STMT_CREATE_LOCAL_TEMPORARY_TABLE,
STMT_CREATE_VIEW, STMT_CREATE_OR_REPLACE_VIEW,
STMT_CREATE_ASSERTION, STMT_CREATE_CHARACTER_SET, STMT_CREATE_COLLATION,
STMT_CREATE_TRANSLATION, STMT_CREATE_DOMAIN,
- STMT_ALTER_TABLE, STMT_ALTER_DOMAIN, STMT_GRANT, STMT_DROP_SCHEMA,
STMT_DROP_TABLE, STMT_DROP_VIEW, STMT_DROP_DOMAIN,
- STMT_DROP_CHARACTER_SET, STMT_DROP_COLLATION, STMT_DROP_TRANSLATION,
STMT_DROP_ASSERTION, STMT_INSERT_INTO,
- STMT_SET_DEFINE};
+ STMT_ALTER_TABLE, STMT_ALTER_DOMAIN, STMT_GRANT, STMT_REVOKE,
STMT_DROP_SCHEMA, STMT_DROP_TABLE, STMT_DROP_VIEW,
+ STMT_DROP_DOMAIN, STMT_DROP_CHARACTER_SET, STMT_DROP_COLLATION,
STMT_DROP_TRANSLATION, STMT_DROP_ASSERTION,
+ STMT_INSERT_INTO, STMT_SET_DEFINE};
// <schema definition>
// | <table definition>
Modified:
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlLexicon.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlLexicon.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlLexicon.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -100,6 +100,12 @@
public static final Name TYPE_GRANT_ON_COLLATION_STATEMENT = new
BasicName(Namespace.URI, "grantOnCollationStatement");
public static final Name TYPE_GRANT_ON_CHARACTER_SET_STATEMENT = new
BasicName(Namespace.URI, "grantOnCharacterSetStatement");
public static final Name TYPE_GRANT_ON_TRANSLATION_STATEMENT = new
BasicName(Namespace.URI, "grantOnTranslationStatement");
+ public static final Name TYPE_REVOKE_STATEMENT = new BasicName(Namespace.URI,
"revokeStatement");
+ public static final Name TYPE_REVOKE_ON_TABLE_STATEMENT = new
BasicName(Namespace.URI, "revokeOnTableStatement");
+ public static final Name TYPE_REVOKE_ON_DOMAIN_STATEMENT = new
BasicName(Namespace.URI, "revokeOnDomainStatement");
+ public static final Name TYPE_REVOKE_ON_COLLATION_STATEMENT = new
BasicName(Namespace.URI, "revokeOnCollationStatement");
+ public static final Name TYPE_REVOKE_ON_CHARACTER_SET_STATEMENT = new
BasicName(Namespace.URI, "revokeOnCharacterSetStatement");
+ public static final Name TYPE_REVOKE_ON_TRANSLATION_STATEMENT = new
BasicName(Namespace.URI, "revokeOnTranslationStatement");
public static final Name TYPE_SET_STATEMENT = new BasicName(Namespace.URI,
"setStatement");
public static final Name TYPE_INSERT_STATEMENT = new BasicName(Namespace.URI,
"insertStatement");
Modified:
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlParser.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlParser.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/StandardDdlParser.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -276,6 +276,8 @@
stmtNode = parseSetStatement(tokens, node);
} else if (tokens.matches(GRANT)) {
stmtNode = parseGrantStatement(tokens, node);
+ } else if( tokens.matches(REVOKE)) {
+ stmtNode = parseRevokeStatement(tokens, node);
}
if (stmtNode == null) {
@@ -807,39 +809,38 @@
tokens.consume("GRANT");
- if( tokens.canConsume("ALL", "PRIVILEGES")) {
- allPrivileges = true;
- } else {
- parseGrantPrivileges(tokens, privileges);
- }
- tokens.consume("ON");
+ if( tokens.canConsume("ALL", "PRIVILEGES")) {
+ allPrivileges = true;
+ } else {
+ parseGrantPrivileges(tokens, privileges);
+ }
+ tokens.consume("ON");
- if( tokens.canConsume("DOMAIN") ) {
- String name = parseName(tokens);
- grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_DOMAIN_STATEMENT);
- } else if( tokens.canConsume("COLLATION")) {
- String name = parseName(tokens);
- grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_COLLATION_STATEMENT);
- } else if( tokens.canConsume("CHARACTER", "SET")) {
- String name = parseName(tokens);
- grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_CHARACTER_SET_STATEMENT);
- } else if( tokens.canConsume("TRANSLATION")) {
- String name = parseName(tokens);
- grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_TRANSLATION_STATEMENT);
- } else {
- tokens.canConsume(TABLE); // OPTIONAL
- String name = parseName(tokens);
- grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_TABLE_STATEMENT);
- }
-
+ if( tokens.canConsume("DOMAIN") ) {
+ String name = parseName(tokens);
+ grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_DOMAIN_STATEMENT);
+ } else if( tokens.canConsume("COLLATION")) {
+ String name = parseName(tokens);
+ grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_COLLATION_STATEMENT);
+ } else if( tokens.canConsume("CHARACTER", "SET")) {
+ String name = parseName(tokens);
+ grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_CHARACTER_SET_STATEMENT);
+ } else if( tokens.canConsume("TRANSLATION")) {
+ String name = parseName(tokens);
+ grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_TRANSLATION_STATEMENT);
+ } else {
+ tokens.canConsume(TABLE); // OPTIONAL
+ String name = parseName(tokens);
+ grantNode = nodeFactory().node(name, parentNode,
TYPE_GRANT_ON_TABLE_STATEMENT);
+ }
- // Attach privileges to grant node
- for( AstNode node : privileges ) {
- node.setParent(grantNode);
- }
- if( allPrivileges ) {
- grantNode.setProperty(ALL_PRIVILEGES, allPrivileges);
- }
+ // Attach privileges to grant node
+ for( AstNode node : privileges ) {
+ node.setParent(grantNode);
+ }
+ if( allPrivileges ) {
+ grantNode.setProperty(ALL_PRIVILEGES, allPrivileges);
+ }
tokens.consume("TO");
@@ -850,7 +851,7 @@
} while( tokens.canConsume(COMMA));
if( tokens.canConsume("WITH", "GRANT", "OPTION"))
{
- grantNode.setProperty(ALL_PRIVILEGES, allPrivileges);
+ grantNode.setProperty(WITH_GRANT_OPTION, "WITH GRANT OPTION");
}
markEndOfStatement(tokens, grantNode);
@@ -909,6 +910,93 @@
} while( tokens.canConsume(COMMA));
}
+
+ protected AstNode parseRevokeStatement( DdlTokenStream tokens,
+ AstNode parentNode ) throws ParsingException
{
+ assert tokens != null;
+ assert parentNode != null;
+ assert tokens.matches(REVOKE);
+
+ markStartOfStatement(tokens);
+
+ // <revoke statement> ::=
+ // REVOKE [ GRANT OPTION FOR ]
+ // <privileges>
+ // ON <object name>
+ // FROM <grantee> [ { <comma> <grantee> }... ]
<drop behavior>
+
+ AstNode revokeNode = null;
+ boolean allPrivileges = false;
+ boolean withGrantOption = false;
+
+ List<AstNode> privileges = new ArrayList<AstNode>();
+
+ tokens.consume("REVOKE");
+
+ withGrantOption = tokens.canConsume("WITH", "GRANT",
"OPTION");
+
+ if( tokens.canConsume("ALL", "PRIVILEGES")) {
+ allPrivileges = true;
+ } else {
+ parseGrantPrivileges(tokens, privileges);
+ }
+ tokens.consume("ON");
+
+ if( tokens.canConsume("DOMAIN") ) {
+ String name = parseName(tokens);
+ revokeNode = nodeFactory().node(name, parentNode,
TYPE_REVOKE_ON_DOMAIN_STATEMENT);
+ } else if( tokens.canConsume("COLLATION")) {
+ String name = parseName(tokens);
+ revokeNode = nodeFactory().node(name, parentNode,
TYPE_REVOKE_ON_COLLATION_STATEMENT);
+ } else if( tokens.canConsume("CHARACTER", "SET")) {
+ String name = parseName(tokens);
+ revokeNode = nodeFactory().node(name, parentNode,
TYPE_REVOKE_ON_CHARACTER_SET_STATEMENT);
+ } else if( tokens.canConsume("TRANSLATION")) {
+ String name = parseName(tokens);
+ revokeNode = nodeFactory().node(name, parentNode,
TYPE_REVOKE_ON_TRANSLATION_STATEMENT);
+ } else {
+ tokens.canConsume(TABLE); // OPTIONAL
+ String name = parseName(tokens);
+ revokeNode = nodeFactory().node(name, parentNode,
TYPE_REVOKE_ON_TABLE_STATEMENT);
+ }
+
+ // Attach privileges to grant node
+ for( AstNode node : privileges ) {
+ node.setParent(revokeNode);
+ }
+
+ if( allPrivileges ) {
+ revokeNode.setProperty(ALL_PRIVILEGES, allPrivileges);
+ }
+
+ tokens.consume("FROM");
+
+ do {
+ String grantee = parseName(tokens);
+ nodeFactory().node(grantee, revokeNode, GRANTEE);
+ } while( tokens.canConsume(COMMA));
+
+ String behavior = null;
+
+ if (tokens.canConsume("CASCADE")) {
+ behavior = "CASCADE";
+ } else if (tokens.canConsume("RESTRICT")) {
+ behavior = "RESTRICT";
+ }
+
+ if (behavior != null) {
+ revokeNode.setProperty(DROP_BEHAVIOR, behavior);
+ }
+
+ if( withGrantOption ) {
+ revokeNode.setProperty(WITH_GRANT_OPTION, "WITH GRANT OPTION");
+ }
+
+ markEndOfStatement(tokens, revokeNode);
+
+ return revokeNode;
+ }
+
/**
* Catch-all method to parse unknown (not registered or handled by sub-classes)
statements.
*
Modified:
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlConstants.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlConstants.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlConstants.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -199,7 +199,6 @@
static final String[] STMT_NOAUDIT = {"NOAUDIT"};
static final String[] STMT_PURGE = {"PURGE"};
static final String[] STMT_RENAME = {"RENAME"};
- static final String[] STMT_REVOKE = {"REVOKE"};
static final String[] STMT_ROLLBACK_TO_SAVEPOINT = {"ROLLBACK",
"TO", "SAVEPOINT"};
static final String[] STMT_ROLLBACK_WORK = {"ROLLBACK", "WORK"};
static final String[] STMT_ROLLBACK = {"ROLLBACK"};
@@ -217,7 +216,7 @@
static final String[][] MISC_PHRASES = {
STMT_ANALYZE, STMT_ASSOCIATE_STATISTICS, STMT_AUDIT, STMT_COMMIT, STMT_COMMENT_ON,
STMT_DISASSOCIATE_STATISTICS,
STMT_EXPLAIN_PLAN, STMT_FLASHBACK, STMT_LOCK_TABLE, STMT_MERGE, STMT_NOAUDIT,
STMT_PURGE,
- STMT_RENAME, STMT_REVOKE, STMT_ROLLBACK_TO_SAVEPOINT, STMT_ROLLBACK_WORK,
STMT_ROLLBACK, STMT_SAVEPOINT, STMT_TRUNCATE
+ STMT_RENAME, STMT_ROLLBACK_TO_SAVEPOINT, STMT_ROLLBACK_WORK, STMT_ROLLBACK,
STMT_SAVEPOINT, STMT_TRUNCATE
};
// CREATE TABLE, CREATE VIEW, and GRANT statements.
Modified:
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlParser.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlParser.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/main/java/org/jboss/dna/sequencer/ddl/dialect/oracle/OracleDdlParser.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -267,8 +267,6 @@
return parseStatement(tokens, STMT_PURGE, parentNode, TYPE_PURGE_STATEMENT);
} else if (tokens.matches(STMT_RENAME)) {
return parseStatement(tokens, STMT_RENAME, parentNode,
TYPE_RENAME_STATEMENT);
- } else if (tokens.matches(STMT_REVOKE)) {
- return parseStatement(tokens, STMT_REVOKE, parentNode,
TYPE_REVOKE_STATEMENT);
} else if (tokens.matches(STMT_ROLLBACK)) {
return parseStatement(tokens, STMT_ROLLBACK, parentNode,
TYPE_ROLLBACK_STATEMENT);
} else if (tokens.matches(STMT_ROLLBACK_WORK)) {
@@ -580,7 +578,19 @@
// return super.parseGrantStatement(tokens, parentNode);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.sequencer.ddl.StandardDdlParser#parseRevokeStatement(org.jboss.dna.sequencer.ddl.DdlTokenStream,
org.jboss.dna.sequencer.ddl.node.AstNode)
+ */
@Override
+ protected AstNode parseRevokeStatement( DdlTokenStream tokens,
+ AstNode parentNode ) throws ParsingException
{
+ return parseStatement(tokens, STMT_REVOKE, parentNode, TYPE_REVOKE_STATEMENT);
+ }
+
+ @Override
protected AstNode parseAlterTableStatement( DdlTokenStream tokens,
AstNode parentNode ) throws
ParsingException {
assert tokens != null;
Modified:
trunk/extensions/dna-sequencer-ddl/src/test/java/org/jboss/dna/sequencer/ddl/StandardDdlParserTest.java
===================================================================
---
trunk/extensions/dna-sequencer-ddl/src/test/java/org/jboss/dna/sequencer/ddl/StandardDdlParserTest.java 2010-01-05
19:16:20 UTC (rev 1529)
+++
trunk/extensions/dna-sequencer-ddl/src/test/java/org/jboss/dna/sequencer/ddl/StandardDdlParserTest.java 2010-01-05
20:33:13 UTC (rev 1530)
@@ -847,4 +847,17 @@
assertThat(true, is(success));
assertThat(rootNode.getChildCount(), is(4));
}
+
+ @Test
+ public void shouldParseRevokeStatements() {
+ printTest("shouldParseRevokeStatements()");
+ String content = "REVOKE SELECT ON TABLE purchaseOrders FROM
maria,harry;" + NEWLINE
+ + "REVOKE UPDATE, USAGE ON TABLE purchaseOrders FROM anita,zhi
CASCADE;" + NEWLINE
+ + "REVOKE SELECT ON TABLE orders.bills FROM PUBLIC RESTRICT;" +
NEWLINE
+ + "REVOKE INSERT(a, b, c) ON TABLE purchaseOrders FROM
purchases_reader_role;";
+
+ boolean success = parser.parse(content, rootNode);
+ assertThat(true, is(success));
+ assertThat(rootNode.getChildCount(), is(4));
+ }
}