C API Function Descriptions
2145
Errors
None.
Example
char *stmt = "UPDATE products SET cost=cost*1.25
WHERE group=10";
mysql_query(&mysql,stmt);
printf("%ld products updated",
(long) mysql_affected_rows(&mysql));
20.6.6.2.
mysql_autocommit()
my_bool mysql_autocommit(MYSQL *mysql, my_bool mode)
Description
Sets autocommit mode on if
mode
is 1, off if
mode
is 0.
Return Values
Zero if successful. Nonzero if an error occurred.
Errors
None.
20.6.6.3.
mysql_change_user()
my_bool mysql_change_user(MYSQL *mysql, const char *user, const char
*password, const char *db)
Description
Changes the user and causes the database specified by
db
to become the default (current) database
on the connection specified by
mysql
. In subsequent queries, this database is the default for table
references that do not include an explicit database specifier.
mysql_change_user()
fails if the connected user cannot be authenticated or doesn't have
permission to use the database. In this case, the user and database are not changed.
The
db
parameter may be set to
NULL
if you don't want to have a default database.
This command resets the state as if one had done a new connect. (See
Section 20.6.14, “Controlling
Automatic Reconnection Behavior”
.) It always performs a
ROLLBACK
of any active transactions, closes
and drops all temporary tables, and unlocks all locked tables. Session system variables are reset to the
values of the corresponding global system variables. Prepared statements are released and
HANDLER
variables are closed. Locks acquired with
GET_LOCK()
[965]
are released. These effects occur even if
the user didn't change.
Return Values
Zero for success. Nonzero if an error occurred.
Errors
The same that you can get from
mysql_real_connect()
.
•
CR_COMMANDS_OUT_OF_SYNC
[2942]
Commands were executed in an improper order.
•
CR_SERVER_GONE_ERROR
[2942]
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...