Database/Drivers/MySQL Native/SDBC(X) Interface

From Apache OpenOffice Wiki
Jump to: navigation, search

Database drivers in OpenOffice.org need to adhere to the SDBC API, alternatively to (selected parts of) the SDBCX API.

Those APIs were originally modeled after JDBC (quite some times ago), but didn't evolve with JDBC. Also, not all the API defined in SDBC(X) is actually used in OpenOffice.org.

SDBC

The concepts in SDBC are pretty similar to what you expect from other database APIs - connections, (prepared) statements, result sets, ... nothing really surprising.

Implementing SDBC (well, parts thereof) is necessary and sufficient for a driver to function in OpenOffice.org. Admittedly, there simply is no comprehensive specification of what OOo expects a driver to support. A significant part of a driver development is to debug OOo and find out what it expects from the driver :-\

Services

Looking over the interfaces, a minimal driver implementation for OOo probably needs to support

Interfaces

Talking about interfaces, this means

  • XDriver (checked)
  • XConnection (checked)
  • XDatabaseMetaData (checked)
  • XStatement (checked)
  • XPreparedStatement (checked)
  • XParameters (checked)
  • XResultSet* (checked)
  • XRow (checked)
  • XRowUpdate (checked)

Methods

Talking about methods .... well, there certainly is functionality which is not needed by OOo (e.g. everything related to batch processing), however, it's difficult to exactly draw the line. If in doubt, you should ask your debugger, or look into the existing drivers.

SDBCX

SDBCX provides additional functionality on top of SDBC. Basically, an SDBCX driver can provide instances for basic database objects (tables, for instance), offering more functionality on them than the SDBC layer can provide. In some sense, SDBCX is an additional level of abstraction for functionality which in other APIs would usually need to be implemented back-end specific.

For instance, for altering the definition of a table, the XAlterTable interface, together with the ColumnDescriptor services, is defined. This allows Base's UI to just work on those objects, and letting the driver care for the details required by the concrete back-end.

Functional Units

  • XAlterTable, needed for altering table definitions. Consequently, the driver needs to implement the Table service, which is where XAlterTable is available. A number of other services are also implicated by the, e.g. objects describing table columns.
  • Extending the SDBC-level driver implementation to be an SDBCX-driver is necessary as entry point for the table objects. Also, an SDBCX driver allows creating catalogs, which could be used for creating logical databases on the MySQL server.
  • User administration is supported by the services and interfaces around XUsersSupplier and Users.
Personal tools