Defines a model that can be stored in an SQL database. Implements queries for this type to the database (insert, update, select, delete)
More...
#include <AUI/Data/ASqlModel.h>
|
|
void | save () |
| | Saves this model in DB. If id = 0 then a new row will be created in the table, and the id of the created row will be assigned in the structure field. If id != 0 then the existing row in the table will be updated.
|
| |
|
void | remove () |
| | Removes row from the table by ID.
|
| |
|
| template<typename Other> |
| _< typename Other::IncompleteSelectRequest > | hasMany () |
| | Implementation of one-to-many relation between ORM structures. Used with belongsTo.
|
| |
|
template<typename Other> |
| Other | belongsTo (id_t desiredId) |
| |
template<typename Model>
struct ASqlModel< Model >
- Template Parameters
-
- Note
- Model should implement AModelMeta (see AUI/Data/AModelMeta.h)
◆ byId()#
template<typename Model>
| static Model ASqlModel< Model >::byId |
( |
id_t | id | ) |
|
|
inlinestatic |
- Parameters
-
| id | ID of the required string |
- Returns
- the string table for the specified ID
- Exceptions
-
◆ getIdColumnNameInOtherTables()#
- Returns
- name of the relation column for other tables.
Example: struct User -> table users -> column user_id is the result.
◆ hasMany()#
template<typename Model>
template<typename Other>
| _< typename Other::IncompleteSelectRequest > ASqlModel< Model >::hasMany |
( |
| ) |
|
|
inlineprotected |
◆ make()#
template<typename Model>
template<typename ... Args>
| static Model ASqlModel< Model >::make |
( |
Args &&... | args | ) |
|
|
inlinestatic |
- Template Parameters
-
| Args | the types of constructor arguments |
- Parameters
-
| args | the constructor arguments |
- Returns
- the ORM structure