MySQL Connector/C++ 9.1.0
MySQL connector library for C and C++ applications
|
Represents a table in a schema. More...
Public Member Functions | |
bool | isView () |
Check if this table object corresponds to a view. More... | |
uint64_t | count () |
Get the number of rows in the table. | |
TableInsert | insert () |
Return an operation which inserts rows into the full table without restricting the columns. More... | |
template<class... T> | |
TableInsert | insert (const T &... t) |
Return an operation which inserts rows into the table restricting the columns. More... | |
template<typename ... PROJ> | |
TableSelect | select (const PROJ &...proj) |
Return an operation which selects rows from the table. More... | |
TableRemove | remove () |
Return an operation which removes rows from the table. More... | |
TableUpdate | update () |
Return an operation which updates rows in the table. More... | |
Protected Member Functions | |
const string & | getName () const |
Get database object name. | |
Session & | getSession () |
Get Session object. | |
const Schema & | getSchema () const |
Get schema object. | |
Represents a table in a schema.
A Table
object can be obtained from Schema::getTable()
method:
or directly constructed as follows:
A Table
object can refer to a plain table or to a view. In the latter case method isView()
called on the object returns true.
When creating a Table
object, by default no checks are made that it actually exists in the database. An operation that is executed on the server and involves such a non-existent table throws an error. Call existsInDatabase()
to check the existence of the table.
Table
object should be used by at most one thread at a time. It is not safe to call its methods by several threads simultaneously. It is responsibility of the user to ensure this using a synchronization mechanism such as mutexes.
|
inline |
Check if this table object corresponds to a view.
|
inline |
Return an operation which inserts rows into the full table without restricting the columns.
Specify rows to be inserted using methods of TableInsert
class chained on the returned operation object. Call execute()
to execute the operation and insert the specified rows.
Each specified row must have the same number of values as the number of columns of the table. If the value count and the table column count do not match, server reports error when operation is executed.
TableInsert
|
inline |
Return an operation which inserts rows into the table restricting the columns.
Specify column names as method arguments. Values are inserted only into the specified columns, other columns are set to null or to column's default value (depending on the definition of the table). Specify rows to be inserted using methods of TableInsert
class chained on the returned operation object. Call execute()
to execute the operation and insert the specified values.
Each specified row must have the same number of values as the number of columns listed here. If the value count and the column count do not match, server reports error when operation is executed.
TableInsert
|
inline |
Return an operation which selects rows from the table.
Call execute()
on the returned operation object to execute it and get a RowResult
object that gives access to the rows. Specify query parameters, such as selection criteria and ordering of the rows, using chained methods of TableSelect
class before making the final call to execute()
. To project selected rows before returning them in the result, specify a list of expressions as arguments of this method. These expressions are evaluated to form a row in the result. An expression can be optionally followed by "AS <name>" suffix to give a name to the corresponding column in the result. If no expressions are given, rows are returned as is, without any projection.
TableSelect
|
inline |
Return an operation which removes rows from the table.
Use chained methods of TableRemove
class on the returned operation object to specify the rows to be removed. Call execute()
to execute the operation and remove the rows.
TableRemove
|
inline |
Return an operation which updates rows in the table.
Use chained methods of TableUpdate
class on the returned operation object to specify which rows should be updated and what modifications to apply to each of them. Call execute()
to execute the operation and remove the rows.
TableUpdate