From 81eb2e95a00e9ab371cf77ad9a24d64ee46465af Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Tue, 6 Feb 2024 10:13:54 -0600 Subject: [PATCH] Improve quoteId functionality for numberic detection --- src/Sql/AbstractSql.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Sql/AbstractSql.php b/src/Sql/AbstractSql.php index 9265325..563a566 100644 --- a/src/Sql/AbstractSql.php +++ b/src/Sql/AbstractSql.php @@ -350,8 +350,12 @@ public function quoteId(string $identifier): string $identifierAry[$key] = ($val != '*') ? $this->openQuote . $val . $this->closeQuote : $val; } $quotedId = implode('.', $identifierAry); + } else if (($identifier != '*') && + ((preg_match('/^\$\d*\d$/', $identifier) == 0) && !is_int($identifier) && + !is_float($identifier) && (preg_match('/^\d*$/', $identifier) == 0))) { + $quotedId = $this->openQuote . $identifier . $this->closeQuote; } else { - $quotedId = ($identifier != '*') ? $this->openQuote . $identifier . $this->closeQuote : $identifier; + $quotedId = $identifier; } return $quotedId; @@ -452,4 +456,4 @@ protected function initQuoteType(): void } } -} \ No newline at end of file +}