Expose getAffectedRows method in IDbConnection interface.
This commit is contained in:
parent
24db1bd83d
commit
1339de93bf
5 changed files with 16 additions and 15 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2408.401736
|
||||
0.2408.401738
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// IDbConnection.php
|
||||
// Created: 2021-04-30
|
||||
// Updated: 2022-02-27
|
||||
// Updated: 2024-09-13
|
||||
|
||||
namespace Index\Data;
|
||||
|
||||
|
@ -18,6 +18,13 @@ interface IDbConnection extends ICloseable {
|
|||
*/
|
||||
function getLastInsertId(): int|string;
|
||||
|
||||
/**
|
||||
* Gets the number of rows affected by the last operation.
|
||||
*
|
||||
* @return int|string Number of rows affected by the last operation.
|
||||
*/
|
||||
function getAffectedRows(): int|string;
|
||||
|
||||
/**
|
||||
* Prepares a statement for execution and returns a database statement instance.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// MariaDBConnection.php
|
||||
// Created: 2021-04-30
|
||||
// Updated: 2024-08-04
|
||||
// Updated: 2024-09-13
|
||||
|
||||
namespace Index\Data\MariaDB;
|
||||
|
||||
|
@ -146,11 +146,6 @@ class MariaDBConnection implements IDbConnection, IDbTransactions {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of rows affected by the last operation.
|
||||
*
|
||||
* @return int|string Number of rows affected by the last operation.
|
||||
*/
|
||||
public function getAffectedRows(): int|string {
|
||||
return $this->connection->affected_rows;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// NullDbConnection.php
|
||||
// Created: 2021-05-02
|
||||
// Updated: 2024-08-01
|
||||
// Updated: 2024-09-13
|
||||
|
||||
namespace Index\Data\NullDb;
|
||||
|
||||
|
@ -15,6 +15,10 @@ class NullDbConnection implements IDbConnection {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public function getAffectedRows(): int|string {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function prepare(string $query): IDbStatement {
|
||||
return new NullDbStatement;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
// SQLiteConnection.php
|
||||
// Created: 2021-05-02
|
||||
// Updated: 2024-08-03
|
||||
// Updated: 2024-09-13
|
||||
|
||||
namespace Index\Data\SQLite;
|
||||
|
||||
|
@ -379,11 +379,6 @@ class SQLiteConnection implements IDbConnection, IDbTransactions {
|
|||
$this->connection->enableExceptions(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of rows affected by the last operation.
|
||||
*
|
||||
* @return int|string Number of rows affected by the last operation.
|
||||
*/
|
||||
public function getAffectedRows(): int|string {
|
||||
return $this->connection->changes();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue