Documentation Archive Developer
Search
[an error occurred while processing this directive] PATH  Documentation > WebObjects 4.5 > InformixEOAdaptor Reference

Table of Contents

InformixEOAdaptor


Framework: System/Library/Frameworks/InformixEOAdaptor.framework
Header File Directories: System/Library/Frameworks/InformixEOAdaptor.framework/Headers

Introduction

The InformixEOAdaptor framework is a set of classes that allow your programs to connect to an Informix server. These classes provide Informix-specific method implementations for the EOAccess framework's EOAdaptor, EOAdaptorChannel, EOAdaptorContext, and EOSQLExpression abstract classes.

The following table lists the classes in the InformixEOAdaptor Framework and provides a brief description of each class.


ClassDescription
InformixAdaptorRepresents a single connection to a Informix database server, and is responsible for keeping login and model information, performing Informix-specific formatting of SQL expressions, and reporting errors.
InformixChannelRepresents an independent communication channel to the database server its InformixAdaptor is connected to.
InformixContextRepresents a single transaction scope on the database server to which its adaptor object is connected.
InformixSQLExpressionDefines how to build SQL statements for InformixChannels.


The Connection Dictionary

The connection dictionary contains items needed to connect to an Informix server, such as the database name (it's common to omit the user name and password from the connection dictionary, and prompt users to enter those values in a login panel). The keys of this dictionary identify the information the server expects, and the values of those keys are the values that the adaptor uses when trying to connect to the server.

The Informix adaptor defines string constants for use as connection dictionary keys:

See the InformixAdaptor class specification for more information on the connection dictionary key constants.


Locking

All adaptors use the database server's native locking facilities to lock rows on the server. In the Informix adaptor locking is determined by the isolation level, which is implemented in InformixChannel. Locking occurs when:


Data Type Mapping

Every adaptor provides a mapping between each server data type and the Objective-C type to which a database value will be coerced when it's fetched from the database. The following table lists the mapping used by InformixAdaptor.


Informix Data TypeJava Data Type
VARCHARNSString
NVARCHARNSString
DECIMALNSDecimalNumber
MONEYNSDecimalNumber
BYTENSData
TEXTNSString
DATENSCalendarDate
INTEGERNSNumber
SMALLINTNSNumber
NCHARNSString
CHARNSNumber
SERIALNSNumber
FLOATNSNumber
SMALLFLOATNSNumber
DATETIME YEAR TO SECONDNSCalendarDate
INTERVALNSString

The type mapping methods-externalTypesWithModel:, internalTypeForExternalType:model:, and isValidQualifierType:model:-allow for an adaptor to supplement its set of type mappings with additional mappings for user-defined database types. InformixAdaptor does not make use of the model argument if one is provided.


Prototype Attributes

The InformixEOAdaptor Framework provides the following set of prototype attributes:


NameExternal TypeValue Class NameOther Attributes
binaryIDBYTENSData 
cityVARCHARNSStringcolumnName = CITY width = 50
dateDATETIME YEAR TO SECONDNSCalendarDatecolumnName = ""
longTextTEXTNSString 
moneyINTEGERNSDecimalNumbercolumnName = ""
phoneNumberVARCHARNSStringcolumnName = PHONE width = 20
rawImageBYTENSDatacolumnName = RAW_IMAGE
stateVARCHARNSStringcolumnName = STATE width = 2
streetAddressVARCHARNSStringcolumnName = STREET_ADDRESS width = 100
tiffImageBYTENSImageadaptorValueConversionMethodName = TIFFRepresentation columnName = PHOTO valueFactoryMethodName = "imageWithData:"
uniqueIDINTEGERNSNumbercolumnName = "" valueType = i
zipCodeVARCHARNSStringcolumnName = ZIP width = 10


Generating Primary Keys

Each adaptor provides a database-specific implementation of the method primaryKeyForNewRowWithEntity: for generating primary keys. The InformixChannel's implementation uses a table named eo_sequence_table to keep track of the next available primary key value for a given table. The table contains a row for each table for which the adaptor provides primary key values. The statement used to create the eo_sequence_table is:

create table eo_sequence_table (
    table_name varchar(32,0),
    counter integer
)

InformixChannel uses a stored procedure named eo_pk_for_table to access and maintain the primary key counter in eo_sequence_table. The stored procedure is defined as follows:

create procedure
eo_pk_for_table (tname varchar(32))
returning int;
    define cntr int;

    update EO_SEQUENCE_TABLE
    set COUNTER = COUNTER + 1
    where TABLE_NAME = tname;

    select COUNTER into cntr
    from EO_SEQUENCE_TABLE
    where TABLE_NAME = tname;

    return cntr;
end procedure;

The stored procedure increments the counter in the eo_sequence_table row for the specified table, selects the counter value, and returns it. InformixChannel executes this eo_pk_for_table stored procedure from primaryKeyForNewRowWithEntity: and returns the stored procedure's return value.

To use InformixChannel's database-specific primary key generation mechanism, be sure that your database accommodates the adaptor's scheme. To modify your database so that it supports the adaptor's mechanism for generating primary keys, use EOModeler. For more information on this topic, see Enterprise Objects Framework Developer's Guide.


Bind Variables

The InformixAdaptor uses bind variables. A bind variable is a placeholder used in an SQL statement that is replaced with an actual value after the database server determines an execution plan. You use the following methods to operate on bind variables:


Table of Contents