mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 02:49:31 -06:00
moved Model::model() outside class
- removed todo tasks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"; };
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QtTest>
|
||||
|
||||
// CUR change to lib includes <> silverqx
|
||||
#include "orm/db.hpp"
|
||||
#include "orm/mysqlconnection.hpp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user