Changed Data namespace to Db.

In case you wanted more breaking changes.
This commit is contained in:
flash 2024-10-04 22:35:57 +00:00
parent 28d65263be
commit 9ed97e8575
44 changed files with 114 additions and 114 deletions

View file

@ -20,13 +20,13 @@ The way each implementation stores data is NOT guaranteed to be compatible, plea
Requires the `redis` extension.
Valkey is the name of the Linux Foundation's fork of Redis.
### `Index\Data\MariaDb`
### `Index\Db\MariaDb`
Requires the `mysqli` extension.
`mysqlnd` is recommended as the underlying driver, but `libmysql` should work without a hitch.
This driver also works for MySQL as the dependencies would suggest, but you should consider using MariaDB instead of possible.
### `Index\Data\Sqlite`
### `Index\Db\Sqlite`
Requires the `sqlite3` extension.

View file

@ -1 +1 @@
0.2410.42227
0.2410.42235

View file

@ -13,8 +13,8 @@
"phpstan/phpstan": "^1.11"
},
"suggest": {
"ext-mysqli": "Support for the Index\\Data\\MariaDb namespace (both mysqlnd and libmysql are supported).",
"ext-sqlite3": "Support for the Index\\Data\\Sqlite namespace."
"ext-mysqli": "Support for the Index\\Db\\MariaDb namespace (both mysqlnd and libmysql are supported).",
"ext-sqlite3": "Support for the Index\\Db\\Sqlite namespace."
},
"authors": [
{

View file

@ -7,7 +7,7 @@ namespace Index\Config\Db;
use InvalidArgumentException;
use Index\Config\{Config,GetValueInfoTrait,GetValuesTrait,MutableConfigTrait,ScopedConfig};
use Index\Data\{DbConnection,DbStatementCache,DbTools};
use Index\Db\{DbConnection,DbStatementCache,DbTools};
/**
* Provides a configuration based on a {@see DbConnection} instance.

View file

@ -7,7 +7,7 @@ namespace Index\Config\Db;
use UnexpectedValueException;
use Index\Config\ConfigValueInfo;
use Index\Data\DbResult;
use Index\Db\DbResult;
/**
* Provides information about a databased configuration value.

View file

@ -1,9 +1,9 @@
<?php
// DbBackend.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Information about a database layer. Should not have any external dependencies.

View file

@ -1,9 +1,9 @@
<?php
// DbConnection.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
use Index\Closeable;

View file

@ -1,9 +1,9 @@
<?php
// DbConnectionInfo.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Base type for database connection info.

View file

@ -1,9 +1,9 @@
<?php
// DbResult.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
use Index\Closeable;

View file

@ -1,9 +1,9 @@
<?php
// DbResultIterator.php
// Created: 2024-02-06
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
use InvalidArgumentException;
use Iterator;

View file

@ -1,9 +1,9 @@
<?php
// DbResultTrait.php
// Created: 2023-11-09
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Implements common DbResult methods.

View file

@ -1,9 +1,9 @@
<?php
// DbStatement.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
use InvalidArgumentException;
use RuntimeException;

View file

@ -1,9 +1,9 @@
<?php
// DbStatementCache.php
// Created: 2023-07-21
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Container to avoid having many prepared instances of the same query.

View file

@ -1,9 +1,9 @@
<?php
// DbTools.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
use Countable;
use InvalidArgumentException;
@ -18,9 +18,9 @@ use RuntimeException;
* the rest of the URL is described in the documentation of the parseDsn implementation of the respective backend.
*
* The scheme can be a PHP classpath to an implementation of DbBackend, or any of these aliases:
* - `null`: maps to `NullDb\NullDbBackend` or `Index-Data-NullDb-NullDbBackend`, provides a fallback blackhole database backend.
* - `mariadb`, `mysql`: maps to `MariaDb\MariaDbBackend` or `Index-Data-MariaDb-MariaDbBackend`, provides a backend based on the mysqli extension.
* - `sqlite`, `sqlite3`: maps to `Sqlite\SqliteBackend` or `Index-Data-Sqlite-SqliteBackend`, provides a backend based on the sqlite3 extension.
* - `null`: maps to `NullDb\NullDbBackend` or `Index-Db-NullDb-NullDbBackend`, provides a fallback blackhole database backend.
* - `mariadb`, `mysql`: maps to `MariaDb\MariaDbBackend` or `Index-Db-MariaDb-MariaDbBackend`, provides a backend based on the mysqli extension.
* - `sqlite`, `sqlite3`: maps to `Sqlite\SqliteBackend` or `Index-Db-Sqlite-SqliteBackend`, provides a backend based on the sqlite3 extension.
*
* Short names are currently hardcoded and cannot be expanded.
*/

View file

@ -1,9 +1,9 @@
<?php
// DbTransactions.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Indicates supports for transactions in a database connection.

View file

@ -1,9 +1,9 @@
<?php
// DbType.php
// Created: 2021-05-02
// Updated: 2021-05-04
// Updated: 2024-10-04
namespace Index\Data;
namespace Index\Db;
/**
* Map of common database types.

View file

@ -1,12 +1,12 @@
<?php
// MariaDbBackend.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use InvalidArgumentException;
use Index\Data\{DbBackend,DbConnection,DbConnectionInfo};
use Index\Db\{DbBackend,DbConnection,DbConnectionInfo};
use Index\Net\{EndPoint,UnixEndPoint};
/**

View file

@ -1,9 +1,9 @@
<?php
// MariaDbCharacterSetInfo.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
/**
* Contains information about the character set.

View file

@ -1,16 +1,16 @@
<?php
// MariaDbConnection.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli;
use mysqli_sql_exception;
use stdClass;
use InvalidArgumentException;
use RuntimeException;
use Index\Data\{DbConnection,DbTransactions};
use Index\Db\{DbConnection,DbTransactions};
/**
* Represents a connection with a MariaDB or MySQL database server.

View file

@ -1,12 +1,12 @@
<?php
// MariaDbConnectionInfo.php
// Created: 2021-04-30
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use InvalidArgumentException;
use Index\Data\DbConnectionInfo;
use Index\Db\DbConnectionInfo;
use Index\Net\{EndPoint,DnsEndPoint,IpEndPoint,UnixEndPoint};
/**

View file

@ -1,11 +1,11 @@
<?php
// MariaDbParameter.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use Index\Data\{DbTools,DbType};
use Index\Db\{DbTools,DbType};
/**
* Represents a bound parameter.

View file

@ -1,14 +1,14 @@
<?php
// MariaDbResult.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli_result;
use mysqli_stmt;
use InvalidArgumentException;
use Index\Data\{DbResult,DbResultTrait};
use Index\Db\{DbResult,DbResultTrait};
/**
* Represents a MariaDB/MySQL database result.

View file

@ -1,9 +1,9 @@
<?php
// MariaDbResultLib.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli_stmt;
use RuntimeException;

View file

@ -1,9 +1,9 @@
<?php
// MariaDbResultNative.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli_result;
use mysqli_stmt;

View file

@ -1,15 +1,15 @@
<?php
// MariaDbStatement.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli_stmt;
use InvalidArgumentException;
use RuntimeException;
use Stringable;
use Index\Data\{DbType,DbStatement};
use Index\Db\{DbType,DbStatement};
/**
* Represents a MariaDB/MySQL prepared statement.

View file

@ -1,9 +1,9 @@
<?php
// MariaDbWarning.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\MariaDb;
namespace Index\Db\MariaDb;
use mysqli_warning;
use Stringable;

View file

@ -1,11 +1,11 @@
<?php
// DbMigration.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
use Index\Data\DbConnection;
use Index\Db\DbConnection;
/**
* Interface for migration classes to inherit.

View file

@ -1,11 +1,11 @@
<?php
// DbMigrationInfo.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
use Index\Data\DbConnection;
use Index\Db\DbConnection;
/**
* Information on a migration repository item.

View file

@ -1,9 +1,9 @@
<?php
// DbMigrationManager.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
use stdClass;
use DateTimeImmutable;
@ -11,8 +11,8 @@ use DateTimeInterface;
use InvalidArgumentException;
use RuntimeException;
use Index\XDateTime;
use Index\Data\{DbConnection,DbStatement,DbType};
use Index\Data\Sqlite\SqliteConnection;
use Index\Db\{DbConnection,DbStatement,DbType};
use Index\Db\Sqlite\SqliteConnection;
/**
* Provides a common interface for database migrations.
@ -34,8 +34,8 @@ class DbMigrationManager {
private const TEMPLATE = <<<EOF
<?php
use Index\Data\DbConnection;
use Index\Data\Migration\DbMigration;
use Index\Db\DbConnection;
use Index\Db\Migration\DbMigration;
final class %s implements DbMigration {
public function migrate(DbConnection \$conn): void {

View file

@ -1,9 +1,9 @@
<?php
// DbMigrationRepo.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
/**
* Represents a repository of migrations.

View file

@ -1,11 +1,11 @@
<?php
// FsDbMigrationInfo.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
use Index\Data\DbConnection;
use Index\Db\DbConnection;
class FsDbMigrationInfo implements DbMigrationInfo {
private string $name;

View file

@ -1,9 +1,9 @@
<?php
// FsDbMigrationRepo.php
// Created: 2023-01-07
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Migration;
namespace Index\Db\Migration;
use RuntimeException;

View file

@ -1,11 +1,11 @@
<?php
// NullDbBackend.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\NullDb;
namespace Index\Db\NullDb;
use Index\Data\{DbBackend,DbConnection,DbConnectionInfo};
use Index\Db\{DbBackend,DbConnection,DbConnectionInfo};
/**
* Information about the dummy database layer.

View file

@ -1,11 +1,11 @@
<?php
// NullDbConnection.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\NullDb;
namespace Index\Db\NullDb;
use Index\Data\{DbConnection,DbStatement,DbResult};
use Index\Db\{DbConnection,DbStatement,DbResult};
/**
* Represents a dummy database connection.

View file

@ -1,11 +1,11 @@
<?php
// NullDbConnectionInfo.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\NullDb;
namespace Index\Db\NullDb;
use Index\Data\DbConnectionInfo;
use Index\Db\DbConnectionInfo;
/**
* Represents dummy connection info.

View file

@ -1,11 +1,11 @@
<?php
// NullDbResult.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\NullDb;
namespace Index\Db\NullDb;
use Index\Data\{DbResult,DbResultIterator};
use Index\Db\{DbResult,DbResultIterator};
/**
* Represents a dummy database result.

View file

@ -1,11 +1,11 @@
<?php
// NullDbStatement.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\NullDb;
namespace Index\Db\NullDb;
use Index\Data\{DbType,DbResult,DbStatement};
use Index\Db\{DbType,DbResult,DbStatement};
/**
* Represents a dummy database statement.

View file

@ -1,13 +1,13 @@
<?php
// SqliteBackend.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Sqlite;
namespace Index\Db\Sqlite;
use SQLite3;
use InvalidArgumentException;
use Index\Data\{DbBackend,DbConnection,DbConnectionInfo};
use Index\Db\{DbBackend,DbConnection,DbConnectionInfo};
/**
* Information about the SQLite 3 database layer.

View file

@ -1,13 +1,13 @@
<?php
// SqliteConnection.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Sqlite;
namespace Index\Db\Sqlite;
use RuntimeException;
use SQLite3;
use Index\Data\{DbConnection,DbTransactions,DbStatement,DbResult};
use Index\Db\{DbConnection,DbTransactions,DbStatement,DbResult};
/**
* Represents a client for an SQLite database.

View file

@ -1,11 +1,11 @@
<?php
// SqliteConnectionInfo.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Sqlite;
namespace Index\Db\Sqlite;
use Index\Data\DbConnectionInfo;
use Index\Db\DbConnectionInfo;
/**
* Represents information about a SQLite Client.

View file

@ -1,13 +1,13 @@
<?php
// SqliteResult.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Sqlite;
namespace Index\Db\Sqlite;
use SQLite3Result;
use InvalidArgumentException;
use Index\Data\{DbResult,DbResultTrait};
use Index\Db\{DbResult,DbResultTrait};
/**
* Represents an SQLite result set.

View file

@ -1,15 +1,15 @@
<?php
// SqliteStatement.php
// Created: 2021-05-02
// Updated: 2024-10-02
// Updated: 2024-10-04
namespace Index\Data\Sqlite;
namespace Index\Db\Sqlite;
use SQLite3Result;
use SQLite3Stmt;
use InvalidArgumentException;
use RuntimeException;
use Index\Data\{DbTools,DbType,DbStatement,DbResult};
use Index\Db\{DbTools,DbType,DbStatement,DbResult};
/**
* Represents a prepared SQLite SQL statement.

View file

@ -9,7 +9,7 @@ use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;
use Index\Config\{GetValueInfoTrait,GetValuesTrait,MutableConfigTrait};
use Index\Config\Db\{DbConfig,DbConfigValueInfo};
use Index\Data\{DbConnection,DbTools};
use Index\Db\{DbConnection,DbTools};
#[CoversClass(DbConfig::class)]
#[CoversClass(DbConfigValueInfo::class)]

View file

@ -1,16 +1,16 @@
<?php
// DbToolsTest.php
// Created: 2021-04-28
// Updated: 2024-10-02
// Updated: 2024-10-04
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\{CoversClass,UsesClass};
use Index\Data\{DbTools,DbType};
use Index\Data\MariaDb\MariaDbBackend;
use Index\Data\NullDb\NullDbConnection;
use Index\Data\Sqlite\SqliteBackend;
use Index\Db\{DbTools,DbType};
use Index\Db\MariaDb\MariaDbBackend;
use Index\Db\NullDb\NullDbConnection;
use Index\Db\Sqlite\SqliteBackend;
#[CoversClass(DbTools::class)]
#[CoversClass(DbType::class)]
@ -38,7 +38,7 @@ final class DbToolsTest extends TestCase {
$nullDbConn1 = DbTools::create('null:');
$this->assertInstanceOf(NullDbConnection::class, $nullDbConn1);
$nullDbConn2 = DbTools::create('Index-Data-NullDb-NullDbBackend:');
$nullDbConn2 = DbTools::create('Index-Db-NullDb-NullDbBackend:');
$this->assertInstanceOf(NullDbConnection::class, $nullDbConn2);
$maria = new MariaDbBackend;