diff options
| author | lsces <lester@lsces.co.uk> | 2026-02-25 12:58:57 +0000 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-02-25 12:58:57 +0000 |
| commit | 29d3bc6e9c8f04352e886e489acab91ea04b1717 (patch) | |
| tree | a22bf63c503c1f568afaf6051d5b09eaa8ad1b5b | |
| parent | 87f4cfe44872d8514bd015d45a14b9a7dc7fc204 (diff) | |
| download | illuminate-firebird-29d3bc6e9c8f04352e886e489acab91ea04b1717.tar.gz illuminate-firebird-29d3bc6e9c8f04352e886e489acab91ea04b1717.tar.bz2 illuminate-firebird-29d3bc6e9c8f04352e886e489acab91ea04b1717.zip | |
override illuminate select to return lower case keys while firebird datbase is defaulting to upper case
| -rwxr-xr-x | src/FirebirdConnection.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/FirebirdConnection.php b/src/FirebirdConnection.php index a6a849b..f6e0081 100755 --- a/src/FirebirdConnection.php +++ b/src/FirebirdConnection.php @@ -121,6 +121,42 @@ class FirebirdConnection extends DatabaseConnection return $result; }); } + + /** + * Run a select statement against the database. + * + * @param string $query + * @param array $bindings + * @param bool $useReadPdo + * @return array + */ + public function select($query, $bindings = [], $useReadPdo = true) + { + return $this->run($query, $bindings, function ($query, $bindings) use ($useReadPdo) { + if ($this->pretending()) { + return []; + } + + // For select statements, we'll simply execute the query and return an array + // of the database result set. Each element in the array will be a single + // row from the database table, and will either be an array or objects. + $statement = $this->prepared( + $this->getPdoForSelect($useReadPdo)->prepare($query) + ); + + $this->bindValues($statement, $this->prepareBindings($bindings)); + + $statement->execute(); + + $result = []; + while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) { + $lowerCaseRow = array_change_key_case((array) $row, CASE_LOWER); + $result[] = (object) $lowerCaseRow; + } + return count($result) > 0 ? $result : []; + }); + } + /** * Execute a stored procedure. * |
