Skip to content

Commit

Permalink
Restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Jul 8, 2024
1 parent 861df4e commit 92cae6e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
14 changes: 4 additions & 10 deletions web/lib/MRBS/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,6 @@ abstract public function quote(string $identifier): string;
// Must be called right after an insert on that table!
abstract public function insert_id(string $table, string $field) : int;

// Determines whether the database supports multiple locks
public function supportsMultipleLocks(): bool
{
return true;
}

// Acquire a mutual-exclusion lock.
// Returns true if the lock is acquired successfully, otherwise false.
abstract public function mutex_lock(string $name): bool;
Expand Down Expand Up @@ -447,10 +441,10 @@ abstract public function syntax_on_duplicate_key_update(

// Determines whether the driver returns native types (eg a PHP int
// for an SQL INT).
public function returnsNativeTypes() : bool
{
return true;
}
abstract public function returnsNativeTypes() : bool;

// Determines whether the database supports multiple locks
abstract public function supportsMultipleLocks(): bool;

// Returns the syntax for an "upsert" query. Unfortunately getting the id of the
// last row differs between MySQL and PostgreSQL. In PostgreSQL the query will
Expand Down
15 changes: 15 additions & 0 deletions web/lib/MRBS/DB_pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ private static function hash(string $name) : int
}


// Determines whether the driver returns native types (eg a PHP int
// for an SQL INT).
public function returnsNativeTypes() : bool
{
return true;
}


// Determines whether the database supports multiple locks
public function supportsMultipleLocks(): bool
{
return true;
}


// Acquire a mutual-exclusion lock.
// Returns true if the lock is acquired successfully, otherwise false.
public function mutex_lock(string $name) : bool
Expand Down

0 comments on commit 92cae6e

Please sign in to comment.