db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r329453 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
Date Sat, 29 Oct 2005 17:38:05 GMT
Author: tomdz
Date: Sat Oct 29 10:38:00 2005
New Revision: 329453

URL: http://svn.apache.org/viewcvs?rev=329453&view=rev
Log:
Fix for DDLUTILS-29 as suggested by Alexandre Borgoltz

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java?rev=329453&r1=329452&r2=329453&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java Sat Oct 29
10:38:00 2005
@@ -274,6 +274,22 @@
             {
                 Column col = new Column();
 
+                // As suggested by Alexandre Borgoltz, we're reading the COLUMN_DEF first
because Oracle
+                // has problems otherwise (it seemingly requires a LONG column to be the
first to be read)
+                // See also DDLUTILS-29
+                String columnDefaultValue = getValueAsString(columnData, "COLUMN_DEF", availableColumns,
null);
+
+                if (columnDefaultValue != null)
+                {
+                    // Sometimes the default comes back with parenthesis around it (jTDS/mssql)
+                    Matcher m = _defaultPattern.matcher(columnDefaultValue);
+
+                    if (m.matches())
+                    {
+                        columnDefaultValue = m.group(1);
+                    }
+                    col.setDefaultValue(columnDefaultValue);
+                }
                 col.setName(getValueAsString(columnData, "COLUMN_NAME", availableColumns,
"UNKNOWN"));
                 col.setTypeCode(getValueAsInt(columnData, "DATA_TYPE", availableColumns,
java.sql.Types.OTHER));
                 col.setPrecisionRadix(getValueAsInt(columnData, "NUM_PREC_RADIX", availableColumns,
10));
@@ -291,19 +307,6 @@
                     col.setPrimaryKey(false);
                 }
 
-                // sometimes the default comes back with parenthesis around it (jTDS/mssql)
-                String columnDefaultValue = getValueAsString(columnData, "COLUMN_DEF", availableColumns,
null);
-
-                if (columnDefaultValue != null)
-                {
-                    Matcher m = _defaultPattern.matcher(columnDefaultValue);
-
-                    if (m.matches())
-                    {
-                        columnDefaultValue = m.group(1);
-                    }
-                    col.setDefaultValue(columnDefaultValue);
-                }
                 columns.add(col);
             }
             return columns;



Mime
View raw message