diff --git a/docs/supported-compilers.mdx b/docs/supported-compilers.mdx index 4874e8cf1..f18bc09d2 100644 --- a/docs/supported-compilers.mdx +++ b/docs/supported-compilers.mdx @@ -8,7 +8,7 @@ keywords: [c++ orm, supported compilers, supported build systems, tinyorm] # Supported Compilers -Following compilers are backed up by the GitHub Action [workflows](https://github.com/silverqx/TinyORM/tree/main/.github/workflows) (CI pipelines), these workflows also include more then __1264 unit tests__ 😮💥. +Following compilers are backed up by the GitHub Action [workflows](https://github.com/silverqx/TinyORM/tree/main/.github/workflows) (CI pipelines), these workflows also include more then __1270 unit tests__ 😮💥.
diff --git a/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp b/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp index ced3a29f3..c985819f1 100644 --- a/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp +++ b/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp @@ -119,6 +119,8 @@ private Q_SLOTS: void where_WithVectorValue_DefaultCondition() const; void where_QueryableValue() const; void where_QueryableColumn() const; + void where_ColumnExpression() const; + void where_ValueExpression() const; void whereNot() const; void whereNot_WithVectorValue() const; @@ -1302,6 +1304,28 @@ void tst_MySql_QueryBuilder::where_QueryableColumn() const } } +void tst_MySql_QueryBuilder::where_ColumnExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(DB::raw(ID), "=", 3); + QCOMPARE(builder->toSql(), + "select * from `torrents` where id = ?"); + QCOMPARE(builder->getBindings(), + QVector {QVariant(3)}); +} + +void tst_MySql_QueryBuilder::where_ValueExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(ID, "=", DB::raw(3)) + .orWhereEq(DB::raw(NAME), DB::raw("'test3'")); + QCOMPARE(builder->toSql(), + "select * from `torrents` where `id` = 3 or name = 'test3'"); + QVERIFY(builder->getBindings().isEmpty()); +} + void tst_MySql_QueryBuilder::whereNot() const { { diff --git a/tests/auto/unit/orm/query/postgresql_querybuilder/tst_postgresql_querybuilder.cpp b/tests/auto/unit/orm/query/postgresql_querybuilder/tst_postgresql_querybuilder.cpp index 20a132965..a1480cac4 100644 --- a/tests/auto/unit/orm/query/postgresql_querybuilder/tst_postgresql_querybuilder.cpp +++ b/tests/auto/unit/orm/query/postgresql_querybuilder/tst_postgresql_querybuilder.cpp @@ -71,6 +71,8 @@ private Q_SLOTS: void where() const; void where_WithVectorValue() const; void where_WithVectorValue_DefaultCondition() const; + void where_ColumnExpression() const; + void where_ValueExpression() const; void whereNot() const; void whereNot_WithVectorValue_DefaultCondition() const; @@ -904,6 +906,28 @@ void tst_PostgreSQL_QueryBuilder::where_WithVectorValue_DefaultCondition() const QVector({QVariant(100), QVariant(3), QVariant(10)})); } +void tst_PostgreSQL_QueryBuilder::where_ColumnExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(DB::raw(ID), "=", 3); + QCOMPARE(builder->toSql(), + R"(select * from "torrents" where id = ?)"); + QCOMPARE(builder->getBindings(), + QVector {QVariant(3)}); +} + +void tst_PostgreSQL_QueryBuilder::where_ValueExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(ID, "=", DB::raw(3)) + .orWhereEq(DB::raw(NAME), DB::raw("'test3'")); + QCOMPARE(builder->toSql(), + R"(select * from "torrents" where "id" = 3 or name = 'test3')"); + QVERIFY(builder->getBindings().isEmpty()); +} + void tst_PostgreSQL_QueryBuilder::whereNot() const { { diff --git a/tests/auto/unit/orm/query/sqlite_querybuilder/tst_sqlite_querybuilder.cpp b/tests/auto/unit/orm/query/sqlite_querybuilder/tst_sqlite_querybuilder.cpp index ead1fe97c..850e323fe 100644 --- a/tests/auto/unit/orm/query/sqlite_querybuilder/tst_sqlite_querybuilder.cpp +++ b/tests/auto/unit/orm/query/sqlite_querybuilder/tst_sqlite_querybuilder.cpp @@ -70,6 +70,8 @@ private Q_SLOTS: void where() const; void where_WithVectorValue() const; void where_WithVectorValue_DefaultCondition() const; + void where_ColumnExpression() const; + void where_ValueExpression() const; void whereNot() const; void whereNot_WithVectorValue_DefaultCondition() const; @@ -862,6 +864,28 @@ void tst_SQLite_QueryBuilder::where_WithVectorValue_DefaultCondition() const QVector({QVariant(100), QVariant(3), QVariant(10)})); } +void tst_SQLite_QueryBuilder::where_ColumnExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(DB::raw(ID), "=", 3); + QCOMPARE(builder->toSql(), + R"(select * from "torrents" where id = ?)"); + QCOMPARE(builder->getBindings(), + QVector {QVariant(3)}); +} + +void tst_SQLite_QueryBuilder::where_ValueExpression() const +{ + auto builder = createQuery(); + + builder->select("*").from("torrents").where(ID, "=", DB::raw(3)) + .orWhereEq(DB::raw(NAME), DB::raw("'test3'")); + QCOMPARE(builder->toSql(), + R"(select * from "torrents" where "id" = 3 or name = 'test3')"); + QVERIFY(builder->getBindings().isEmpty()); +} + void tst_SQLite_QueryBuilder::whereNot() const { {