Added method to check if a column is nullable.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1976 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -429,6 +429,24 @@ public class JDBCUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not the specified column accepts null values.
|
||||||
|
*
|
||||||
|
* @return true if the column accepts null values, false if it does not
|
||||||
|
* (or its nullability is unknown)
|
||||||
|
*/
|
||||||
|
public static boolean isColumnNullable (Connection conn, String table,
|
||||||
|
String column)
|
||||||
|
throws SQLException
|
||||||
|
{
|
||||||
|
ResultSet rs = getColumnMetaData(conn, table, column);
|
||||||
|
try {
|
||||||
|
return rs.getString("IS_NULLABLE").equals("YES");
|
||||||
|
} finally {
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size for the specified column in the specified table. For
|
* Returns the size for the specified column in the specified table. For
|
||||||
* char or date types this is the maximum number of characters, for numeric
|
* char or date types this is the maximum number of characters, for numeric
|
||||||
|
|||||||
Reference in New Issue
Block a user