mirror of
https://gitlab.com/spaceti-app/integrations/common/server-sdk.git
synced 2026-07-12 19:00:44 +02:00
added comment about subclassing DataTable
This commit is contained in:
parent
dfe6d3bb03
commit
886cc3c777
@ -129,6 +129,31 @@ public:
|
|||||||
* @brief Convert QVariant type to SQL type
|
* @brief Convert QVariant type to SQL type
|
||||||
* @param QVariant type ( QString, int, QDateTime )
|
* @param QVariant type ( QString, int, QDateTime )
|
||||||
* @return text form of database type ( INTEGER, TEXT )
|
* @return text form of database type ( INTEGER, TEXT )
|
||||||
|
*
|
||||||
|
* # Sublassing
|
||||||
|
*
|
||||||
|
* When it is neccessary to use different type it is possible to subclass and override this method.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
class BackendTable : public serversdk::DatabaseTable
|
||||||
|
{
|
||||||
|
QString textPostgresType(QVariant::Type type) const override;
|
||||||
|
}
|
||||||
|
|
||||||
|
BackendTable::textPostgresType(QVariant::Type type) const override
|
||||||
|
{
|
||||||
|
// For case when saving date time as ms since epoch
|
||||||
|
if (type == QVariant::DateTime) {
|
||||||
|
return QStringLiteral("INTEGER");
|
||||||
|
}
|
||||||
|
return DatabaseTable::textPostgresType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
virtual QString textPostgresType(QVariant::Type type) const;
|
virtual QString textPostgresType(QVariant::Type type) const;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user