From 55aade8ad50aa16f847ba8b14ceb24bd7f3d98ac Mon Sep 17 00:00:00 2001 From: Sapotong Date: Thu, 6 Apr 2023 11:23:12 +0700 Subject: [PATCH] Bug fix --- src/DB/Codeigniter4Adapter.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/DB/Codeigniter4Adapter.php b/src/DB/Codeigniter4Adapter.php index 28bf903..bcc8504 100644 --- a/src/DB/Codeigniter4Adapter.php +++ b/src/DB/Codeigniter4Adapter.php @@ -2,6 +2,7 @@ namespace Ozdemir\Datatables\DB; +use Ozdemir\Datatables\Iterators\ColumnCollection; use Ozdemir\Datatables\Query; /** @@ -67,6 +68,20 @@ public function escape($string, Query $query) return '?'; } + /** + * @param string $query + * @param ColumnCollection $columns + * @return string + */ + public function makeQueryString(string $query, ColumnCollection $columns): string + { + if ($this->db->getPlatform() == 'Postgre') { + return 'SELECT "'.implode('", "', $columns->names())."\" FROM ($query)t"; + } + + return 'SELECT `'.implode('`, `', $columns->names())."` FROM ($query)t"; + } + /** * @param $query * @return string