From 8074cba6360d6c4abbbe3a447a809e68a0a9384d Mon Sep 17 00:00:00 2001 From: zell Date: Tue, 20 Nov 2007 19:06:18 +0000 Subject: [PATCH] Utility method from David Hoover. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2258 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/jdbc/JDBCUtil.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/java/com/samskivert/jdbc/JDBCUtil.java b/src/java/com/samskivert/jdbc/JDBCUtil.java index 7364f21f..24fb8e76 100644 --- a/src/java/com/samskivert/jdbc/JDBCUtil.java +++ b/src/java/com/samskivert/jdbc/JDBCUtil.java @@ -438,6 +438,21 @@ public class JDBCUtil } } + /** + * Returns a string representation of the default value for the specified column in the + * specified table. This may be null. + */ + public static String getColumnDefaultValue (Connection conn, String table, String column) + throws SQLException + { + ResultSet rs = getColumnMetaData(conn, table, column); + try { + return rs.getString("COLUMN_DEF"); + } finally { + rs.close(); + } + } + /** * Adds a column (with name 'cname' and definition 'cdef') to the specified table. *