summaryrefslogtreecommitdiffstatshomepage
path: root/src/SemanticScuttle/db/firebird.php
diff options
context:
space:
mode:
authorGravatar Tom Willemse2024-06-10 23:38:09 -0700
committerGravatar Tom Willemse2024-06-10 23:38:09 -0700
commiteb81d7b851f51ab5919be78493737ef2abf49aab (patch)
tree8559f83f83e1cab0b6cb9a0d0fa94f8b0bcb1959 /src/SemanticScuttle/db/firebird.php
parentc6101ba37422dcfcf16131d9dc41692e0725aa81 (diff)
downloadscuttle-eb81d7b851f51ab5919be78493737ef2abf49aab.tar.gz
scuttle-eb81d7b851f51ab5919be78493737ef2abf49aab.zip
Fix using SQLite as a database engine
- The ‘sqlite_*’ functions don't exist anymore in PHP 8. They have been replaced with several ‘SQLite3*’ classes. - There are some differences between MySQL and SQLite queries that showed up while doing this work. These differences have been pushed into a QueryBuilder class so that the other database engines don't have to be modified. This is done in an ad-hoc basis for now, just to get things working. - SQLite doesn't support the ‘!’ negation operator used as ‘!ISNULL(...)’, instead I use ‘IIF(...)’. - SQLite doesn't support a ‘LEFT(...)’ function, instead I use ‘SUBSTRING(..., 0, ...)’. - The SQLite3 module doesn't provide a connection identifier, instead you use an object that represents the connection. - SQLite doesn't support the ‘ALL’ keyword (or at least doesn't support it in the same way MySQL does). Instead of ‘<> ALL <subquery>’ I use ‘NOT IN <subquery>’. - The ‘SQLite3*’ classes don't provide any way to determine how many rows have been returned without iterating through all of them, so any place that tries to figure out the rows beforehand just doesn't anymore. - All the database engine classes require a ‘QueryBuilder’ instance. The sqlite one uses a specialized one. I can't test most of these database engines, so I'm focusing on SQLite and MySQL/MariaDB for now.
Diffstat (limited to 'src/SemanticScuttle/db/firebird.php')
-rw-r--r--src/SemanticScuttle/db/firebird.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/SemanticScuttle/db/firebird.php b/src/SemanticScuttle/db/firebird.php
index ab9198a..97a727b 100644
--- a/src/SemanticScuttle/db/firebird.php
+++ b/src/SemanticScuttle/db/firebird.php
@@ -16,6 +16,8 @@ if (!defined('SQL_LAYER'))
define('SQL_LAYER', 'firebird');
+require_once 'QueryBuilder.php';
+
/**
* @package dbal_firebird
* Firebird/Interbase Database Abstraction Layer
@@ -38,6 +40,14 @@ class sql_db
var $persistency;
var $dbname;
var $server;
+
+ public $QueryBuilder;
+
+ public function __construct()
+ {
+ $this->QueryBuilder = new QueryBuilder();
+ }
+
/*2023-12-20 end */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
{