I am increasingly dissatisfied with ColumnDefinition's existence. As a step towards its phasing out, make it a mutable datadump for Depot's nefarious benefit.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2500 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -274,8 +274,7 @@ public abstract class BaseLiaison implements DatabaseLiaison
|
|||||||
*/
|
*/
|
||||||
public String expandDefinition (ColumnDefinition def)
|
public String expandDefinition (ColumnDefinition def)
|
||||||
{
|
{
|
||||||
return expandDefinition(
|
return expandDefinition(def.type, def.nullable, def.unique, def.defaultValue);
|
||||||
def.getType(), def.isNullable(), def.isUnique(), def.getDefaultValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int executeQuery (Connection conn, String query)
|
protected int executeQuery (Connection conn, String query)
|
||||||
|
|||||||
@@ -25,6 +25,16 @@ package com.samskivert.jdbc;
|
|||||||
*/
|
*/
|
||||||
public class ColumnDefinition
|
public class ColumnDefinition
|
||||||
{
|
{
|
||||||
|
public String type;
|
||||||
|
public boolean nullable;
|
||||||
|
public boolean unique;
|
||||||
|
public String defaultValue;
|
||||||
|
|
||||||
|
public ColumnDefinition ()
|
||||||
|
{
|
||||||
|
this(null);
|
||||||
|
}
|
||||||
|
|
||||||
public ColumnDefinition (String type)
|
public ColumnDefinition (String type)
|
||||||
{
|
{
|
||||||
this(type, false, false, null);
|
this(type, false, false, null);
|
||||||
@@ -33,42 +43,9 @@ public class ColumnDefinition
|
|||||||
public ColumnDefinition (
|
public ColumnDefinition (
|
||||||
String type, boolean nullable, boolean unique, String defaultValue)
|
String type, boolean nullable, boolean unique, String defaultValue)
|
||||||
{
|
{
|
||||||
if (type == null) {
|
this.type = type;
|
||||||
throw new IllegalArgumentException("cannot build column definition without type");
|
this.nullable = nullable;
|
||||||
}
|
this.unique = unique;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
_type = type;
|
|
||||||
_nullable = nullable;
|
|
||||||
_unique = unique;
|
|
||||||
_defaultValue = defaultValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the SQL type of this column, e.g. INTEGER. */
|
|
||||||
public String getType ()
|
|
||||||
{
|
|
||||||
return _type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Determines whether or not this column should allow NULL values. */
|
|
||||||
public boolean isNullable ()
|
|
||||||
{
|
|
||||||
return _nullable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Determines whether or not this column should reject duplicate values. */
|
|
||||||
public boolean isUnique ()
|
|
||||||
{
|
|
||||||
return _unique;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the value to insert into this column instead of nulls, if any. */
|
|
||||||
public String getDefaultValue ()
|
|
||||||
{
|
|
||||||
return _defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String _type;
|
|
||||||
protected boolean _nullable;
|
|
||||||
protected boolean _unique;
|
|
||||||
protected String _defaultValue;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user