org.objectweb.cjdbc.driver
Class Field

java.lang.Object
  extended byorg.objectweb.cjdbc.driver.Field
All Implemented Interfaces:
java.io.Serializable

public class Field
extends java.lang.Object
implements java.io.Serializable

Field is our private implementation of ResultSetMetaData, holding the information for one column.

The first version was inspired from the MM MySQL driver by Mark Matthews.

Version:
1.0
Author:
Emmanuel Cecchet , Nicolas Modrzyk , Marc Herbert
See Also:
DriverResultSet, ControllerResultSet, Serialized Form

Field Summary
private  java.lang.String columnClassName
           
private  int columnDisplaySize
           
private  java.lang.String fieldName
           
private  boolean isAutoIncrement
           
private  boolean isCaseSensitive
           
private  boolean isCurrency
           
private  boolean isDefinitelyWritable
           
private  int isNullable
           
private  boolean isReadOnly
           
private  boolean isSearchable
           
private  boolean isSigned
           
private  boolean isWritable
           
private  int precision
           
private  int scale
           
private  int sqlType
           
private  java.lang.String tableName
           
private  java.lang.String typeName
           
 
Constructor Summary
Field(CJDBCInputStream in)
          Creates a new Field object, deserializing it from an input stream.
Field(java.lang.String table, java.lang.String name, int columnDisplaySize, int sqlType, java.lang.String typeName, java.lang.String columnClassName)
          Create a new field with some default common values.
Field(java.lang.String table, java.lang.String name, int columnDisplaySize, int sqlType, java.lang.String typeName, java.lang.String columnClassName, boolean isAutoIncrement, boolean isCaseSensitive, boolean isCurrency, int isNullable, boolean isReadOnly, boolean isWritable, boolean isDefinitelyWritable, boolean isSearchable, boolean isSigned, int precision, int scale)
          Creates a new Field instance.
 
Method Summary
 java.lang.String getColumnClassName()
          Returns the Java class used by the mapping.
 int getColumnDisplaySize()
           
 java.lang.String getFieldName()
          Gets the field name.
 java.lang.String getFullName()
          Gets the full name: "tableName.fieldName"
 int getPrecision()
           
 int getScale()
           
 int getSqlType()
          Returns the JDBC type code.
 java.lang.String getTableName()
          Gets the table name.
 java.lang.String getTypeName()
          Returns the SQL type name used by the database.
 boolean isAutoIncrement()
           
 boolean isCaseSensitive()
           
 boolean isCurrency()
           
 boolean isDefinitelyWritable()
           
 int isNullable()
           
 boolean isReadOnly()
           
 boolean isSearchable()
           
 boolean isSigned()
           
 boolean isWritable()
           
 void sendToStream(CJDBCOutputStream out)
          Serialize the Field on the output stream by sending only the needed parameters to reconstruct it on the controller.
 void setFieldName(java.lang.String name)
          Sets the field name.
 java.lang.String toString()
          Returns the full name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tableName

private java.lang.String tableName

fieldName

private java.lang.String fieldName

columnDisplaySize

private int columnDisplaySize

sqlType

private int sqlType

typeName

private java.lang.String typeName

columnClassName

private java.lang.String columnClassName

isAutoIncrement

private boolean isAutoIncrement

isCaseSensitive

private boolean isCaseSensitive

isCurrency

private boolean isCurrency

isNullable

private int isNullable

isReadOnly

private boolean isReadOnly

isWritable

private boolean isWritable

isDefinitelyWritable

private boolean isDefinitelyWritable

isSearchable

private boolean isSearchable

isSigned

private boolean isSigned

precision

private int precision

scale

private int scale
Constructor Detail

Field

public Field(java.lang.String table,
             java.lang.String name,
             int columnDisplaySize,
             int sqlType,
             java.lang.String typeName,
             java.lang.String columnClassName)
Create a new field with some default common values.

Parameters:
table - the table name
name - the field name
columnDisplaySize - the column display size
sqlType - the SQL type
typeName - the type name
columnClassName - the column class name

Field

