if (result)
{
/* yes; process rows and free the result set */
process_result_set(mysql, result);
mysql_free_result(result);
}
else
{
if (mysql_field_count(mysql) == 0)
{
printf("%lld rows affected\n",
}
else
/* some error occurred */
{
printf("Could not retrieve result set\n");
break;
}
}
/* more results? -1 = no, >0 = error, 0 = yes (keep looping) */
if ((status = mysql_next_result(mysql)) > 0)
printf("Could not execute statement\n");
} while (status == 0);
mysql_close(mysql);
20.6.16. C API Prepared Statement Problems
Here follows a list of the currently known problems with prepared statements:
• TIME, TIMESTAMP, and
DATE_FORMAT()
• When converting an integer to string,
cases where the MySQL server doesn't print the leading zeros. (For example, with
with-zerofill)
• When converting a floating-point number to a string in the client, the rightmost digits of the converted
value may differ slightly from those of the original value.
• Prepared statements do not use the query cache, even in cases where a query does not contain any
placeholders. See
• Prepared statements do not support multi-statements (that is, multiple statements within a single
string separated by ";" characters).
• In MySQL 5.0, prepared
because prepared statements do not support multiple result sets. Nor can the calling application
access a stored procedure's
capabilities are supported beginning with MySQL 5.5.
20.6.17. C API Prepared Statement Handling of Date and Time Values
The binary (prepared statement) protocol enables you to send and receive date and time values (DATE,
TIME, DATETIME, and TIMESTAMP), using the
are described in
To send temporal data values, create a prepared statement using mysql_stmt_prepare(). Then,
before calling
up each temporal parameter:
1. In the
MYSQL_BIND
the type that indicates what kind of temporal value you're sending. For DATE, TIME, DATETIME,
or
TIMESTAMP
MYSQL_TYPE_DATETIME, or MYSQL_TYPE_TIMESTAMP, respectively.
C API Prepared Statement Problems
/* no result set or error */
mysql_affected_rows(mysql));
DATETIME
[921]).
[971]).
Section 8.6.3.1, "How the Query Cache
statements cannot invoke stored procedures that return result sets
CALL
OUT
Section 20.6.8, "C API Prepared Statement Data
mysql_stmt_execute()
structure associated with the data value, set the
values, set
buffer_type
do not support parts of seconds (for example, from
is honored with prepared statements in some
ZEROFILL
or
parameters when the procedure returns. These
INOUT
MYSQL_TIME
to execute the statement, use the following procedure to set
to MYSQL_TYPE_DATE, MYSQL_TYPE_TIME,
2228
Operates".
structure. The members of this structure
Structures".
buffer_type
MIN(number-
member to
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers