Represents a table in a schema.
A Table
object can be obtained from Schema::getTable()
method:
Schema db;
Table myTable;
myTable= db.getTable("My Table");
or directly constructed as follows:
Schema db;
Table myTable(db, "My Table");
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.
- Note
- A
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.
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.
- Note
- Any errors related to the operation are reported when the operation is executed, not when it is created.
- See also
TableInsert
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.
- Note
- Any errors related to the operation are reported when the operation is executed, not when it is created.
- See also
TableInsert
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.
- Note
- Any errors related to the operation are reported when the operation is executed, not when it is created.
- See also
TableSelect