|
Wt
3.3.0
|
#include <Wt/Dbo/backend/MySQL>

Public Member Functions | |
| MySQL (const std::string &db, const std::string &dbuser="root", const std::string &dbpasswd="", const std::string dbhost="localhost", unsigned int dbport=0, const std::string &dbsocket="/var/run/mysqld/mysqld.sock", int fractionalSecondsPart=-1) | |
| Opens a new MySQL backend connection. | |
| MySQL (const MySQL &other) | |
| Copies a MySQL connection. | |
| ~MySQL () | |
| Destructor. | |
| virtual MySQL * | clone () const |
| Returns a copy of the connection. | |
| bool | connect () |
| Tries to connect. | |
| MySQL_impl * | connection () |
| Returns the underlying connection. | |
| virtual void | executeSql (const std::string &sql) |
| Executes an SQL statement. | |
| virtual void | startTransaction () |
| Starts a transaction. | |
| virtual void | commitTransaction () |
| Commits a transaction. | |
| virtual void | rollbackTransaction () |
| Rolls back a transaction. | |
| virtual SqlStatement * | prepareStatement (const std::string &sql) |
| Prepares a statement. | |
Methods that return dialect information | |
| virtual std::string | autoincrementSql () const |
| Returns the supported fractional seconds part. | |
| virtual std::string | autoincrementType () const |
| Returns the supported fractional seconds part. | |
| virtual std::string | autoincrementInsertSuffix () const |
| Returns the supported fractional seconds part. | |
| virtual std::vector< std::string > | autoincrementCreateSequenceSql (const std::string &table, const std::string &id) const |
| Returns the supported fractional seconds part. | |
| virtual std::vector< std::string > | autoincrementDropSequenceSql (const std::string &table, const std::string &id) const |
| Returns the supported fractional seconds part. | |
| virtual const char * | dateTimeType (SqlDateTimeType type) const |
| Returns the supported fractional seconds part. | |
| virtual const char * | blobType () const |
| Returns the supported fractional seconds part. | |
| virtual bool | supportAlterTable () const |
| Returns the supported fractional seconds part. | |
| virtual const char * | alterTableConstraintString () const |
| Returns the supported fractional seconds part. | |
| const int | getFractionalSecondsPart () const |
| Returns the supported fractional seconds part. | |
| void | setFractionalSecondsPart (int fractionalSecondsPart) |
| Set the supported fractional seconds part. | |
A MySQL connection.
This class provides the backend implementation for mariadb databases. It has been tested against MySQL 5.6.
In order to work properly with Wt::Dbo, MySQL must be configured with InnoDB (for MySQL) or XtraDB (for mariadb) as the default database engine - so that the transaction based functionality works.
| Wt::Dbo::backend::MySQL::MySQL | ( | const std::string & | db, |
| const std::string & | dbuser = "root", |
||
| const std::string & | dbpasswd = "", |
||
| const std::string | dbhost = "localhost", |
||
| unsigned int | dbport = 0, |
||
| const std::string & | dbsocket = "/var/run/mysqld/mysqld.sock", |
||
| int | fractionalSecondsPart = -1 |
||
| ) |
Opens a new MySQL backend connection.
| db | The database name. |
| dbuser | The username for the database connection - defaults to "root". |
| dbpasswd | The password for the database conection - defaults to an empty string. |
| dbhost | The hostname of the database - defaults to localhost. |
| fractionalSecondsPart | Must be in the range 0 to 6. A value of -1 indicates that the fractional part is not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html |
| Wt::Dbo::backend::MySQL::MySQL | ( | const MySQL & | other | ) |
| Wt::Dbo::backend::MySQL::~MySQL | ( | ) |
Destructor.
Closes the connection.
| const char * Wt::Dbo::backend::MySQL::alterTableConstraintString | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Reimplemented from Wt::Dbo::SqlConnection.
| std::vector< std::string > Wt::Dbo::backend::MySQL::autoincrementCreateSequenceSql | ( | const std::string & | table, |
| const std::string & | id | ||
| ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| std::vector< std::string > Wt::Dbo::backend::MySQL::autoincrementDropSequenceSql | ( | const std::string & | table, |
| const std::string & | id | ||
| ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| std::string Wt::Dbo::backend::MySQL::autoincrementInsertSuffix | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| std::string Wt::Dbo::backend::MySQL::autoincrementSql | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| std::string Wt::Dbo::backend::MySQL::autoincrementType | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| const char * Wt::Dbo::backend::MySQL::blobType | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| void Wt::Dbo::backend::MySQL::commitTransaction | ( | ) | [virtual] |
| bool Wt::Dbo::backend::MySQL::connect | ( | ) |
Tries to connect.
Throws an exception if there was a problem, otherwise true.
| const char * Wt::Dbo::backend::MySQL::dateTimeType | ( | SqlDateTimeType | type | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Implements Wt::Dbo::SqlConnection.
| void Wt::Dbo::backend::MySQL::executeSql | ( | const std::string & | sql | ) | [virtual] |
Executes an SQL statement.
This is a convenience method for preparing a statement, executing it, and deleting it.
Reimplemented from Wt::Dbo::SqlConnection.
| const int Wt::Dbo::backend::MySQL::getFractionalSecondsPart | ( | ) | const |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
| SqlStatement * Wt::Dbo::backend::MySQL::prepareStatement | ( | const std::string & | sql | ) | [virtual] |
| void Wt::Dbo::backend::MySQL::rollbackTransaction | ( | ) | [virtual] |
Rolls back a transaction.
This function rolls back a transaction.
Implements Wt::Dbo::SqlConnection.
| void Wt::Dbo::backend::MySQL::setFractionalSecondsPart | ( | int | fractionalSecondsPart | ) |
Set the supported fractional seconds part.
| Must | be in the range 0 to 6. By diffault return -1: fractional part are not stored. |
The fractional seconds part can be also set in the constructor Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
| void Wt::Dbo::backend::MySQL::startTransaction | ( | ) | [virtual] |
| bool Wt::Dbo::backend::MySQL::supportAlterTable | ( | ) | const [virtual] |
Returns the supported fractional seconds part.
By diffault return -1: fractional part are not stored. Fractional seconds part are supported for MySQL 5.6.4 http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
Reimplemented from Wt::Dbo::SqlConnection.
1.7.5.1