This chapter describes APIs that support migration from MySQL, which are available starting with Oracle Database Release 12c.
This chapter contains the following topics:
For documentation of MySQL C APIs, refer to MySQL 5.5 documentation.
Oracle database types are described in the Internal Data Types section of Oracle Call Interface Programmer's Guide.
MySQL data types are fully described in MySQL documentation.
MySQL C APIs use MYSQL_TYPE
_symbols to process data to and from MySQL database. These type symbols are mapped to MySQL data types in the server.
For instance, MYSQL_TYPE_VAR_STRING
is mapped to VARCHAR
in the server.
This table shows the value of the type field in MYSQL_FIELD
parameter returned from mysql_fetch_field_*
calls. The Oracle database type is mapped to a MySQL C API data type.
For example: A VARCHAR2
column is represented by MYSQL_TYPE_VAR_STRING
.
It is recommended that users use this table when migrating MySQL applications to Oracle. The MySQL Client Library driver for Oracle will perform Data type conversions between MySQL and Oracle.
Table 7-1 Mapping Oracle Data Types to MySQL Data Types
Oracle Data Type | Maps to MySQL Data Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User-defined type (object type, |
Not supported |
|
Not supported |
|
|
|
|
|
|
|
|
|
|
|
|
The calls to mysql_stmt_bind_param() and mysql_stmt_bind_result() may be used to convert between C program variables and database column values. Similarly, OCI provides rich conversion support from server data types to many client data types.
Input conversions from a C program value to a database column value are handled by invoking mysql_stmt_bind_param(). Output to a C program value is handled through a call to mysql_stmt_bind_result().
Table 7-2 summarizes viable conversions between MySQL program variable data types and Oracle column data types. The possible values in the table are:
I
: input conversion is supported
O
: output conversion is supported
I/O
: both input and output conversion is supported
-
: conversion is not supported.
Be sure to read the corresponding notes for each data type before finalizing conversion choices.
Table 7-2 Converting MySQL Program Variable Data Types to Oracle Column Data Types
MySQL Program Variable Data Types | CHAR | VARCHAR2 | NUMBER | LONG | ROWID | UROWID | DATE | RAW | LONG RAW |
---|---|---|---|---|---|---|---|---|---|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
|
|
- |
- |
- |
- |
- |
|
|
|
- |
|
- |
- |
|
- |
- |
|
|
|
- |
|
- |
- |
|
- |
- |
|
|
|
- |
|
- |
- |
|
- |
- |
|
|
|
- |
|
- |
- |
|
- |
- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- |
|
- |
- |
- |
|
|
|
|
|
- |
|
- |
- |
- |
|
|
|
|
|
- |
|
- |
- |
- |
|
|
|
|
|
- |
|
- |
- |
- |
|
|
|
|
|
|
- |
- |
- |
- |
- |
- |
CHAR
and VARCHAR2
: Conversion is valid for input or output. On input, column value is stored in hexadecimal format.
LONG
: Conversion is valid for input or output. On input, column value is stored in hexadecimal format.
RAW
: Conversion is valid for input or output.
LONG RAW
: Conversion is valid for input or output.
Conversion is not supported for NUMBER
, ROWID
, UROWID
, and DATE
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For input, host string must be in Oracle DATE
character format. For output, column value is returned in Oracle DATE
format.
DATE
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for NUMBER
, ROWID
, UROWID
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For input, host string must be in Oracle DATE
character format. For output, column value is returned in Oracle DATE
format.
DATE
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for NUMBER
, ROWID
, UROWID
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
, VARCHAR2
, LONG
, RAW
, and LONG RAW
: Conversion is valid for output.
Conversion is not supported for NUMBER
, ROWID
, UROWID
, and DATE
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
, VARCHAR2
, LONG
, RAW
, and LONG RAW
: Conversion is valid for output.
Conversion is not supported for NUMBER
, ROWID
, UROWID
, and DATE
.
CHAR
and VARCHAR2
: Conversion is valid for output. Column value must represent a valid number.
NUMBER
: Conversion is valid for output to C program value.
Conversion is not supported for LONG
, ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output.
NUMBER
: Conversion is valid for input or output. For input, the host string must represent a valid number.
LONG
: Conversion valid for input or output.
ROWID
: Conversion is valid for input or output. For input, the host string must be in Oracle ROWID
format. For output, column value is returned in Oracle ROWID
format.
UROWID
: Conversion is valid for input or output. For input, the host string must be in Oracle UROWID
format. For output, column value is returned in Oracle UROWID
format.
DATE
: Conversion is valid for input or output. For input, host string must be in Oracle DATE
character format. For output, column value is returned in Oracle DATE
format.
RAW
: Conversion is valid for input or output. For input, host string must be in hexadecimal format.
LONG RAW
: Conversion is valid for input or output. For input, host string must be in hexadecimal format.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For input, host string must be in Oracle DATE
character format. For output, column value is returned in Oracle DATE
format.
DATE
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for NUMBER
, ROWID
, UROWID
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For input, host string must be in Oracle DATE
character format. For output, column value is returned in Oracle DATE
format.
DATE
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for NUMBER
, ROWID
, UROWID
, RAW
, and LONG RAW
.
CHAR
and VARCHAR2
: Conversion is valid for input or output. For output, column value must represent a valid number.
NUMBER
: Conversion is valid for input or output.
LONG
: Conversion valid for input to database column value.
Conversion not supported for ROWID
, UROWID
, DATE
, RAW
, and LONG RAW
.
CHAR
, VARCHAR2
, LONG
, RAW
, and LONG RAW
: Conversion is valid for output.
Conversion is not supported for NUMBER
, ROWID
, UROWID
, and DATE
.
CHAR
and VARCHAR2
: Conversion is valid for output to C program value.
NUMBER
: Conversion is valid for output to C program value.
LONG
: Conversion is valid for output to C program value.
ROWID
: Conversion is valid for output to C program value. On output, column value is returned in Oracle ROWID
format.
UROWID
: Conversion is valid for output to C program value. On output, column value is returned in Oracle UROWID
format.
DATE
: Conversion is valid for output to C program value. On output, column value is returned in Oracle DATE
format.
RAW
: Conversion is valid for output to C program value.
LONG RAW
: Conversion is valid for output to C program value.
The external data types Table 7-3 may be converted to the specified Oracle internal data types.
Table 7-3 Data Type Conversions for LOB Data Type Descriptors
MySQL External Data Types | ORACLE INTERNAL CLOB/NCLOB | ORACLE INTERNAL BLOB |
---|---|---|
|
|
|
|
|
|
|
|
|
|
I/O |
|
|
O |
|
|
O |
|
|
O |
|
When working with a DATETIME
or INTERVAL
columns, it is possible to use one of the character data types to define a host variable used in a FETCH
or INSERT
operation The driver automatically converts between the character data type and DATETIME
or INTERVAL
data type.
Table 7-4 lists external data types that may be converted to the specified internal Oracle data types.
Table 7-4 Data Conversions for Datetime and Internal Data Type
External/Internal Types | VARCHAR, CHAR | DATE | TS | TSTZ | TSLTZ | INTERVAL YEAR TO MONTH | INTERVAL DAY TO SECOND |
---|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- |
- |
|
|
|
|
|
|
- |
- |
|
|
|
|
|
|
- |
- |
|
|
|
|
|
|
- |
- |
All errors generated by OCI or Oracle server pass to the application when methods mysql_errno() or mysql_error() are invoked after an error. The application receives an Oracle-specific error. Oracle error messages are more specific then MySQL error codes, and are therefore more pertinent to resolving the error condition.
The errors that are generated by the driver itself are in an error range reserved for the MySQL driver in the OCI error space.
The mysql_sqlstate() call attempts to map the error to the appropriate SQLSTATE
whenever possible. In most cases, it returns HY000
, which corresponds to the general error state.
Possible SQLSTATE
values are:
00000
success
HY000
all other errors
However, this also means that client applications that expect more specific SQLSTATE
errors must be partially re-written.
This section documents functional groupings of the APIs and provides links to more extensive information. However, it does not provide full documentation of function behavior and parameters.
Oracle MySQL driver implements the APIs listed in MySQL C API documentation. Please note the following:
Some MySQL functions have changed behavior, typically due to not having an equivalent behavior in Oracle; the description notes the changed behavior.
Some MySQL functions are not supported; the description marks them accordingly. The driver returns an error for these functions, and prompts the application to work around the unsupported functionality.
Client Library Initialization and Termination
The following interfaces support client library initialization and termination:
The following interfaces support connection management.
The following interfaces support error reporting.
Statement Construction and Execution
The following interfaces support statement construction and execution.
The following interfaces support result set processing.
The following interfaces support statement preparation.
The following interfaces support transaction control
The following interfaces support information routines.
The following interfaces support administrative routines.
The following interfaces support all remaining routines.
This function is a no-op function. It is called by my_init
macro in my_sys.h
file. All initializations are done by the mysql_library_init()
.
0
Returns the number of rows processed for INSERT
, UPDATE
, and DELETE
statements executed.
For UPDATE
statements, note that the semantics of MySQL do not report rows where the new value is the same as the old value. In contrast, Oracle reports that rows are affected, even if the new value is the same as the old value. This function implements Oracle semantics. Therefore, existing applications that rely on this call may have to make programmatic changes.
For SELECT
statement, the return is (my_ulonglong
) -1.
A number of rows that were processed by DML statement; >0
. 0
indicates no updates were made by the statement. -1
indicates that the statement was a query (SELECT
), or an error.
Sets auto commit mode to ON
or OFF
.
0
, if the auto commit mode is changed successfully. Non-zero if an error occurred in the process.
Changes the user, including user name, password, and database on the same or different host. In Oracle Database 12c Release 1, change of the database is not supported, so the value entered for the db
parameter is ignored.
A call to mysql_change_user()
rolls back any active transactions, ends the current session, and then re-establishes a new connection based on information stored in the host
parameter.
Existing applications must make necessary application logic changes to implement this behavior in Oracle Database 12c Release 1.
0
if connection can be reestablished with the original host for the supplied user name and password. Non-zero if an error occurred.
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
Empty string.
Commits the transaction currently associated with the service context.
A mysql_commit()
call supports the default mode in Oracle Database 12c Release 1. It therefore ignores the completion type
system variable.
Existing applications that use this API to perform MySQL-specific completion type
operations must change their application logic.
0
if successful, non-zero otherwise.
Deprecated; use mysql_real_connect().
Initialized MYSQL
structure. NULL
if an error occurred.
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
0
if successful; non-zero if an invalid MYSQL structure is passed in.
Seeks to a row in a result set based on the value specified in the offset parameter.
Offset value, being a row number, can range from 0
to mysql_num_rows(result)
-1.
None
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
0
if successful; non-zero if invalid MYSQL
structure.
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
0
if successful; non-zero if invalid MYSQL
structure.
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
0
if successful; non-zero if an invalid MYSQL
structure is passed in.
DEPRECATED. Use mysql_errno() or mysql_error() instead.
Determines if the last row of a result set has been read.
1
if fetched the last row; otherwise 0
.
Returns Oracle error number of the last error on the connection or the global context.
If the previous call did not have an established connection, pass in NULL
; this returns the last error number on global context.
Last error number on the MYSQL
connection, or the last error number on the global context.
Returns Oracle error messages for the last error on the connection or the global context.
If the previous call did not have an established connection, pass in NULL
; this returns the last error message on global context.
Last error message on the MYSQL
connection, or the last error message on the global context.
Encodes the string in the source (from
parameter), places it in the destination (to
parameter), and appends a terminating NULL
.
Supports encoding of only one character, '\
' using the current character set in the connection.
See mysql_real_escape_string().
The length of the value placed into to
, excluding the terminating NULL
.
Returns the definition of one column of a result set as a MYSQL_FIELD
structure.
Only the following attributes of the MYSQL_FIELD
structure are supported: flag
, name
, name_length
, org_name
, org_name_length
, type
, and max_length
.
The flag
attribute supports only the following values: NOT_NULL_FLAG
, NUM_FLAG
, and BINARY_FLAG
.
The attribute org_name
is set to have the same value as name
attribute.
The attribute org_name_length
is set to have the same value as name_length
attribute.
The MYSQL_FIELD
structure for the current column. NULL
if no columns are left.
Retrieves the column's field definition for a specified field number as a MYSQL_FIELD
structure.
Field definition for the specific field. NULL
if an error occurred, or if field number fieldnr
is not in range.
Returns an array of all MYSQL_FIELD
structures for a result set. Each MYSQL_FIELD
structure gives the field definition for one column of the result set.
NULL
if an error occurred.
Returns an array of lengths of the column on the current row.
An array of unsigned long integers that represent the size of each column. NULL
if an error occurred.
Retrieves the next row of a result set.
A MYSQL_ROW structure for the next row. NULL
if there are no more rows to retrieve or if an error occurred.
Returns the number of columns in the result set for the recent query on the connection.
Number of fields in the result set within the MYSQL structure.; 0
if an error occurred.
Returns the position of the field; used for the current field.
Offset of the current field
Not supported in Oracle Database 12c Release 1. Applications that rely on results of this call must change their application logic.
None
Returns MySQL version number defined by MYSQL_SERVER_VERSION
macro in mysql_version.h
header file, in string format. The macro definition is used in the mysql_version.h file
that builds oramysql
library; it is not the mysql_version.h
file used by the application.
A character string that represents MySQL client library version.
Returns current MySQL version, as defined by MYSQL_VEERSION_ID
macro in the mysql_version.h
header file. The macro definition is used in the mysql_version.h file
that builds oramysql
library; it is not the mysql_version.h
file used by the application.
An unsigned long integer for MySQL version stored in the MYSQL_VERSION_ID
macro. The macro definition is used in the mysql_version.h file
that builds oramysql
library; it is not the mysql_version.h
file used by the application.
Returns the host name used to connect to the database.
A character string of host name. NULL
in case of an error.
This is a no-op under Oracle environment. Applications that rely on results of this call must change their application logic.
0
Returns the Oracle server version in text string format, such as "12.1.0.1.0".
Applications that rely on results of this call must change their application logic.
A character string that represents Oracle Server Number. NULL
if an error occurred.
Returns Oracle Database version number, such as 120100
. This is in integer XXYYZZ
format, where XX
represents the major version, YY
represents the minor version, and ZZ
represents the version within the release level.
Oracle Database version number. 0
if an error occurred.
This is a no-op API. Applications that rely on results of this call must change their application logic.
NULL
Encodes string specified by from
parameter to hexadecimal format. Each character is encoded as two hexadecimal digits. The result is placed in the to
parameter, with a terminal NULL
byte.
The to
buffer should have a minimum size equal to length*2+1
bytes.
Length of the value placed into to
parameter, excluding the terminating NULL
character.
This is a no-op API. Applications that rely on results of this call must change their application logic.
NULL
Allocates a MYSQL
structure if NULL
is passed. Otherwise, this call initializes the passed in MYSQL
structure.
Initialized MYSQL structure. NULL
if MYSQL
structure cannot be allocated or initialized.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
, and non-zero if an invalid MYSQL structure is passed in.
Initializes oramysql
library.
0
if successful, non-zero in case of a failure to initialize MySQL library.
Returns a list of database names that match the wild parameter on the server.
To use this API, the DBA creates the oramysql_dbs_view
view, and grants privileges to PUBLIC
.
For Oracle Database 12c Release 1, view oramysql_dbs_view
is based on the V$DATABASE
and V$PDBS
system objects.
When connecting to Oracle Database 12c and subsequent versions, use the following SQL script to create the view oramysql_dbs_view
in Oracle Database 12c:
create view oramysql_dbs_view(name) as select left.name from v$pdbs left union select right.name from v$database right; create public synonym oramysql_dbs_view for oramysql_dbs_view; grant select on oramysql_dbs_view to public;
If oramysql_dbs_view
view does not exist when an application calls the mysql_list_dbs()
function, the information is retrieved from the V$ PDBS
and V$ DATABASE
tables. However, this generates errors if the user does not have privileges to access these tables.
For Oracle Databases prior to Oracle Database 12c
Use the following SQL script to create the view oramysql_dbs_view
in the Oracle Database:
create view oramysql_dbs_view(name) as select name form v$database; create public synonym oramysql_dbs_view for oramysql_dbs_view; grant select on oramysql_dbs_view to public;
If the view does not exist, the wild parameter is ignored, and the call executes the following SQL statement:
select SYS_CONTEXT( 'USERENV', 'DB_NAME') from DUAL;
NULL
if an error occurs, a MYSQL_RES
result set if successful.
Returns the column names that match the wild
parameter for a specified table.
NULL
if an error occurred, a MySql result set if successful.
This is a no-op API. Applications that rely on results of this call must change their application logic.
NULL
This is a no-op function. Applications that rely on results of this call must change their application logic.
NULL
Verifies if more results are available from the currently executing statement.
TRUE
if more results exist; FALSE
if no more result sets exist.
Gets the next result set.
0
if successful and there are more results; -1
if successful and there are no more results; >0
if an error occurred.
Returns the number of columns in a result set.
An unsigned integer that represents the number of columns in the result set; returns 0
if not successful.
Returns the number of rows in the result set.
The number of rows in the result set; otherwise 0
.
This is a no-op function. Applications that rely on results of this call must change their application logic.
0
if successful, non-zero if an invalid MYSQL
structure is passed in.
If the server cannot be accessed, returns an error with connection failure details.
0
if success, non-zero if error occurred.
Executes the SQL statement pointed to by the null-terminated string.
0
if successful, non-zero if an error occurred.
This is a no-op function; query results from mysql_send_query()
are available when that call completes.
0
The db
parameter is not used in Oracle Database 12c Release 1. Existing applications using this parameter to connect to a db
must supply the connection identifier or service name in the host
parameter. The connection string has the following format:
[//]host[:port][/service_name][:server][/instance_name]
For instance, the host parameter would appear as: ca-tools3.us.oracle.com/orcl3
, when connecting to host ca-tools3.us.oracle.com
with SID orcl3
.
The parameters db
, port
, unix_socket
, and client_flag
are not in use. When the user must specify the port, it has to be in the syntax method used for host
parameter.
MYSQL
structure initialized if successful. NULL
in case initialization does not work.
Encodes the string in the source (from
parameter) and the result is placed in the destination (to
parameter) and a terminating null byte is appended.
Note that only single-quote characters are escaped. Each single-quote is escaped using Oracle semantics. The to
buffer should have a minimum size of length*2+1 bytes
. Each single quote in the original string is replaced by two consecutive single quotes.
The length of the value placed into to
buffer, excluding the terminating NULL
. 0
otherwise.
This function executes the query string.
0
if successful, non-zero in case of an error.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
if successful. Non-zero if an invalid MySQL structure was passed in.
Reloads the grant tables. This function is deprecated, and has not been implemented. Use mysql_query() instead. Applications that rely on results of this call must change their application logic.
Rolls back the current transaction defined as the set of statements executed after the last mysql_commit() or mysql_real_connect() call. If the application is running under object mode, the modified or updated objects in the object cache for this transaction are also rolled back.
A mysql_rollback()
call supports the default mode in Oracle Database 12c Release 1. It therefore ignores the completion type
system variable.
Existing applications that use this API to perform MySQL-specific completion type
operations must change their application logic.
Error if an attempt is made to roll back a global transaction that is not currently active.
Sets to a particular row and returns offset of previous row.
Offset of previous row in MYSQL_ROW_OFFSET
structure.
Gives the current row position in the result set.
Offset of current row in MYSQL_ROW_OFFSET
structure. NULL
if an error occurred.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
Sends a query. This function is not asynchronous in oramysql
library. Instead, the call blocks until the query is executed.
0
if successful, non-zero if an error occurred.
Initializes the oramysql
client library before any connections are created. The function mysql_library_init()
macro is defined to be mysql_server_init()
in mysql.h
header file. This call is not thread-safe. Only one thread is expected to call it.
0
if successful, non-zero if an error occurred.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
Helps shutdown an Oracle Database instance. Before using the mysql_shutdown
API, the C program must connect to server with SYSDBA
or SYSOPER
session.
The parameters mysql_shutdown_level
and mysql_enum_shutdown_level
are ignored. Internally, the OCIDBShutdown()
call is executed in the OCI_DEFAULT
mode.
0
if successful. Non-zero if an error occurred.
Returns SQLSTATE
string which is not null-terminated. There are many SQLSTATE
codes in MySQL which are not in use.
SQLSTATE
code: 00000
- Success, or HY000
- All other errors.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
if successful. Non-zero if an invalid MYSQL structure was passed.
This is a no-op API. Applications that rely on results of this call must change their application logic.
A string of 4 blanks (" ") if successful. NULL
if an invalid MYSQL
structure was passed.
This function returns the number of rows affected by the execution on the prepared statement.
Number of rows affected by the DML operation if successful. (my_ulonglong)-1
if an error occurred, or a SELECT
statement was executed.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This function binds all the parameters in the prepared statement.
0
if parameters are bound successfully. Non-zero if an error occurred.
Binds program variables for all SELECT
list columns of a prepared statement.
0
if successful. Non-zero if an error occurred.
Returns error number for the last error that occurred on the MYSQL_STMT
object.
none
This function returns error message for the last error that occurred on the MYSQL_STMT
object.
A const *char
error message.
This function executes the prepared statement.
0
if the statement executed successfully; non-zero if an error occurred.
This function fetches one row in program variables bound by the mysql_stmt_bind_result
call.
0 if one row is successfully fetched. MYSQL_NO_DATA
if no more rows/data exists. MYSQL_DATA_TRUNCATED
if data truncation occurred. 1
if an error occurred.
This function fetches one column from the current result set row.
0
if the value was fetched successfully. Non-zero if an error occurred.
Fetches the number of fields in the MYSQL_STMT
object.
0 if an error occurred; otherwise, the number of fields in the result set associated with the MYSQL_STMT
object.
Creates a new MYSQL_STMT
object from the MYSQL
connection object.
MYSQL_STMT
object if successful. NULL
if an error occurred.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
This function is not implemented. Applications that rely on results of this call must change their application logic.
0
Returns the number of rows in a stored result set. In case of a non-stored (unbuffered result set), it returns the total number of rows fetched so far.
0 if an error occurred in fetching the number of rows.
Returns the number of bind parameters in the prepared statement.
0
if an error occurred in returning the number of bind parameters.
Prepares a statement in the MYSQL_STMT
for execution.
0
if successful, non-zero if an error occurred.
Returns the metadata for the result of a SELECT
statement that is executed through a MYSQL_STMT
object.
A result set that describes the metadata of the prepared SELECT
statement. NULL
if an error occurred.
Seeks to a row position and returns the offset of the previous row.
An offset of the previous row in MYSQL_ROW_OFFSET
structure.
Gives the current row position in the result set.
Current row position. NULL
if an error occurred.
Sends parameter data to the server in parts.
The function mysql_stmt_bind_param()
must be called first, then mysql_stmt_send_long_data()
, followed by mysql_stmt_execute()
.
The function can be called multiple times to send parts of a character or binary data value for a column.
0
if the data is sent to the server successfully, non-zero if an error occurred.
Returns SQLSTATE
string for the recent prepared statement. There are many SQLSTATE
codes in MySQL that are not used.
SQLSTATE
codes: "00000
" - Success, or "HY0000
" - All other errors.
Stores the result set from the last query.
If the last query was a SELECT
, a result set is returned. If the last statement was a non-SELECT
or error, a NULL
result set is returned.
A valid result set if successful, NULL
if an error occurred, or a non-SELECT
statement.
Stores the result set from the last query.
If the last query was SELECT
, returns a result set.
If the last statement was a non-SELECT
or an error, a NULL
result set is returned.
A valid result set if successful; otherwise, NULL
for errors or non-SELECT
statements.
This is a no-op API. Applications that rely on results of this call must change their application logic.
none
Returns Oracle session identifier (SID) for the connection. This is obtained internally by executing the following SQL statement:
select SYS_CONTEXT('USERENV', 'SID') from DUAL;
Applications that rely on results of this call must change their application logic.
Oracle session identifier (SID). 0
if an error occurs.
This is a no-op API. Applications that rely on results of this call must change their application logic.
0
Initiates a result set retrieval.
NULL
if an error occurred, a valid result set if successful.