CppDB
|
MySQL backend allows to connect to MySQL database. It uses native MySQL C client API.
The driver name is "mysql", cppdb::session::engine() returns "mysql"
Connection Properties are:
host
- the remote database host to connect. Default is local host.user
- the user name to loginpassword
- the password to logindatabase
- the name of the database to use - default unspecifiedport
- the port to connect - default unspecifiedunix_socket
- the socket to connect - default unspecifiedAdditionaly you can customize the connection with MySQL option parameters. Current list of options is specified in http://dev.mysql.com/doc/refman/5.5/en/mysql-options.html . In CppDB, they are specified in lower case letters with mysql_
prefix removed. Boolean values should be given as either 0 or 1. Options which take no arguments (e.g. opt_compress) should be passed as a boolean with the value of 1. Example option string:
mysql:user=test;password=test;opt_reconnect=1;opt_read_timeout=10;opt_compress=1
Prepared statements are implemented using mysql_stmt_* family API, while unprepared statements use mysql_real_query API and explicit escaping using mysql_real_escape_string instead of parameter binding.
Because MySQL caches query results, it sometimes more efficient to use unprepared statements rather then using prepared one that their results are not cached
Last insert row id is fetched using mysql_insert_id() and mysql_stmt_insert_id() API, the name of the sequence is ignored.