## org.eclipse.emf.cdo.server.db.mapping
Interface ITypeMapping

    public interface ITypeMapping

Mapping of single values to and from the database.

Since:
  2.0

Method Summary
`void` `createDBField(org.eclipse.net4j.db.ddl.IDBTable table)` Creates the DBField and adds it to the given table.
`void` `createDBField(org.eclipse.net4j.db.ddl.IDBTable table, java.lang.String fieldName)` Creates the DBField and adds it to the given table.
`org.eclipse.emf.ecore.EStructuralFeature` `getFeature()`
`org.eclipse.net4j.db.ddl.IDBField` `getField()`
`java.lang.Object` `readValue(java.sql.ResultSet resultSet, int i)` Read a value from a `ResultSet` and convert it from the DB to the CDO representation.
`void` `readValueToRevision(java.sql.ResultSet resultSet, int i, InternalCDORevision revision)` Read a value from a `ResultSet`, convert it from the DB to the CDO representation and set it to the feature of the revision.
`void` `setValue(java.sql.PreparedStatement stmt, int index, java.lang.Object value)` Set the given value to the JDBC `PreparedStatement` using an appropriate `setXxx` method.
`void` `setValueFromRevision(java.sql.PreparedStatement stmt, int index, InternalCDORevision value)` Set a value of the given revision to the JDBC `PreparedStatement` using an appropriate `setXxx` method.

Method Detail

### getFeature

    org.eclipse.emf.ecore.EStructuralFeature getFeature()

  Returns:
    The feature which is associated with this mapping.

### getField

    org.eclipse.net4j.db.ddl.IDBField getField()

  Returns:
    The db field which is associated with this mapping.

### createDBField

    void createDBField(org.eclipse.net4j.db.ddl.IDBTable table)

  Creates the DBField and adds it to the given table. The name of the DBField is derived from the feature.

  Parameters:
    `table` - the table to add this field to.

### createDBField

    void createDBField(org.eclipse.net4j.db.ddl.IDBTable table,
                       java.lang.String fieldName)

  Creates the DBField and adds it to the given table. The name of the DBField is explicitly determined by the corresponding parameter.

  Parameters:
    `table` - the table to add this field to.
    `fieldName` - the name for the DBField.

### setValue

    void setValue(java.sql.PreparedStatement stmt,
                  int index,
                  java.lang.Object value)
                  throws java.sql.SQLException

  Set the given value to the JDBC `PreparedStatement` using an appropriate `setXxx` method.

  Parameters:
    `stmt` - the prepared statement to set the value
    `index` - the index to use for the `setXxx` method.
    `value` - the value to set.
  Throws:
    `java.sql.SQLException` - if the `setXxx` throws it.

### setValueFromRevision

    void setValueFromRevision(java.sql.PreparedStatement stmt,
                              int index,
                              InternalCDORevision value)
                              throws java.sql.SQLException

  Set a value of the given revision to the JDBC `PreparedStatement` using an appropriate `setXxx` method. The feature from which the value is taken is determined by `getFeature()`.

  Parameters:
    `stmt` - the prepared statement to set the value
    `index` - the index to use for the `setXxx` method.
    `revision` - the revision to get the value to set from.
  Throws:
    `java.sql.SQLException` - if the `setXxx` throws it.

### readValue

    java.lang.Object readValue(java.sql.ResultSet resultSet,
                               int i)
                               throws java.sql.SQLException

  Read a value from a `ResultSet` and convert it from the DB to the CDO representation.

  Parameters:
    `resultSet` - the result set to read from
    `i` - the column index in the result set to read from
  Returns:
    the read value
  Throws:
    `java.sql.SQLException` - if reading the value throws an SQLException

### readValueToRevision

    void readValueToRevision(java.sql.ResultSet resultSet,
                             int i,
                             InternalCDORevision revision)
                             throws java.sql.SQLException

  Read a value from a `ResultSet`, convert it from the DB to the CDO representation and set it to the feature of the revision. The feature is determined by getFeature()

  Parameters:
    `resultSet` - the result set to read from
    `i` - the column index in the result set to read from
    `revision` - the revision to which the value should be set.
  Throws:
    `java.sql.SQLException` - if reading the value throws an SQLException

Copyright (c) 2004 - 2009 Eike Stepper (Berlin, Germany) and others. All Rights Reserved.