Database Engines:odbc

Configuration using DacSession:setProperty() Professional

After a session object was established, these properties can be either read only or also modified using the :setProperty() method. The assignable properties will influence subsequent operations on that session, like DbCreate() or DbUseArea(). The readonly attributes are either properties determined by the driver or are properties configured by a preceding call to DbeInfo().

Constants for DacSession:setProperty()
Constant *) Data type Description
ODBCSSN_CONCURRENCY a N ODBC concurrency setting as numeric ID.
ODBCSSN_CURRENT_DATABASE ro C String holding database name.
ODBCSSN_CURSORTYPE a N ODBC cursor type as numeric ID.
ODBCSSN_DATATYPES ro C String of supported data types.
ODBCSSN_DBMS_NAME ro C Product name of the database
ODBCSSN_DBMS_VERSION ro C Version number of the database as ##.##.####
ODBCSSN_DRIVERODBC_VERSION a C ODBC version of driver
ODBCSSN_DROP_BEFORE_CREATE a L Issue DROP before CREATE automatically on DbCreate().
ODBCSSN_INDEX_AUTOOPEN a L If .T., auto open an index for CREATE (XPP->ODBC type mapping).
ODBCSSN_LONGDATA_THRESHOLD a N Data length to optimize long data access
ODBCSSN_MORE_RESULTS a N number of result set, if more expected
ODBCSSN_NATIVE_ERROR_INFO a L Enable NATIVE Error in :getLastMessage().
ODBCSSN_ODBC_TO_XPP ro A Array holding data type mapping information for USE (ODBC->XPP type mapping).
ODBCSSN_SCROLLABLE a N Scroll attribute of ODBC cursor as numeric ID.
ODBCSSN_SENSITIVITY a N ODBC cursor sensitivity as numeric ID.
ODBCSSN_SERVER_NAME ro C Name of the data server or service
ODBCSSN_SQLSTATE_INFO a L Include SQLSTATE in :getLastMessage().
ODBCSSN_TIMESTAMP_AS_DATE a L map SQL timestamps to Xbase++-Date
ODBCSSN_USE_CURSOR_LIB ro L Use ODBC cursor library (see DbeInfo()).
ODBCSSN_XPP_TO_ODBC ro A Array holding data type mapping information
  1. ro=READONLY , a=ASSIGNABLE

ODBCSSN_CONCURRENCY and ODBCDBO_CONCURRENCY

Set the concurrency type for the next workarea to open. The value might have been changed after opening a new workarea, see DbInfo().

Values for the ODBC concurrency attribute
Constant Description
ODBC_CONCUR_LOCK Pessimistic locking
ODBC_CONCUR_READONLY No write, no locking
ODBC_CONCUR_ROWVER *) Optimistic locking, cheapest method
ODBC_CONCUR_VALUES Optimistic locking, if rowver not available.
ODBC_VALUE_UNCHANGED The attribute is not changed, that means that the call to the respective API is skipped.
  1. default

ODBCSSN_CURRENT_DATABASE

The name of the database the session is connected to. In case of a file-based ODBC driver, this usually is a directory or the full qualified filename of the data file.

ODBCSSN_CURSORTYPE (and ODBCDBO_CURSORTYPE)

Set the cursor type for the next workarea to open. The cursor type can have a different value after opening a new workarea, see DbInfo().

Values for the ODBC cursor type
Constant Description
ODBC_CURSOR_AUTOMATCH *) Match cursor type depending on ODBC driver.
ODBC_CURSOR_DYNAMIC Result set reflects all changes.
ODBC_CURSOR_FORWARD_ONLY Cursor skips forward only.
ODBC_CURSOR_KEYSET Cursor rows are determined by keyset.
ODBC_CURSOR_STATIC Result set is a snapshot copy.
ODBC_VALUE_UNCHANGED The attribute is not changed, that means that the call to the respective API is skipped.
  1. default

ODBCSSN_DATATYPES

A string containing all Xbase++ data type characters which are supported by this session.

ODBCSSN_DBMS_NAME

Returns the name or the product name of the database management system which is currently connected to that session.

ODBCSSN_DBMS_VERSION

Returns the version of the database management system which is currently connected to that session as a formatted string using the picture ##.##.####.

ODBCSSN_DRIVERODBC_VERSION

Returns the ODBC version fo the driver. This version depicts the version of ODBC the driver was programmed for. It is used inside of ODBCDBE to work with drivers of different ODBC versions. The value can be modified in case a driver does not work correctly on the version level reported. The value is of the data type string and is formatted as ##.##.

ODBCSSN_DROP_BEFORE_CREATE

The DbCreate() function usually destroys the table (and it's content!) without warning before creating a new table. If this is not desired, set ODBCSSN_DROP_BEFORE_CREATE to .F.

ODBCSSN_INDEX_AUTOOPEN

Auto-opening an index in the context of SQL is handled as follows: If an SELECT - statement having an ORDER BY clause was passed to dbUseArea(), the expression of the ORDER BY clause is used as the index expression. Otherwise, the catalog is queried for the first known index expression. This index will be open after dbUseArea().

ODBCSSN_LONGDATA_THRESHOLD

Long data are data that can be of variable length, and therefore need special attention on read and on write. The ODBCDBE will handle long data of the length up to ODBCSSN_LONGDATA_THRESHOLD byte like fixed data. Changing this value might be necessary to either optimize data access or to turn off the special handling because the ODBC driver is not capable of handling variable length data in every case.

ODBCSSN_MORE_RESULTS

If more than one result set is expected for an SQL command, it is possible to determine which result set to retrieve in the workarea by setting this property. The numbering of result sets starts with 1.

ODBCSSN_NATIVE_ERROR_INFO

The native SQL error will be included in the form like

[-4] 

ODBCSSN_ODBC_TO_XPP

This is the data type mapping used on USE.

ODBCSSN_SCROLLABLE and ODBCDBO_SCROLLABLE

Set the scrollability of the cursor for the next workarea to open. The value might have been changed after opening a new workarea, see DbInfo().

Values for the scrollability attribute
Constant Description
ODBC_NONSCROLLABLE Cursor can scroll forward only
ODBC_SCROLLABLE *) Cursor can scroll in all directions
ODBC_VALUE_UNCHANGED The attribute is not changed, that means that the call to the respective API is skipped.
  1. default

ODBCSSN_SENSITIVITY and ODBCDBO_SENSITIVITY Set the sensitivity of the cursor for the next workarea to open. The value might have been changed after opening a new workarea, see DbInfo().

Values for the sensitivity attribute
Constant Description
ODBC_INSENSITIVE Don't detect changes of other cursors.
ODBC_SENSITIVE Detect changes of other cursors.
ODBC_UNSPECIFIED *) Don't care if changes can occur.
ODBC_VALUE_UNCHANGED The attribute is not changed, that means that the call to the respective API is skipped.

ODBCSSN_SERVER_NAME

Returns the name of the server the DBMS is running on. Some drivers return the network name of the server (ie. MS-SQL Server), some the name of the database service (ie. Oracle).

ODBCSSN_SQLSTATE_INFO

The SQL state will be included in the form like

[HY002] 

ODBCSSN_TIMESTAMP_AS_DATE

Map all SQL-timestamp types (ie.DATETIME, TIMESTAMP etc.) to Xbase++ - Date (XPP_DATE or Valtype(x)=="D"). If the individual remapping of data types using DbInfo() goal is to map timestamps as date, it is simpler to set this session property. Note: If a timestamp is mapped to a date, only the date-part is accessible, the time-part cannot be read or written.

ODBCSSN_USE_CURSOR_LIB

Check if the cursor library could be used if it was configured by DbeInfo(COMPONENT_DICTIONARY, ODBCDBE_USE_CURSOR_LIB) before creating this session.

ODBCSSN_XPP_TO_ODBC

This is the data type mapping used on DbCreate().

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.