Function: dbshard()

function dbshard(string $shard_name): ?\SmartFactory\DatabaseWorkers\DBWorker;

Short function for requesting the dbworker connected to the specified shard.

Parameters

Name Pass type Value type Default value Description
$shard_name by value string

The name of the shard.

Returns

?\SmartFactory\DatabaseWorkers\DBWorker

returns DBWorker object or null if the object could not be created.

Throws

\Exception

It might throw the following exceptions in the case of any errors:

  • if the interface or class does not exist.
  • if the shard was not found.
  • if the check of the classes and interfaces fails.
  • if the php extension is not installed.
  • db_missing_type_error - if the database type is not specified.
  • db_conn_data_error - if the connection parameters are incomplete.
  • db_server_conn_error - if the database server cannot be connected.
  • db_not_exists_error - if database does not exists od inaccesible to the user.

Authors

Oleg Schildt

Package

Source code