This section summarizes ODBC routines, categorized by functionality.
For the complete ODBC API reference, please refer to the ODBC Programer's Reference at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcabout_this_manual.asp.
An application can call SQLGetInfo
function
to obtain conformance information about Connector/ODBC. To
obtain information about support for a specific function in the
driver, an application can call
SQLGetFunctions
.
Note: For backward compatibility, the Connector/ODBC 3.51 driver supports all deprecated functions.
The following tables list Connector/ODBC API calls grouped by task:
Connecting to a data source:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLAllocHandle |
No | Yes | ISO 92 | Obtains an environment, connection, statement, or descriptor handle. |
SQLConnect |
Yes | Yes | ISO 92 | Connects to a specific driver by data source name, user ID, and password. |
SQLDriverConnect |
Yes | Yes | ODBC | Connects to a specific driver by connection string or requests that the Driver Manager and driver display connection dialog boxes for the user. |
SQLAllocEnv |
Yes | Yes | Deprecated | Obtains an environment handle allocated from driver. |
SQLAllocConnect |
Yes | Yes | Deprecated | Obtains a connection handle |
Obtaining information about a driver and data source:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLDataSources |
No | No | ISO 92 | Returns the list of available data sources, handled by the Driver Manager |
SQLDrivers |
No | No | ODBC | Returns the list of installed drivers and their attributes, handles by Driver Manager |
SQLGetInfo |
Yes | Yes | ISO 92 | Returns information about a specific driver and data source. |
SQLGetFunctions |
Yes | Yes | ISO 92 | Returns supported driver functions. |
SQLGetTypeInfo |
Yes | Yes | ISO 92 | Returns information about supported data types. |
Setting and retrieving driver attributes:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLSetConnectAttr |
No | Yes | ISO 92 | Sets a connection attribute. |
SQLGetConnectAttr |
No | Yes | ISO 92 | Returns the value of a connection attribute. |
SQLSetConnectOption |
Yes | Yes | Deprecated | Sets a connection option |
SQLGetConnectOption |
Yes | Yes | Deprecated | Returns the value of a connection option |
SQLSetEnvAttr |
No | Yes | ISO 92 | Sets an environment attribute. |
SQLGetEnvAttr |
No | Yes | ISO 92 | Returns the value of an environment attribute. |
SQLSetStmtAttr |
No | Yes | ISO 92 | Sets a statement attribute. |
SQLGetStmtAttr |
No | Yes | ISO 92 | Returns the value of a statement attribute. |
SQLSetStmtOption |
Yes | Yes | Deprecated | Sets a statement option |
SQLGetStmtOption |
Yes | Yes | Deprecated | Returns the value of a statement option |
Preparing SQL requests:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLAllocStmt |
Yes | Yes | Deprecated | Allocates a statement handle |
SQLPrepare |
Yes | Yes | ISO 92 | Prepares an SQL statement for later execution. |
SQLBindParameter |
Yes | Yes | ODBC | Assigns storage for a parameter in an SQL statement. |
SQLGetCursorName |
Yes | Yes | ISO 92 | Returns the cursor name associated with a statement handle. |
SQLSetCursorName |
Yes | Yes | ISO 92 | Specifies a cursor name. |
SQLSetScrollOptions |
Yes | Yes | ODBC | Sets options that control cursor behavior. |
Submitting requests:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLExecute |
Yes | Yes | ISO 92 | Executes a prepared statement. |
SQLExecDirect |
Yes | Yes | ISO 92 | Executes a statement |
SQLNativeSql |
Yes | Yes | ODBC | Returns the text of an SQL statement as translated by the driver. |
SQLDescribeParam |
Yes | Yes | ODBC | Returns the description for a specific parameter in a statement. |
SQLNumParams |
Yes | Yes | ISO 92 | Returns the number of parameters in a statement. |
SQLParamData |
Yes | Yes | ISO 92 | Used in conjunction with SQLPutData to supply
parameter data at execution time. (Useful for long data
values.) |
SQLPutData |
Yes | Yes | ISO 92 | Sends part or all of a data value for a parameter. (Useful for long data values.) |
Retrieving results and information about results:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLRowCount |
Yes | Yes | ISO 92 | Returns the number of rows affected by an insert, update, or delete request. |
SQLNumResultCols |
Yes | Yes | ISO 92 | Returns the number of columns in the result set. |
SQLDescribeCol |
Yes | Yes | ISO 92 | Describes a column in the result set. |
SQLColAttribute |
No | Yes | ISO 92 | Describes attributes of a column in the result set. |
SQLColAttributes |
Yes | Yes | Deprecated | Describes attributes of a column in the result set. |
SQLFetch |
Yes | Yes | ISO 92 | Returns multiple result rows. |
SQLFetchScroll |
No | Yes | ISO 92 | Returns scrollable result rows. |
SQLExtendedFetch |
Yes | Yes | Deprecated | Returns scrollable result rows. |
SQLSetPos |
Yes | Yes | ODBC | Positions a cursor within a fetched block of data and allows an application to refresh data in the rowset or to update or delete data in the result set. |
SQLBulkOperations |
No | Yes | ODBC | Performs bulk insertions and bulk bookmark operations, including update, delete, and fetch by bookmark. |
Retrieving error or diagnostic information:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLError |
Yes | Yes | Deprecated | Returns additional error or status information |
SQLGetDiagField |
Yes | Yes | ISO 92 | Returns additional diagnostic information (a single field of the diagnostic data structure). |
SQLGetDiagRec |
Yes | Yes | ISO 92 | Returns additional diagnostic information (multiple fields of the diagnostic data structure). |
Obtaining information about the data source's system tables (catalog functions) item:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLColumnPrivileges |
Yes | Yes | ODBC | Returns a list of columns and associated privileges for one or more tables. |
SQLColumns |
Yes | Yes | X/Open | Returns the list of column names in specified tables. |
SQLForeignKeys |
Yes | Yes | ODBC | Returns a list of column names that make up foreign keys, if they exist for a specified table. |
SQLPrimaryKeys |
Yes | Yes | ODBC | Returns the list of column names that make up the primary key for a table. |
SQLSpecialColumns |
Yes | Yes | X/Open | Returns information about the optimal set of columns that uniquely identifies a row in a specified table, or the columns that are automatically updated when any value in the row is updated by a transaction. |
SQLStatistics |
Yes | Yes | ISO 92 | Returns statistics about a single table and the list of indexes associated with the table. |
SQLTablePrivileges |
Yes | Yes | ODBC | Returns a list of tables and the privileges associated with each table. |
SQLTables |
Yes | Yes | X/Open | Returns the list of table names stored in a specific data source. |
Performing transactions:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLTransact |
Yes | Yes | Deprecated | Commits or rolls back a transaction |
SQLEndTran |
No | Yes | ISO 92 | Commits or rolls back a transaction. |
Terminating a statement:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLFreeStmt |
Yes | Yes | ISO 92 | Ends statement processing, discards pending results, and, optionally, frees all resources associated with the statement handle. |
SQLCloseCursor |
Yes | Yes | ISO 92 | Closes a cursor that has been opened on a statement handle. |
SQLCancel |
Yes | Yes | ISO 92 | Cancels an SQL statement. |
Terminating a connection:
Connector/ODBC | ||||
Function name | 2.50 | 3.51 | Standard | Purpose |
SQLDisconnect |
Yes | Yes | ISO 92 | Closes the connection. |
SQLFreeHandle |
No | Yes | ISO 92 | Releases an environment, connection, statement, or descriptor handle. |
SQLFreeConnect |
Yes | Yes | Deprecated | Releases connection handle |
SQLFreeEnv |
Yes | Yes | Deprecated | Releases an environment handle |
Ésta es una traducción del manual de referencia de MySQL, que puede encontrarse en dev.mysql.com. El manual de referencia original de MySQL está escrito en inglés, y esta traducción no necesariamente está tan actualizada como la versión original. Para cualquier sugerencia sobre la traducción y para señalar errores de cualquier tipo, no dude en dirigirse a mysql-es@vespito.com.