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

Table of Contents

ODBCAdaptor


Inherits from: EOAdaptor : NSObject
Package: com.apple.yellow.odbceoadaptor


Class Description


An ODBCAdaptor represents a single connection to an ODBC database server, and is responsible for keeping login and model information, performing ODBC-specific formatting of SQL expressions, and reporting errors.

ODBC (Open Data Base Connectivity) defines a standard interface that Windows applications can use to access any data source. Unlike the other Enterprise Objects Frameworks adaptors that support a single type of database, the ODBC adaptor supports any data source that has an ODBC driver. Consequently, in addition to having standard adaptor features, the ODBC adaptor also manages information relating to the driver and to the data types defined by the data source the driver supports.

The ODBCAdaptor class doesn't support nested transactions.




Constants


ODBCAdaptor defines the following string constants for use as connection dictionary keys.


Constant Corresponding value in the connection dictionary
dataSourceKey The name of the data source to connect to.
userNameKey The name of the user to log in as.
passwordKey The user's password.
connectionStringKey The complete string used to connect to the database. If this key is present in the dictionary, dataSourceKey, userNameKey, and passwordKey are ignored.
typeInfoKey Information about the types supported by the driver.
driverInfoKey Information about driver, including the driver name, version, and so on.

For more information on the connection dictionary, see "The Connection Dictionary" in the ODBCEOAdaptor Framework introduction.

Additionally, ODBCAdaptor defines a string constant for use as a key in an exception's userInfo dictionary.


Constant Corresponding value in an exception's userInfo dictionary
SQLStatesKey An array of strings. Each string is a five character code corresponding to an ODBC SQL state.



Method Types


Mapping external types to internal types
assignExternalTypeForAttribute
externalTypeForOdbcType
getOdbcInfoWithConnectionDictionary
odbcTypeForExternalType
odbcTypeForStringRepresentation
resetOdbcInfoWithConnectionDictionary
stringRepresentationForOdbcType
Access information in the connection dictionary
odbcConnectionString
driverInfoForModel
typeInfoForModel
driverInfo
typeInfo


Static Methods



assignExternalTypeForAttribute

public static void assignExternalInfoForAttribute(EOAttribute attribute)

Sets the external information for attribute based on the internal type, precision, and width.

driverInfoForModel

public static NSDictionary driverInfoForModel(com.apple.yellow.eoaccess.EOModel model)

Returns an NSDictionary containing the driver information cached in the connection dictionary of model. If the information is not yet cached in model, connects to the database to get it.

See Also: typeInfoForModel, driverInfo, typeInfo



externalTypeForOdbcType

public static String externalTypeForOdbcType( int type, com.apple.yellow.eoaccess.EOModel model)

Returns the external type that represents the best match for an ODBC type in model.

getOdbcInfoWithConnectionDictionary

public static NSDictionary getOdbcInfoWithConnectionDictionary(NSDictionary connectionDictionary)

Sets up the typeInfo and driverInfo dictionaries in connectionDictionary, and returns an updated connection dictionary. Creates an ODBCAdaptor, ODBCContext, and ODBCChannel, and connects to the database to get the information for the typeInfo and driverInfo dictionaries.

odbcTypeForExternalType

public static String odbcTypeForExternalType( String externalType, com.apple.yellow.eoaccess.EOModel model)

Returns the ODBC type for externalType, as defined in the typeInfo dictionary in model's connection dictionary.

odbcTypeForStringRepresentation

public static int odbcTypeForStringRepresentation(String type)

Returns the ODBC type (such as SQL_CHAR) for type (such as @"CHAR"). The method stringRepresentationForOdbcType performs the opposite function: returning a string for a specified ODBC type. These methods are used in conjunction to encode ODBC types in the typeInfo dictionary.

resetOdbcInfoWithConnectionDictionary

public static NSDictionary resetOdbcInfoWithConnectionDictionary(NSDictionary connectionDictionary)

Removes the typeInfo and driverInfo dictionaries from a copy of connectionDictionary and returns the modified connection dictionary.

stringRepresentationForOdbcType

public static String stringRepresentationForOdbcType(int type)

Returns the string representation of type-for example, for the type SQL_CHAR this method would return the string @"CHAR". The method odbcTypeForStringRepresentation performs the opposite function: returning the ODBC type for a specified string. These methods are used in conjunction to encode ODBC types in the typeInfo dictionary.

typeInfoForModel

public static NSDictionary typeInfoForModel(com.apple.yellow.eoaccess.EOModel model)

Returns an NSDictionary containing the type information cached in the connection dictionary of model. If the information is not yet cached in model, connects to the database to get it.

See Also: driverInfoForModel, driverInfo, typeInfo




Instance Methods



driverInfo

public NSDictionary driverInfo()

Returns an NSDictionary containing the driver information cached in the receiver's model's connection dictionary. If the information is not yet cached in the model, connects to the database to get it.

See Also: typeInfo



odbcConnectionString

public String odbcConnectionString()

Returns the user name, password, and data source as a string that's used to connect to the database.

typeInfo

public NSDictionary typeInfo()

Returns an NSDictionary containing the type information cached in the receiver's model's connection dictionary. If the information is not yet cached in the model, connects to the database to get it.

See Also: driverInfo, driverInfoForModel, typeInfoForModel




Table of Contents