Changeset: dfde8f752cbc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfde8f752cbc
Modified Files:
        java/src/nl/cwi/monetdb/util/SQLExporter.java
Branch: Jun2010
Log Message:

don't crash when trying to print an invalid view

This actually should never happen, but for some reason it happens on
Int.64.32.d.1 for the JdbcClient dump test now.  This test currently
fails differently on every platform in scary ways indicating something's
very wrong, but make the dumping code resistent against this case anyway.


diffs (25 lines):

diff -r 7825b21349dd -r dfde8f752cbc 
java/src/nl/cwi/monetdb/util/SQLExporter.java
--- a/java/src/nl/cwi/monetdb/util/SQLExporter.java     Wed Aug 11 10:10:54 
2010 +0200
+++ b/java/src/nl/cwi/monetdb/util/SQLExporter.java     Wed Aug 11 10:40:31 
2010 +0200
@@ -67,10 +67,17 @@
                        if (!tbl.next()) throw new SQLException("Whoops no data 
for " + name);
 
                        // This will probably only work for MonetDB
-                       out.print("CREATE " + type + " " +
-                               (!useSchema ? dq(schema) + "." : "") + 
dq(name));
-                       out.print(" AS ");
-                       
out.println(tbl.getString("REMARKS").replaceFirst("create view [^ ]+ as", 
"").trim());
+                       String remarks = tbl.getString("REMARKS");
+                       if (remarks == null) {
+                               out.println("-- invalid " + type + " " +
+                                               (!useSchema ? dq(schema) + "." 
: "") + dq(name) +
+                                               ": no definition found");
+                       } else {
+                               out.print("CREATE " + type + " " +
+                                       (!useSchema ? dq(schema) + "." : "") + 
dq(name));
+                               out.print(" AS ");
+                               out.println(remarks.replaceFirst("create view 
[^ ]+ as", "").trim());
+                       }
                        return;
                }
 
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to