From d9e1b1d242597f4804a9611fd419e2fd53b2ecea Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Sat, 29 Jul 2023 20:54:22 +0300 Subject: [PATCH 1/5] Update AbstractQuery.php --- webfiori/database/AbstractQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webfiori/database/AbstractQuery.php b/webfiori/database/AbstractQuery.php index c3c1260..1068b30 100644 --- a/webfiori/database/AbstractQuery.php +++ b/webfiori/database/AbstractQuery.php @@ -1024,7 +1024,7 @@ public function table($tblName) { } $this->getSchema()->addTable($tableObj); $this->prevQueryObj = $this->copyQuery(); - $this->prevQueryObj->resetBinding(); + $this->resetBinding(); if (strlen($this->query) != 0) { $this->setQuery($this->getQuery()); @@ -1068,7 +1068,7 @@ public function union(AbstractQuery $query, $all = false) { $unionStm = $uAll ? "\nunion all\n" : "\nunion\n"; $this->setQuery($queries[$count - 2]['query'].$unionStm.$query->getQuery()); - $this->setBindings($this->getTempBinding(), 'first'); + $this->setBindings($query->getBindings(), 'first'); } return $this; From 028fc9f99019b62a1677686a21c348ce39cee574 Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Sat, 29 Jul 2023 20:54:38 +0300 Subject: [PATCH 2/5] Update MySQLQuery.php --- webfiori/database/mysql/MySQLQuery.php | 1 + 1 file changed, 1 insertion(+) diff --git a/webfiori/database/mysql/MySQLQuery.php b/webfiori/database/mysql/MySQLQuery.php index d66f045..96fb19f 100644 --- a/webfiori/database/mysql/MySQLQuery.php +++ b/webfiori/database/mysql/MySQLQuery.php @@ -142,6 +142,7 @@ public function copyQuery(): AbstractQuery { $copy->offset($this->getOffset()); $copy->setTable($this->getTable(), false); $copy->setSchema($this->getSchema()); + $copy->setBindings($this->getBindings()); // $copy->setBindings($this->getBindings()); return $copy; } From 226f4b9a2c8b256d870883ef0fea79f7c922b553 Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Mon, 4 Dec 2023 01:58:32 +0300 Subject: [PATCH 3/5] Added PHP 8.3 --- .github/workflows/php83.yml | 68 +++++++++++++++++++++++++++++++++++++ README.md | 19 ++++++----- 2 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/php83.yml diff --git a/.github/workflows/php83.yml b/.github/workflows/php83.yml new file mode 100644 index 0000000..9776a92 --- /dev/null +++ b/.github/workflows/php83.yml @@ -0,0 +1,68 @@ +name: Build PHP 8.3 + +on: + push: + branches: [ main, dev ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ${{ matrix.os }} + services: + sql.data: + image: mcr.microsoft.com/mssql/server:2019-latest + env: + SA_PASSWORD: 1234567890@Eu + ACCEPT_EULA: Y + MSSQL_PID: Express + ports: + - "1433:1433" + strategy: + fail-fast: true + matrix: + os: [ ubuntu-latest ] + php: [8.3] + + name: PHP${{matrix.php}} - ${{matrix.os}} + + steps: + - name: Clone Repo + uses: actions/checkout@v1 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mysqli, mbstring, sqlsrv + tools: phpunit:9.5.20, composer + + - name: Shutdown Ubuntu MySQL + run: sudo service mysql stop + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '5.7' + mysql database: 'testing_db' + mysql root password: 123456 + mysql user: 'root' + mysql password: 123456 + + - name: Wait for MySQL + run: | + while ! mysqladmin ping --host=127.0.0.1 --password=123456 --silent; do + sleep 1 + done + + - name: Setup MSSQL + run: sqlcmd -S localhost -U SA -P 1234567890@Eu -Q 'create database testing_db' + + - name: Install Dependencies + run: composer install --prefer-source --no-interaction --no-dev + + - name: Execute Tests + run: phpunit + + - name: CodeCov + uses: codecov/codecov-action@v1 \ No newline at end of file diff --git a/README.md b/README.md index 9bb04ee..dcbee0e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Database abstraction layer of WebFiori framework.

- PHP 8 Build Status + PHP 8 Build Status CodeCov @@ -43,14 +43,15 @@ Database abstraction layer of WebFiori framework. ## Supported PHP Versions | Build Status | |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| | -| | -| | -| | -| | -| | -| | -| | +| | +| | +| | +| | +| | +| | +| | +| | +| | ## Supported Databases - MySQL From b475f7d690f6961ab8c71ca1d2cc154055e5503b Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Mon, 4 Dec 2023 02:16:13 +0300 Subject: [PATCH 4/5] Update AbstractQuery.php --- webfiori/database/AbstractQuery.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/webfiori/database/AbstractQuery.php b/webfiori/database/AbstractQuery.php index 649522d..28ad320 100644 --- a/webfiori/database/AbstractQuery.php +++ b/webfiori/database/AbstractQuery.php @@ -633,7 +633,7 @@ public function on(string $leftCol, string $rightCol, $cond = '=', $joinWith = ' $table->getLeft()->addColumns([ $leftCol => ['type' => 'varchar'] ]); - $leftColObj = $table->getColByKey($leftCol); + $leftColObj = $table->getLeft()->getColByKey($leftCol); } $leftColObj->setWithTablePrefix(false); @@ -649,7 +649,7 @@ public function on(string $leftCol, string $rightCol, $cond = '=', $joinWith = ' $table->getRight()->addColumns([ $rightCol => ['type' => 'varchar'] ]); - $rightColObj = $table->getColByKey($rightCol); + $rightColObj = $table->getRight()->getColByKey($rightCol); } $rightColObj->setWithTablePrefix(false); $rightColName = $rightColObj->getOwner()->getName().'.'.$rightColObj->getOldName(); @@ -1011,7 +1011,7 @@ public function table($tblName) { } $this->getSchema()->addTable($tableObj); $this->prevQueryObj = $this->copyQuery(); - $this->resetBinding(); + $this->prevQueryObj->resetBinding(); if (strlen($this->query) != 0) { $this->setQuery($this->getQuery()); @@ -1054,9 +1054,6 @@ public function union(AbstractQuery $query, $all = false) { $uAll = $all === true; $unionStm = $uAll ? "\nunion all\n" : "\nunion\n"; $this->setQuery($queries[$count - 2]['query'].$unionStm.$query->getQuery()); - - $this->setBindings($query->getBindings(), 'first'); - $whereExpr = $query->getTable()->getSelect()->getWhereExpr(); if ($whereExpr !== null) { $whereExpr->setValue(''); From c5582b19d5c03c0feac12ef428c9532a0da3c0a7 Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Mon, 4 Dec 2023 02:16:18 +0300 Subject: [PATCH 5/5] Update MySQLQuery.php --- webfiori/database/mysql/MySQLQuery.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/webfiori/database/mysql/MySQLQuery.php b/webfiori/database/mysql/MySQLQuery.php index bc11bc4..8d6570e 100644 --- a/webfiori/database/mysql/MySQLQuery.php +++ b/webfiori/database/mysql/MySQLQuery.php @@ -143,8 +143,6 @@ public function copyQuery(): AbstractQuery { $copy->setTable($this->getTable(), false); $copy->setSchema($this->getSchema()); $copy->setBindings($this->getBindings()); - // $copy->setBindings($this->getBindings()); - return $copy; } /**