Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-03-09 09:17:49 +0000
committerEike Stepper2010-03-09 09:17:49 +0000
commit1a7c0e55d510a2cf92e88c02e08bdbc4390f5b8e (patch)
treee42c2893163a0e1aded5fef4f146618eab1d2d68 /plugins/org.eclipse.net4j.db
parent8d286969baa52274cc834e92b8e1fa7f6003f19e (diff)
downloadcdo-1a7c0e55d510a2cf92e88c02e08bdbc4390f5b8e.tar.gz
cdo-1a7c0e55d510a2cf92e88c02e08bdbc4390f5b8e.tar.xz
cdo-1a7c0e55d510a2cf92e88c02e08bdbc4390f5b8e.zip
[256936] Support for Offline Mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256936
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java85
1 files changed, 84 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
index bcedc47b3a..fe73d4dcaa 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -44,6 +44,89 @@ public final class DBUtil
{
}
+ /**
+ * For debugging purposes ONLY!
+ *
+ * @deprecated Should only be used when debugging.
+ * @since 3.0
+ */
+ @Deprecated
+ public static void sqlDump(Connection conn, String sql)
+ {
+ ResultSet rs = null;
+
+ try
+ {
+ TRACER.format("Dumping output of {0}", sql); //$NON-NLS-1$
+ rs = conn.createStatement().executeQuery(sql);
+ int numCol = rs.getMetaData().getColumnCount();
+
+ StringBuilder row = new StringBuilder();
+ for (int c = 1; c <= numCol; c++)
+ {
+ row.append(String.format("%10s | ", rs.getMetaData().getColumnLabel(c))); //$NON-NLS-1$
+ }
+
+ TRACER.trace(row.toString());
+
+ row = new StringBuilder();
+ for (int c = 1; c <= numCol; c++)
+ {
+ row.append("-----------+--"); //$NON-NLS-1$
+ }
+
+ TRACER.trace(row.toString());
+
+ while (rs.next())
+ {
+ row = new StringBuilder();
+ for (int c = 1; c <= numCol; c++)
+ {
+ row.append(String.format("%10s | ", rs.getString(c))); //$NON-NLS-1$
+ }
+
+ TRACER.trace(row.toString());
+ }
+
+ row = new StringBuilder();
+ for (int c = 1; c <= numCol; c++)
+ {
+ row.append("-----------+-"); //$NON-NLS-1$
+ }
+
+ TRACER.trace(row.toString());
+ }
+ catch (SQLException ex)
+ {
+ // Do nothing
+ }
+ finally
+ {
+ close(rs);
+ }
+ }
+
+ /**
+ * For debugging purposes ONLY!
+ *
+ * @deprecated Should only be used when debugging.
+ * @since 3.0
+ */
+ @Deprecated
+ public static void sqlDump(IDBConnectionProvider connectionProvider, String sql)
+ {
+ Connection connection = connectionProvider.getConnection();
+
+ try
+ {
+ sqlDump(connection, sql);
+ }
+ finally
+ {
+ close(connection);
+ }
+ }
+
public static IDBSchema createSchema(String name)
{
return new DBSchema(name);

Back to the top