mirror of https://github.com/apache/openjpa.git
OPENJPA-1326:
Set schema names for Sybase when creating new indexes and primary keys. Submitted By : BJ Reed git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@889772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4515e2f5da
commit
82aece9711
|
@ -23,6 +23,7 @@ import java.math.BigDecimal;
|
|||
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;
|
||||
|
@ -30,6 +31,7 @@ import java.util.Arrays;
|
|||
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;
|
||||
|
@ -312,6 +314,33 @@ public class SybaseDictionary
|
|||
return ConcreteClassGenerator.newInstance(sybaseConnectionImpl, conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
Loading…
Reference in New Issue