[jboss-svn-commits] JBL Code SVN: r29897 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance: persistence and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 2 11:05:24 EST 2009


Author: whitingjr
Date: 2009-11-02 11:05:24 -0500 (Mon, 02 Nov 2009)
New Revision: 29897

Added:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/IntegrityConstraint.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/HSQLDB.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/MySQL.java
Log:
New classes to control database constraints for each vendor.

Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/IntegrityConstraint.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/IntegrityConstraint.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/IntegrityConstraint.java	2009-11-02 16:05:24 UTC (rev 29897)
@@ -0,0 +1,32 @@
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * 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.
+  *
+  * This software 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.jbossts.performance.persistence;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+public interface IntegrityConstraint
+{
+   public void relax(Connection connection) throws SQLException;
+   public void constrain(Connection connection) throws SQLException;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/HSQLDB.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/HSQLDB.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/HSQLDB.java	2009-11-02 16:05:24 UTC (rev 29897)
@@ -0,0 +1,46 @@
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * 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.
+  *
+  * This software 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.jbossts.performance.persistence.vendor;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.jboss.jbossts.performance.persistence.IntegrityConstraint;
+
+public class HSQLDB implements IntegrityConstraint
+{
+
+   @Override
+   public void constrain(Connection connection)
+      throws SQLException
+   {
+      connection.prepareStatement("set referential_integrity TRUE").execute();
+   }
+
+   @Override
+   public void relax(Connection connection)
+      throws SQLException
+   {
+      connection.prepareStatement("set referential_integrity FALSE").execute();
+   }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/MySQL.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/MySQL.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/persistence/vendor/MySQL.java	2009-11-02 16:05:24 UTC (rev 29897)
@@ -0,0 +1,43 @@
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * 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.
+  *
+  * This software 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.jbossts.performance.persistence.vendor;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.jboss.jbossts.performance.persistence.IntegrityConstraint;
+
+public class MySQL implements IntegrityConstraint
+{
+   @Override
+   public void constrain(Connection connection) throws SQLException
+   {
+      connection.prepareStatement("SET foreign_key_checks = 1").execute();
+   }
+
+   @Override
+   public void relax(Connection connection) throws SQLException
+   {
+      connection.prepareStatement("SET foreign_key_checks = 0").execute();
+   }
+}



More information about the jboss-svn-commits mailing list