diff --git a/NOTES.txt b/NOTES.txt index 4a0402f51..4c27a4896 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -65,7 +65,7 @@ Features related/to implement: - multidriver : task related to adding support for another drivers PostgreSQL, SQLite and SQL Server - pivot : pivot table in the many-to-many relationship - postgres : specific to PostgreSQL server - - primarykey dilema : different types for primary keys + - dilemma primarykey : different types for primary keys - relations : relations related 🤓 - scopes : query scopes - table prefix : table prefix in the query grammar diff --git a/include/orm/databaseconnection.hpp b/include/orm/databaseconnection.hpp index baea73189..405f9a2b9 100644 --- a/include/orm/databaseconnection.hpp +++ b/include/orm/databaseconnection.hpp @@ -42,7 +42,7 @@ namespace Orm /*! Get a new query builder instance. */ QSharedPointer query() override; - // TODO dilemma Raw Expressions fuckup🤔 silverqx + // FEATURE dilemma Raw Expressions fuckup🤔 silverqx /*! Get a new raw query expression. */ inline Query::Expression raw(const QVariant &value) const override { return value; } @@ -222,8 +222,7 @@ namespace Orm std::function m_qtConnectionResolver; /*! The name of the connected database. */ const QString m_database; - // CUR change all todo tasks for features to the format below silverqx - // TODO feature, table prefix silverqx + // FEATURE table prefix silverqx /*! The table prefix for the connection. */ const QString m_tablePrefix {""}; /*! The database connection configuration options. */ diff --git a/include/orm/query/grammars/grammar.hpp b/include/orm/query/grammars/grammar.hpp index 415f9e14a..85052ffcf 100644 --- a/include/orm/query/grammars/grammar.hpp +++ b/include/orm/query/grammars/grammar.hpp @@ -27,7 +27,7 @@ namespace Orm::Query::Grammars virtual QString compileInsertOrIgnore(const QueryBuilder &query, const QVector &values) const; - // TODO postgres, sequence silverqx + // FEATURE postgres, sequence silverqx /*! Compile an insert and get ID statement into SQL. */ inline QString compileInsertGetId(const QueryBuilder &query, diff --git a/include/orm/query/querybuilder.hpp b/include/orm/query/querybuilder.hpp index dcfa45c10..e1403a3e3 100644 --- a/include/orm/query/querybuilder.hpp +++ b/include/orm/query/querybuilder.hpp @@ -28,7 +28,7 @@ namespace Grammars } using QueryGrammar = Query::Grammars::Grammar; - // TODO add support for subqueries, first in where() silverqx + // FEATURE subqueries, add support for subqueries, first in where() silverqx // TODO add inRandomOrder() silverqx class SHAREDLIB_EXPORT Builder { @@ -71,8 +71,8 @@ namespace Grammars /*! Insert a new record into the database while ignoring errors. */ std::tuple> insertOrIgnore(const QVariantMap &values); - // TODO postgres, support sequence, add sequence parameter silverqx - // TODO dilemma primarykey, add support for Model::KeyType in QueryBuilder/TinyBuilder or should it be QVariant and runtime type check? 🤔 silverqx + // FEATURE postgres, support sequence, add sequence parameter silverqx + // FEATURE dilemma primarykey, add support for Model::KeyType in QueryBuilder/TinyBuilder or should it be QVariant and runtime type check? 🤔 silverqx /*! Insert a new record and get the value of the primary key. */ quint64 insertGetId(const QVariantMap &values); diff --git a/include/orm/tiny/basemodel.hpp b/include/orm/tiny/basemodel.hpp index ff5d2a4b0..9276ceddf 100644 --- a/include/orm/tiny/basemodel.hpp +++ b/include/orm/tiny/basemodel.hpp @@ -60,11 +60,11 @@ namespace Relations { // TODO model missing methods Model::loadMissing() silverqx // TODO model missing methods Model::whereExists() silverqx // TODO model missing methods Model::whereBetween() silverqx - // TODO next Constraining Eager Loads silverqx + // FEATURE next Constraining Eager Loads silverqx // TODO perf add pragma once to every header file, have branch pragma-once, but I can't get rid of the clang warning -Wpragma-once-outside-header in every file, I tried everything 😞 silverqx // TODO future try to compile every header file by itself and catch up missing dependencies and forward declaration, every header file should be compilable by itself silverqx // TODO future include every stl dependency in header files silverqx - // TODO logging, add support for custom logging, logging to the defined stream?, I don't exactly know how I will solve this issue, design it 🤔 silverqx + // FEATURE logging, add support for custom logging, logging to the defined stream?, I don't exactly know how I will solve this issue, design it 🤔 silverqx template class BaseModel : public Concerns::HasRelationStore, @@ -1228,7 +1228,7 @@ namespace Relations { return query()->insert(attributes); } - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx template quint64 BaseModel::insertGetId( @@ -1245,7 +1245,7 @@ namespace Relations { } // TODO cpp check all int types and use std::size_t where appropriate silverqx - // TODO dilemma primarykey, id should be Model::KeyType, if I don't solve this problem, do runtime type check, QVariant type has to be the same type like KeyType and throw exception silverqx + // FEATURE dilemma primarykey, id should be Model::KeyType, if I don't solve this problem, do runtime type check, QVariant type has to be the same type like KeyType and throw exception silverqx // TODO next test all this remove()/destroy() methods, when deletion fails silverqx template size_t @@ -2432,7 +2432,7 @@ namespace Relations { Model & BaseModel::fill(const QVector &attributes) { - // TODO guarded silverqx + // FEATURE guarded silverqx for (const auto &attribute : attributes) setAttribute(attribute.key, attribute.value); @@ -2443,7 +2443,7 @@ namespace Relations { Model & BaseModel::fill(QVector &&attributes) { - // TODO guarded silverqx + // FEATURE guarded silverqx for (auto &attribute : attributes) setAttribute(std::move(attribute.key), std::move(attribute.value)); @@ -2454,7 +2454,7 @@ namespace Relations { Model & BaseModel::forceFill(const QVector &attributes) { - // TODO guarded silverqx + // FEATURE guarded silverqx return fill(attributes); } @@ -3687,13 +3687,13 @@ namespace Relations { syncOriginal(); } - // TODO dilemma primarykey, add support for Model::KeyType silverqx + // FEATURE dilemma primarykey, add support for Model::KeyType silverqx template quint64 BaseModel::insertAndSetId( const TinyBuilder &query, const QVector &attributes) { - // TODO postgres, insertGetId() and getKeyName() for sequence parameter silverqx + // FEATURE postgres, insertGetId() and getKeyName() for sequence parameter silverqx // const auto &keyName = getKeyName(); const auto id = query.insertGetId(attributes/*, keyName*/); diff --git a/include/orm/tiny/modelnotfounderror.hpp b/include/orm/tiny/modelnotfounderror.hpp index e466dc222..09ca9d66b 100644 --- a/include/orm/tiny/modelnotfounderror.hpp +++ b/include/orm/tiny/modelnotfounderror.hpp @@ -15,7 +15,7 @@ namespace Orm::Tiny class SHAREDLIB_EXPORT ModelNotFoundError : public RuntimeError { public: - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx // TODO perf add overload ctor for QVector, better QVector silverqx explicit ModelNotFoundError(const char *model, const QVector &ids = {}); diff --git a/include/orm/tiny/relations/basepivot.hpp b/include/orm/tiny/relations/basepivot.hpp index 8b4197ec8..fdcbaabd7 100644 --- a/include/orm/tiny/relations/basepivot.hpp +++ b/include/orm/tiny/relations/basepivot.hpp @@ -76,7 +76,7 @@ namespace Orm::Tiny::Relations /*! Indicates if the ID is auto-incrementing. */ bool u_incrementing = false; - // TODO guarded silverqx + // FEATURE guarded silverqx /*! The attributes that aren't mass assignable. */ // QStringList u_guarded; @@ -180,7 +180,7 @@ namespace Orm::Tiny::Relations if (attributesContainsKey) return BaseModel::remove(); - // TODO events silverqx + // FEATURE events silverqx // if (fireModelEvent("deleting") == false) // return false; @@ -192,7 +192,7 @@ namespace Orm::Tiny::Relations this->exists = false; - // TODO events silverqx + // FEATURE events silverqx // fireModelEvent("deleted", false); return affected > 0 ? true : false; diff --git a/include/orm/tiny/relations/belongsto.hpp b/include/orm/tiny/relations/belongsto.hpp index 801b93490..4757d28a4 100644 --- a/include/orm/tiny/relations/belongsto.hpp +++ b/include/orm/tiny/relations/belongsto.hpp @@ -120,13 +120,13 @@ namespace Orm::Tiny::Relations return m_child; } - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx template Model &BelongsTo::associate(const QVariant &id) const { m_child.setAttribute(m_foreignKey, id); - // TODO relations, check if relation is loaded and if has the same id, if so, then don't unset relation silverqx + // FEATURE relations, check if relation is loaded and if has the same id, if so, then don't unset relation silverqx m_child.unsetRelation(m_relationName); return m_child; @@ -136,7 +136,7 @@ namespace Orm::Tiny::Relations Model &BelongsTo::dissociate() const { // TODO test Model::save with null key silverqx - // TODO dilemma primarykey, Model::KeyType vs QVariant, set to null, will be different for Qt5 (QVariant(QVariant::Type(qMetaTypeId()))) and Qt6 (QVariant(QMetaType(qMetaTypeId())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant, set to null, will be different for Qt5 (QVariant(QVariant::Type(qMetaTypeId()))) and Qt6 (QVariant(QMetaType(qMetaTypeId())))) ; ALSO current problem is, that I check that foreignKey !isValid || isNull, but when QVariant with type (Model::KeyType) and also with null is created by the above commands, then it is still null (isNull == true), but is considered as !!VALID!! (isValid == true) silverqx m_child.setAttribute(m_foreignKey, {}); // TODO test operations that are related on the BaseModel::m_relation data member how they behave, when m_relations value contains the std::nullopt value silverqx diff --git a/include/orm/tiny/relations/belongstomany.hpp b/include/orm/tiny/relations/belongstomany.hpp index d89544ca6..be163c427 100644 --- a/include/orm/tiny/relations/belongstomany.hpp +++ b/include/orm/tiny/relations/belongstomany.hpp @@ -475,7 +475,7 @@ namespace Orm::Tiny::Relations /* First we'll add the proper select columns onto the query so it is run with the proper columns. Then, we will get the results and hydrate out pivot models with the result of those columns as a separate model relation. */ - // TODO scopes silverqx + // FEATURE scopes silverqx // $builder = $this->query->applyScopes(); auto l_columns = this->m_query->getQuery().getColumns().isEmpty() @@ -645,7 +645,7 @@ namespace Orm::Tiny::Relations // Ownership of the QSharedPointer auto query = newPivotStatement(); - // TODO relations, add support for BelongsToMany::where/whereIn/whereNull silverqx + // FEATURE relations, add support for BelongsToMany::where/whereIn/whereNull silverqx // for (auto &[column, value, comparison, condition] : m_pivotWheres) // query->where(column, value, comparison, condition); @@ -735,7 +735,7 @@ namespace Orm::Tiny::Relations attach(QVector {model.getAttribute(m_relatedKey)}, attributes, touch); } - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx template void BelongsToMany::attach( const std::map::KeyType, @@ -1109,7 +1109,7 @@ namespace Orm::Tiny::Relations if (timed) addTimestampsToAttachment(record); - // TODO pivot, withPivotValues silverqx + // FEATURE pivot, withPivotValues silverqx // for (auto &[column, value] as m_pivotValues) // record.append(column, value); @@ -1255,7 +1255,7 @@ namespace Orm::Tiny::Relations BelongsToMany::recordsFromIds( const QVector &ids) const { - // TODO dilemma primarykey, when I solve this dilema, then add using for ModelKeyType and RelatedKeyType silverqx + // FEATURE dilemma primarykey, when I solve this dilema, then add using for ModelKeyType and RelatedKeyType silverqx std::map::KeyType, QVector> records; for (const auto &id : ids) @@ -1313,7 +1313,7 @@ namespace Orm::Tiny::Relations template QString BelongsToMany::guessInverseRelation() const { - // TODO relations, add parent touches (eg parentTouchesName) to the BaseModel::belongsToMany factory method silverqx + // FEATURE relations, add parent touches (eg parentTouchesName) to the BaseModel::belongsToMany factory method silverqx auto relation = Utils::Type::classPureBasename(); relation[0] = relation[0].toLower(); @@ -1384,7 +1384,7 @@ namespace Orm::Tiny::Relations { // Don't overwrite ID keys, throw domain exception if (attribute.key == m_foreignPivotKey) - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx throwOverwritingKeyError/**/(attribute.key, this->m_parent[m_parentKey], attribute.value); diff --git a/include/orm/tiny/relations/hasmany.hpp b/include/orm/tiny/relations/hasmany.hpp index f1dcad0e0..5fd14b040 100644 --- a/include/orm/tiny/relations/hasmany.hpp +++ b/include/orm/tiny/relations/hasmany.hpp @@ -73,7 +73,7 @@ namespace Orm::Tiny::Relations for (auto &model : models) model.template setRelation(relation, QVector()); - // TODO add support for default models (trait SupportsDefaultModels) silverqx + // FEATURE default models, add support for default models (trait SupportsDefaultModels) silverqx // model.setRelation(relation, getDefaultFor(model)); return models; diff --git a/include/orm/tiny/relations/pivot.hpp b/include/orm/tiny/relations/pivot.hpp index c23ca88c3..8e867fe82 100644 --- a/include/orm/tiny/relations/pivot.hpp +++ b/include/orm/tiny/relations/pivot.hpp @@ -21,7 +21,7 @@ namespace Orm::Tiny::Relations protected: /*! Indicates if the ID is auto-incrementing. */ bool u_incrementing = false; - // TODO guarded silverqx + // FEATURE guarded silverqx /*! The attributes that aren't mass assignable. */ // QStringList u_guarded; }; diff --git a/include/orm/tiny/relations/relation.hpp b/include/orm/tiny/relations/relation.hpp index 02517e345..5096c661d 100644 --- a/include/orm/tiny/relations/relation.hpp +++ b/include/orm/tiny/relations/relation.hpp @@ -671,7 +671,7 @@ namespace Relations return m_query->insert(attributes); } - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx template quint64 Relation::insertGetId(const QVector &attributes) const diff --git a/include/orm/tiny/tinybuilder.hpp b/include/orm/tiny/tinybuilder.hpp index 09d9aae2c..368daca9c 100644 --- a/include/orm/tiny/tinybuilder.hpp +++ b/include/orm/tiny/tinybuilder.hpp @@ -50,7 +50,7 @@ namespace Relations /*! Execute the query as a "select" statement. */ QVector get(const QStringList &columns = {"*"}); - // TODO dilmma primarykey, Model::KeyType for id silverqx + // FEATURE dilemma primarykey, Model::KeyType for id silverqx /*! Find a model by its primary key. */ std::optional find(const QVariant &id, const QStringList &columns = {"*"}); @@ -587,7 +587,7 @@ namespace Relations return toBase().insert(Utils::Attribute::convertVectorToMap(attributes)); } - // TODO dilemma primarykey, Model::KeyType vs QVariant silverqx + // FEATURE dilemma primarykey, Model::KeyType vs QVariant silverqx template quint64 Builder::insertGetId(const QVector &attributes) const @@ -1301,7 +1301,7 @@ namespace Relations const auto emptyConstraints = !relation.constraints; const auto isSelectConstraint = relation.name.contains(QChar(':')); - // TODO next Eager Loading Specific Columns silverqx + // FEATURE next Eager Loading Specific Columns silverqx /* Select columns constraints are only allowed, when relation.constraints is nullptr. */ if (isSelectConstraint) diff --git a/src/orm/connectors/sqliteconnector.cpp b/src/orm/connectors/sqliteconnector.cpp index a2ae98dd2..dd326b4ad 100644 --- a/src/orm/connectors/sqliteconnector.cpp +++ b/src/orm/connectors/sqliteconnector.cpp @@ -65,7 +65,7 @@ void SQLiteConnector::configureForeignKeyConstraints( config["foreign_key_constraints"].value() ? "ON" : "OFF"; QSqlQuery query(connection); - // TODO feature, schema builder, foreign key constraints silverqx + // FEATURE schema builder, foreign key constraints silverqx query.prepare(QStringLiteral("PRAGMA foreign_keys = ?;")); query.addBindValue(foreignKeyConstraints); diff --git a/src/orm/databaseconnection.cpp b/src/orm/databaseconnection.cpp index b7dd2dd93..01cb2cc3f 100644 --- a/src/orm/databaseconnection.cpp +++ b/src/orm/databaseconnection.cpp @@ -83,7 +83,6 @@ bool DatabaseConnection::beginTransaction() const auto elapsed = hitTransactionalCounters(timer); #ifdef TINYORM_DEBUG_SQL - // TODO multidriver, when will be added support for more drivers, than the Grammar will have to compile this silverqx /* Once we have run the transaction query we will calculate the time that it took to run and then log the query and execution time. We'll log time in milliseconds. */ diff --git a/src/orm/query/grammars/grammar.cpp b/src/orm/query/grammars/grammar.cpp index 6e1b5ee85..3701c0856 100644 --- a/src/orm/query/grammars/grammar.cpp +++ b/src/orm/query/grammars/grammar.cpp @@ -59,7 +59,7 @@ QString Grammar::compileSelect(QueryBuilder &query) const QString Grammar::compileInsert(const QueryBuilder &query, const QVector &values) const { - // TODO feature, insert with empty values, this code will never be triggered, because check in the QueryBuilder::insert, even all other code works correctly and support empty values silverqx + // FEATURE insert with empty values, this code will never be triggered, because check in the QueryBuilder::insert, even all other code works correctly and support empty values silverqx if (values.isEmpty()) return QStringLiteral("insert into %1 default values").arg(query.getFrom()); @@ -531,7 +531,7 @@ QString Grammar::compileDeleteWithJoins(const QueryBuilder &query, const QString QString Grammar::columnize(const QStringList &columns) const { - // TODO security, I'm not using wrap for columns (I'm not processing/quoting columns), Qt's mysql driver and mysql_stmt_prepare() don't quote columns, I will have to implement wrap logic for columns? silverqx + // TODO security, I'm not using wrap for columns (I'm not processing/quoting columns), Qt's mysql driver and mysql_stmt_prepare() don't quote columns, I will have to implement wrap logic for columns, YES I DO 😈 silverqx // TODO docs, after investigation of 👆, write paragraph into documentation, about DB::raw() for columns, https://laravel.com/docs/8.x/queries#raw-expressions silverqx return joinContainer(columns, QStringLiteral(", ")); } diff --git a/src/orm/query/joinclause.cpp b/src/orm/query/joinclause.cpp index 7935c139a..10225c0c3 100644 --- a/src/orm/query/joinclause.cpp +++ b/src/orm/query/joinclause.cpp @@ -31,7 +31,7 @@ JoinClause &JoinClause::on(const QString &first, const QString &comparison, return *this; } -// TODO api different silverqx +// NOTE api different silverqx JoinClause & JoinClause::orOn(const QString &first, const QString &comparison, const QString &second)