Merged "Open PHP Declaration" and "Open Include File" into one action "Open Declarati...
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / sql / SQLMetaDataResults.java
index 61b3333..4f7d988 100644 (file)
@@ -42,10 +42,12 @@ public class SQLMetaDataResults extends SQLResultSetResults {
 
                List columns = new ArrayList();
                columns.add(new Column("ColumnName", "", 0)); //$NON-NLS-1$
-               columns.add(new Column("Type", "", 0)); //$NON-NLS-1$
+               columns.add(new Column("Type Name", "", 0)); //$NON-NLS-1$
                columns.add(new Column("Size", "", 0)); //$NON-NLS-1$
+               columns.add(new Column("Scale", "", 0)); //$NON-NLS-1$
                columns.add(new Column("Nullable", "", 0)); //$NON-NLS-1$
                columns.add(new Column("AutoIncrement", "", 0)); //$NON-NLS-1$
+               columns.add(new Column("Type", "", 0)); //$NON-NLS-1$
                setColumns((Column[]) columns.toArray(new Column[columns.size()]));
                
                ResultSetMetaData metaData = set.getMetaData();
@@ -55,14 +57,21 @@ public class SQLMetaDataResults extends SQLResultSetResults {
                        Vector row = new Vector();
                        row.addElement(metaData.getColumnName(i));
                        row.addElement(metaData.getColumnTypeName(i));
-                       int textSize = metaData.getColumnDisplaySize(i);
-                       int precision = metaData.getPrecision(i);
-                       int scale = metaData.getScale(i);
-                       if (scale == 0 && precision == 0) {
-                               row.addElement(Integer.toString(precision));
-                       } else {
-                               row.addElement(textSize + ", " + precision + ", " + scale); //$NON-NLS-1$ //$NON-NLS-2$
+                       long precision = 0;
+                       try {
+                               precision = metaData.getPrecision(i);
+            } catch (Throwable t) {
+               // Do nothing. An exception can be generated by some very large row sizes, like BLOB in Oracle.
+               // Then getPrecision() will generate an exception. So we ignore it and go on.
+            }
+                       if (precision == 0) {
+                               precision = metaData.getColumnDisplaySize(i);
                        }
+                       int scale = metaData.getScale(i);
+                       
+                       row.addElement(new Long(precision));
+                       row.addElement(new Integer(scale));
+                       
                        int nullable = metaData.isNullable(i);
                        if (nullable == ResultSetMetaData.columnNoNulls) {
                                row.addElement("Not Null"); //$NON-NLS-1$
@@ -80,9 +89,9 @@ public class SQLMetaDataResults extends SQLResultSetResults {
                                        : Boolean.FALSE)
                                        .toString());
                        rowList.add(new Row(row));
+                       row.addElement(new Integer(metaData.getColumnType(i)));
                }
                setRows((Row[]) rowList.toArray(new Row[rowList.size()]));
-               set.close();
        }
 
        public boolean isMetaData() {