moved Model::model() outside class

- removed todo tasks
This commit is contained in:
silverqx
2021-04-16 16:12:40 +02:00
parent e82ac80b0b
commit 20e8bae10b
6 changed files with 18 additions and 9 deletions

View File

@@ -94,7 +94,7 @@ Powershell commands:
--------------------
- export todos to csv:
Get-ChildItem -Path *.cpp,*.hpp -Recurse | sls -Pattern ' (TODO|NOTE|FIXME|BUG|WARNING|CUR|FEATURE|TEST) ' -CaseSensitive | % { $_.Line = $_.Line.Trim().TrimStart('// '); return $_; } | select Line,LineNumber,Path | Export-Csv todos.csv -Delimiter ';' -NoTypeInformation
Get-ChildItem -Path *.cpp,*.hpp -Recurse | sls -Pattern ' (TODO|NOTE|FIXME|BUG|WARNING|CUR|FEATURE|TEST|FUTURE) ' -CaseSensitive | % { $_.Line = $_.Line.Trim().TrimStart('// '); return $_; } | select Line,LineNumber,Path | Export-Csv todos.csv -Delimiter ';' -NoTypeInformation
- filter out executed queries:
Get-Content .\tmp.sql | sls -Pattern '^(Executed prepared query)' | Set-Content executed_queries.sql

View File

@@ -86,7 +86,7 @@ namespace Orm
static QSqlQuery qtQuery(const QString &connection = "");
/*! Create a new raw query expression. */
static inline Query::Expression raw(const QVariant &value)
inline static Query::Expression raw(const QVariant &value)
{ return value; }
/*! Run a select statement against the database. */

View File

@@ -485,13 +485,10 @@ namespace Relations {
PivotType newPivot(const Parent &parent, const QVector<AttributeItem> &attributes,
const QString &table, bool exists) const;
// CUR cache result silverqx
/*! Static cast this to a child's instance type (CRTP). */
inline Derived &model()
{ return static_cast<Derived &>(*this); }
inline Derived &model();
/*! Static cast this to a child's instance type (CRTP), const version. */
inline const Derived &model() const
{ return static_cast<const Derived &>(*this); }
inline const Derived &model() const;
/* Getters / Setters */
/*! Get the current connection name for the model. */
@@ -2747,6 +2744,19 @@ namespace Relations {
parent, attributes, table, exists);
}
template<typename Derived, typename ...AllRelations>
Derived &Model<Derived, AllRelations...>::model()
{
// Can not be cached with static because a copy can be made
return static_cast<Derived &>(*this);
}
template<typename Derived, typename ...AllRelations>
const Derived &Model<Derived, AllRelations...>::model() const
{
return static_cast<const Derived &>(*this);
}
template<typename Derived, typename ...AllRelations>
const QString &
Model<Derived, AllRelations...>::getConnectionName() const

View File

@@ -66,7 +66,6 @@ namespace Orm::Tiny::Relations
buildDictionary(const QVector<Related> &results) const;
public:
// CUR rewrite to cached silverqx
/*! The textual representation of the Relation type. */
inline QString relationTypeName() const override
{ return "BelongsTo"; };

View File

@@ -8,6 +8,7 @@ class User; // Forward declaration to avoid cyclic dependency
#include "models/roleuser.hpp"
using Orm::Tiny::Model;
using Orm::Tiny::Relations::BelongsToMany;
using Orm::Tiny::Relations::Pivot;
using Orm::Tiny::Relations::Relation;

View File

@@ -1,7 +1,6 @@
#include <QCoreApplication>
#include <QtTest>
// CUR change to lib includes <> silverqx
#include "orm/db.hpp"
#include "orm/mysqlconnection.hpp"