Skip to content

Commit

Permalink
Make abstract methods really abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 22, 2021
1 parent b80839b commit 6ce4b0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
13 changes: 4 additions & 9 deletions Database/Query.php
Expand Up @@ -36,7 +36,7 @@
* additional methods, but this is discouraged to ensure that the API is the
* same for all database types.
*/
class Query {
abstract class Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
Expand Down Expand Up @@ -179,10 +179,7 @@ public static function commit ( $dbh )
* @param string $db Database name
* @return Query
*/
public static function connect ( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
return false;
}
abstract public static function connect ( $user, $pass='', $host='', $port='', $db='', $dsn='' );


/**
Expand Down Expand Up @@ -979,8 +976,7 @@ protected function _delete()
* @return Result
* @internal
*/
protected function _exec()
{}
abstract protected function _exec();

/**
* Create an INSERT statement
Expand Down Expand Up @@ -1008,8 +1004,7 @@ protected function _insert()
* @return void
* @internal
*/
protected function _prepare( $sql )
{}
abstract protected function _prepare( $sql );

/**
* Protect field names
Expand Down
22 changes: 5 additions & 17 deletions Database/Result.php
Expand Up @@ -30,7 +30,7 @@
* additional methods, but this is discouraged to ensure that the API is the
* same for all database types.
*/
class Result {
abstract class Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
Expand All @@ -39,42 +39,30 @@ class Result {
* Count the number of rows in the result set.
* @return int
*/
public function count ()
{
return 0;
}
abstract public function count ();


/**
* Get the next row in a result set
* @param int PDO row fetch style - PDO::FETCH_ASSOC is the default
* @return array
*/
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return array();
}
abstract public function fetch ( $fetchType=\PDO::FETCH_ASSOC );


/**
* Get all rows in the result set
* @param int PDO row fetch style - PDO::FETCH_ASSOC is the default
* @return array
*/
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return array();
}
abstract public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC );


/**
* After an INSERT query, get the ID that was inserted.
* @return int
*/
public function insertId ()
{
return 0;
}
abstract public function insertId ();
};


0 comments on commit 6ce4b0a

Please sign in to comment.