Author: tv
Date: Tue Nov 23 21:56:25 2010
New Revision: 1038355
URL: http://svn.apache.org/viewvc?rev=1038355&view=rev
Log:
Attempt to fix case-sensitivity and Oracle metadata problems
Modified:
db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
Modified: db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
URL:
http://svn.apache.org/viewvc/db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java?rev=1038355&r1=1038354&r2=1038355&view=diff
==============================================================================
--- db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java
(original)
+++ db/torque/village/trunk/src/java/com/workingdogs/village/Schema.java Tue
Nov 23 21:56:25 2010
@@ -32,6 +32,8 @@ import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
/**
* The Schema object represents the <a href="Column.html">Columns</a> in a
database table. It contains a collection of <a
@@ -54,7 +56,7 @@ public final class Schema
/** TODO: DOCUMENT ME! */
private Column [] columns;
- private Hashtable columnNumberByName;
+ private Map columnNumberByName;
/** TODO: DOCUMENT ME! */
private static final Hashtable schemaCache = new Hashtable();
@@ -186,15 +188,11 @@ public final class Schema
{
String sql = "SELECT " + columnsAttribute + " FROM " +
tableName + " WHERE 1 = -1";
- /*
- * prepare dummy query as recommended by John Goodson in
- *
http://www.theserverside.com/news/1365579/Using-Database-MetaData-methods-appropriately
- */
stmt = conn.prepareStatement(sql);
- // query is never executed on the server - only prepared
if (stmt != null)
{
+ stmt.executeQuery();
tableSchema = this;
tableSchema.setTableName(tableName);
tableSchema.setAttributes(columnsAttribute);
@@ -461,7 +459,7 @@ public final class Schema
{
this.numberOfColumns = meta.getColumnCount();
columns = new Column[numberOfColumns() + 1];
- columnNumberByName = new Hashtable((int) ((1.25 * numberOfColumns) +
1));
+ columnNumberByName = new TreeMap(String.CASE_INSENSITIVE_ORDER);
String connURL = (conn != null) ? conn.getMetaData().getURL() : null;
@@ -604,7 +602,7 @@ public final class Schema
{
List cols = new ArrayList();
String tableName = null;
- columnNumberByName = new Hashtable();
+ columnNumberByName = new TreeMap(String.CASE_INSENSITIVE_ORDER);
while (dbMeta.next())
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]