Difference between revisions of "ODBCConn"

From Free Pascal wiki
Jump to navigationJump to search
(initial description of ODBCConn)
 
(elaborated a bit: wrote Overview section + added stubs for followin sections)
Line 1: Line 1:
 
The ODBCConn unit implements an SQLdb connection to ODBC data sources.  
 
The ODBCConn unit implements an SQLdb connection to ODBC data sources.  
  
In Lazarus, you can find the TODBCConnection on the SQLdb component tab.
+
== Overview ==
You can also use the TODBCConnection component in your code by adding ODBCConn to your uses clause.
 
  
TODO: expand on ODBC & ODBCConnection
+
=== ODBC ===
 +
ODBC (Open Database Connectivity) is a technology that allows one to connect to a whole variety of databases using a single API, the ODBC API.
 +
 
 +
=== TOBCConnection ===
 +
FreePascal ships with ODBC headers; they are in the <code>odbcsql</code> and <code>odbcsqldyn</code> units.
 +
<code>TODBCConnection</code> is an <code>TSQLConnection</code> descendant providing a nice OOP wrapper for ODBC using the SQLdb framework.
 +
 
 +
In Lazarus, you can find the <code>TODBCConnection</code> component on the SQLdb component tab.
 +
You can also use the <code>TODBCConnection</code> component in your code by adding <code>ODBCConn</code> to your uses clause.
 +
 
 +
What has been implemented:
 +
* executing queries and retrieving result sets
 +
* most field types, including blobs
 +
* query parameters (string and integer types)
 +
* preparing queries
 +
* UpdateIndexDefs (so you can use ApplyUpdates); patch submitted to fpc-devel, May 2, 2007
 +
 
 +
What is left to be implemented:
 +
* proper transaction support; currently each connection corresponds to one transaction
 +
* some field types
 +
** SQL_TYPE_UTC* (these are mentioned in the ODBC docs, but seem not to be used in implementations)
 +
** SQL_INTERVAL_* (what would be the corresponding TFieldType?)
 +
** SQL_GUID (TGUIDField was not implemented, until recently)
 +
 
 +
=== Why use ODBC? ===
 +
FreePascal ships with components for connecting to several databases, such as MySQL, PostGreSQL, Firebird, Oracle, etc.
 +
For those databases missing from the list, like MS Access, ODBC might be an outcome.
 +
Actually, the TODBCConnection component was developed originally to circumvent the strict MySQL license for applications that are not GPLed or do not obey MySQL AB's [http://www.mysql.com/company/legal/licensing/foss-exception.html FLOSS exception].
 +
 
 +
== Installing ODBC and ODBC Drivers ==
 +
 
 +
TODO
 +
 
 +
== Connecting to an ODBC data source ==
 +
 
 +
TODO
 +
 
 +
== Debugging ODBC ==
 +
 
 +
TODO

Revision as of 13:11, 2 May 2007

The ODBCConn unit implements an SQLdb connection to ODBC data sources.

Overview

ODBC

ODBC (Open Database Connectivity) is a technology that allows one to connect to a whole variety of databases using a single API, the ODBC API.

TOBCConnection

FreePascal ships with ODBC headers; they are in the odbcsql and odbcsqldyn units. TODBCConnection is an TSQLConnection descendant providing a nice OOP wrapper for ODBC using the SQLdb framework.

In Lazarus, you can find the TODBCConnection component on the SQLdb component tab. You can also use the TODBCConnection component in your code by adding ODBCConn to your uses clause.

What has been implemented:

  • executing queries and retrieving result sets
  • most field types, including blobs
  • query parameters (string and integer types)
  • preparing queries
  • UpdateIndexDefs (so you can use ApplyUpdates); patch submitted to fpc-devel, May 2, 2007

What is left to be implemented:

  • proper transaction support; currently each connection corresponds to one transaction
  • some field types
    • SQL_TYPE_UTC* (these are mentioned in the ODBC docs, but seem not to be used in implementations)
    • SQL_INTERVAL_* (what would be the corresponding TFieldType?)
    • SQL_GUID (TGUIDField was not implemented, until recently)

Why use ODBC?

FreePascal ships with components for connecting to several databases, such as MySQL, PostGreSQL, Firebird, Oracle, etc. For those databases missing from the list, like MS Access, ODBC might be an outcome. Actually, the TODBCConnection component was developed originally to circumvent the strict MySQL license for applications that are not GPLed or do not obey MySQL AB's FLOSS exception.

Installing ODBC and ODBC Drivers

TODO

Connecting to an ODBC data source

TODO

Debugging ODBC

TODO