openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r889769 - /openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
Date Fri, 11 Dec 2009 19:06:30 GMT
Author: mikedd
Date: Fri Dec 11 19:06:29 2009
New Revision: 889769

URL: http://svn.apache.org/viewvc?rev=889769&view=rev
Log:
OPENJPA-1326:
Set schema names for Sybase when creating new indexes and primary keys
Submitted By : BJ Reed

Modified:
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java?rev=889769&r1=889768&r2=889769&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
(original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
Fri Dec 11 19:06:29 2009
@@ -22,6 +22,7 @@
 import java.math.BigInteger;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
 import java.util.Arrays;
@@ -29,6 +30,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.schema.ForeignKey;
+import org.apache.openjpa.jdbc.schema.Index;
 import org.apache.openjpa.jdbc.schema.PrimaryKey;
 import org.apache.openjpa.jdbc.schema.Table;
 import org.apache.openjpa.jdbc.schema.Unique;
@@ -281,6 +283,33 @@
     }
 
     /**
+     * Create a new primary key from the information in the schema metadata.
+     */
+    protected PrimaryKey newPrimaryKey(ResultSet pkMeta)
+        throws SQLException {
+        PrimaryKey pk = new PrimaryKey();
+        pk.setSchemaName(pkMeta.getString("table_owner"));
+        pk.setTableName(pkMeta.getString("table_name"));
+        pk.setColumnName(pkMeta.getString("column_name"));
+        pk.setName(pkMeta.getString("index_name"));
+        return pk;
+    }
+
+    /**
+     * Create a new index from the information in the index metadata.
+     */
+    protected Index newIndex(ResultSet idxMeta)
+        throws SQLException {
+        Index idx = new Index();
+        idx.setSchemaName(idxMeta.getString("table_owner"));
+        idx.setTableName(idxMeta.getString("table_name"));
+        idx.setColumnName(idxMeta.getString("column_name"));
+        idx.setName(idxMeta.getString("index_name"));
+        idx.setUnique(!idxMeta.getBoolean("non_unique"));
+        return idx;
+    }
+
+    /**
      * Connection wrapper to cache the {@link Connection#getCatalog} result,
      * which takes a very long time with the Sybase Connection (and
      * which we frequently invoke).



Mime
View raw message