Compare commits
No commits in common. "1339de93bf08d773207468227f7d134d41e68688" and "5a1fdcccedf818897a3468d5457875fabfb2ce28" have entirely different histories.
1339de93bf
...
5a1fdccced
9 changed files with 23 additions and 32 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.2408.401738
|
0.2408.182001
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// IDbConnection.php
|
// IDbConnection.php
|
||||||
// Created: 2021-04-30
|
// Created: 2021-04-30
|
||||||
// Updated: 2024-09-13
|
// Updated: 2022-02-27
|
||||||
|
|
||||||
namespace Index\Data;
|
namespace Index\Data;
|
||||||
|
|
||||||
|
@ -18,13 +18,6 @@ interface IDbConnection extends ICloseable {
|
||||||
*/
|
*/
|
||||||
function getLastInsertId(): int|string;
|
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.
|
* Prepares a statement for execution and returns a database statement instance.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// IDbStatement.php
|
// IDbStatement.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-03
|
||||||
|
|
||||||
namespace Index\Data;
|
namespace Index\Data;
|
||||||
|
|
||||||
|
@ -58,10 +58,8 @@ interface IDbStatement extends ICloseable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes this statement.
|
* Executes this statement.
|
||||||
*
|
|
||||||
* @return int|string Number of rows affected by the query.
|
|
||||||
*/
|
*/
|
||||||
function execute(): int|string;
|
function execute(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets this statement for reuse.
|
* Resets this statement for reuse.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// MariaDBConnection.php
|
// MariaDBConnection.php
|
||||||
// Created: 2021-04-30
|
// Created: 2021-04-30
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-04
|
||||||
|
|
||||||
namespace Index\Data\MariaDB;
|
namespace Index\Data\MariaDB;
|
||||||
|
|
||||||
|
@ -146,6 +146,11 @@ 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 {
|
public function getAffectedRows(): int|string {
|
||||||
return $this->connection->affected_rows;
|
return $this->connection->affected_rows;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// MariaDBStatement.php
|
// MariaDBStatement.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-03
|
||||||
|
|
||||||
namespace Index\Data\MariaDB;
|
namespace Index\Data\MariaDB;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class MariaDBStatement implements IDbStatement {
|
||||||
return $this->statement->insert_id;
|
return $this->statement->insert_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(): int|string {
|
public function execute(): void {
|
||||||
$args = [''];
|
$args = [''];
|
||||||
|
|
||||||
foreach($this->params as $key => $param) {
|
foreach($this->params as $key => $param) {
|
||||||
|
@ -154,8 +154,6 @@ class MariaDBStatement implements IDbStatement {
|
||||||
|
|
||||||
if(!$this->statement->execute())
|
if(!$this->statement->execute())
|
||||||
throw new RuntimeException($this->getLastErrorString(), $this->getLastErrorCode());
|
throw new RuntimeException($this->getLastErrorString(), $this->getLastErrorCode());
|
||||||
|
|
||||||
return $this->statement->affected_rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset(): void {
|
public function reset(): void {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// NullDbConnection.php
|
// NullDbConnection.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-01
|
||||||
|
|
||||||
namespace Index\Data\NullDb;
|
namespace Index\Data\NullDb;
|
||||||
|
|
||||||
|
@ -15,10 +15,6 @@ class NullDbConnection implements IDbConnection {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAffectedRows(): int|string {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function prepare(string $query): IDbStatement {
|
public function prepare(string $query): IDbStatement {
|
||||||
return new NullDbStatement;
|
return new NullDbStatement;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// NullDbStatement.php
|
// NullDbStatement.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-03
|
||||||
|
|
||||||
namespace Index\Data\NullDb;
|
namespace Index\Data\NullDb;
|
||||||
|
|
||||||
|
@ -27,9 +27,7 @@ class NullDbStatement implements IDbStatement {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(): int|string {
|
public function execute(): void {}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reset(): void {}
|
public function reset(): void {}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// SQLiteConnection.php
|
// SQLiteConnection.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-03
|
||||||
|
|
||||||
namespace Index\Data\SQLite;
|
namespace Index\Data\SQLite;
|
||||||
|
|
||||||
|
@ -379,6 +379,11 @@ class SQLiteConnection implements IDbConnection, IDbTransactions {
|
||||||
$this->connection->enableExceptions(true);
|
$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 {
|
public function getAffectedRows(): int|string {
|
||||||
return $this->connection->changes();
|
return $this->connection->changes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// SQLiteStatement.php
|
// SQLiteStatement.php
|
||||||
// Created: 2021-05-02
|
// Created: 2021-05-02
|
||||||
// Updated: 2024-09-13
|
// Updated: 2024-08-03
|
||||||
|
|
||||||
namespace Index\Data\SQLite;
|
namespace Index\Data\SQLite;
|
||||||
|
|
||||||
|
@ -83,13 +83,11 @@ class SQLiteStatement implements IDbStatement {
|
||||||
return $this->connection->getLastInsertId();
|
return $this->connection->getLastInsertId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(): int|string {
|
public function execute(): void {
|
||||||
$result = $this->statement->execute();
|
$result = $this->statement->execute();
|
||||||
if($result === false)
|
if($result === false)
|
||||||
throw new RuntimeException((string)$this->connection->getLastErrorString(), $this->connection->getLastErrorCode());
|
throw new RuntimeException((string)$this->connection->getLastErrorString(), $this->connection->getLastErrorCode());
|
||||||
$this->result = $result;
|
$this->result = $result;
|
||||||
|
|
||||||
return $this->connection->getAffectedRows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset(): void {
|
public function reset(): void {
|
||||||
|
|
Loading…
Reference in a new issue