# ODBC

The MamBase ODBC driver implements basic ODBC 3.0 features taking into account the MamBase functionality itself.

ODBC functionality implementation level is ODBC Core.

The driver usage examples are located in the samples directory of the MamBase distribution.

# Supported functionality

Connection management functions:

  • SQLDriverConnect
  • SQLDisconnect

Allocation functions:

  • SQLAllocHandle
  • SQLFreeHandle
  • SQLAllocEnv
  • SQLFreeEnv
  • SQLAllocConnect
  • SQLFreeConnect
  • SQLAllocStmt
  • SQLFreeStmt
  • SQLAllocDesc
  • SQLFreeDesc

Data retrieval functions:

  • SQLPrepare
  • SQLExecute
  • SQLExecDirect
  • SQLGetData
  • SQLFetch
  • SQLNumResultCols
  • SQLRowCount
  • SQLDescribeCol
  • SQLNativeSql

Diagnosis functions:

  • SQLGetDiagRec
  • SQLGetDiagField
  • SQLError

# Not supported functionality

The following ODBC 3.0 functions are not supported by version 1.0 of the driver:

Also, the following functions are just "stub" ones, they always return the "Not implemented" error.

Transaction functions:

  • SQLEndTran
  • SQLTransact

Attribute functions:

  • SQLSetConnectAttr
  • SQLGetConnectAttr
  • SQLGetStmtAttr
  • SQLSetStmtAttr
  • SQLSetEnvAttr

Parameter functions:

  • SQLBindParameter
  • SQLPutData
  • SQLParamData
  • SQLNumParams

Cursor functions:

  • SQLCloseCursor
  • SQLGetCursorName
  • SQLSetCursorName

# Non-standard functionality

See below notes related to MamBase implementation of particular ODBC functions.

# SQLDriverConnect

Only the SQL_DRIVER_NOPROMPT connection mode is implemented. An attempt to create connections using other modes returns the "Not implemented" error.

Connection string attribute names:

  • DRIVER — driver name, has to be "MamBase Driver";
  • SERVER — database server name or address;
  • PORT — database server TCP port (optional, 3020 by default);
  • UID — database user name;
  • PWD — database user password.

# SQLGetDiagField

The folowing identification codes are implemented (parameter DiagIdentifier):

  • SQL_DIAG_NATIVE
  • SQL_DIAG_MESSAGE_TEXT
  • SQL_DIAG_SQLSTATE

An attempt to call the function using other codes returns the SQL_NO_DATA status.

# SQLGetDiagRec

Only the latest error is kept; RecNumber greater than 1 forces an error.

# SQLPrepare

Querying is immediately performed after the function call as parameterized queries are not implemented.

# SQLFetch

Fetching records after the latest one returns the SQL_ERROR status.

# SQLNumResultCols

One has to call the function after every call of SQLFetch(); in graph model, the number of fields is not a constant value.

# SQLRowCount

The name is reserved; the functionality is not implemented. In MamBase, it is impossible to get the number of result records before iteration over the result set is finished.

# SQLNativeSql

The name is reserved; the functionality is not implemented. ODBC "metalanguage" is not supported.