public Field(java.lang.String table,
             java.lang.String name,
             int columnDisplaySize,
             int sqlType,
             java.lang.String typeName,
             java.lang.String columnClassName,
             boolean isAutoIncrement,
             boolean isCaseSensitive,
             boolean isCurrency,
             int isNullable,
             boolean isReadOnly,
             boolean isWritable,
             boolean isDefinitelyWritable,
             boolean isSearchable,
             boolean isSigned,
             int precision,
             int scale)
Creates a new Field instance.

Parameters:
table - the table name
name - the field name
columnDisplaySize - the column display size
sqlType - the SQL type
typeName - the type name
columnClassName - the column class name
isAutoIncrement - true if field is auto incremented
isCaseSensitive - true if field is case sensitive
isCurrency - true if field is currency
isNullable - indicates the nullability of the field
isReadOnly - true if field is read only
isWritable - true if field is writable
isDefinitelyWritable - true if field is definetly writable
isSearchable - true if field is searchable
isSigned - true if field is signed
precision - decimal precision
scale - number of digits to right of decimal point

Field

public Field(CJDBCInputStream in)
      throws java.io.IOException
Creates a new Field object, deserializing it from an input stream. Has to mirror the serialization method below.

Parameters:
in - input stream
Throws:
java.io.IOException - if a stream error occurs
Method Detail

sendToStream

public void sendToStream(CJDBCOutputStream out)
                  throws java.io.IOException
Serialize the Field on the output stream by sending only the needed parameters to reconstruct it on the controller. Has to mirror the deserialization method above.

Parameters:
out - destination stream
Throws:
java.io.IOException - if a stream error occurs

getTableName

public java.lang.String getTableName()
Gets the table name.

Returns:
a String value

getFieldName

public java.lang.String getFieldName()
Gets the field name.

Returns:
a String value
See Also:
setFieldName(java.lang.String)

getFullName

public java.lang.String getFullName()
Gets the full name: "tableName.fieldName"

Returns:
a String value

setFieldName

public void setFieldName(java.lang.String name)
Sets the field name.

Parameters:
name - the new field name
See Also:
getFieldName()

toString

public java.lang.String toString()
Returns the full name.

Returns:
String value
See Also:
getFullName()

getSqlType

public int getSqlType()
Returns the JDBC type code.

Returns:
int Type according to Types
See Also:
ResultSetMetaData.getColumnType(int)

getTypeName

public java.lang.String getTypeName()
Returns the SQL type name used by the database.

Returns:
the SQL type name
See Also:
ResultSetMetaData.getColumnTypeName(int)

getColumnClassName

public java.lang.String getColumnClassName()
Returns the Java class used by the mapping.

See Also:
ResultSetMetaData.getColumnClassName(int)

getColumnDisplaySize

public int getColumnDisplaySize()
See Also:
ResultSetMetaData.getColumnDisplaySize(int)

isAutoIncrement

public boolean isAutoIncrement()
See Also:
ResultSetMetaData.isAutoIncrement(int)

isCaseSensitive

public boolean isCaseSensitive()
See Also:
ResultSetMetaData.isCaseSensitive(int)

isCurrency

public boolean isCurrency()
See Also:
ResultSetMetaData.isCurrency(int)

isDefinitelyWritable

public boolean isDefinitelyWritable()
See Also:
ResultSetMetaData.isDefinitelyWritable(int)

isNullable

public int isNullable()
See Also:
ResultSetMetaData.isNullable(int)

isReadOnly

public boolean isReadOnly()
See Also:
ResultSetMetaData.isReadOnly(int)

isWritable

public boolean isWritable()
See Also:
ResultSetMetaData.isWritable(int)

isSearchable

public boolean isSearchable()
See Also:
ResultSetMetaData.isSearchable(int)

isSigned

public boolean isSigned()
See Also:
ResultSetMetaData.isSigned(int)

getPrecision

public int getPrecision()
See Also:
ResultSetMetaData.getPrecision(int)

getScale

public int getScale()
See Also:
ResultSetMetaData.getScale(int)


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.