AbstractStatements
abstract class AbstractStatements implements IStatementsAbstract (View source)
The GenericDatabase\Abstract\AbstractStatements that handles database statements.
It implements the IStatements interface and provides a set of methods for managing database connections, options, reports, and metadata.
Main functionalities:
- Provides a base class for managing database statements.
- Allows dynamic setting and getting of options using a connection instance and an options array.
- Provides a common interface for all options classes.
Methods:
getInstance: Returns the current database connection instance.set: Sets a value using a dynamic method call on the database connection instance.get: Gets a value using a dynamic method call on the database connection instance.getOptionsHandler: Returns the current options handler instance.getReportHandler: Returns the current report handler instance.setAllMetadata: Resets all metadata to default values.getAllMetadata: Returns the current metadata instance.getQueryString: Returns the current query string.setQueryString: Sets the query string.getQueryParameters: Returns the current query parameters.setQueryParameters: Sets the query parameters.getQueryRows: Returns the number of rows fetched.setQueryRows: Sets the number of rows fetched.getQueryColumns: Returns the number of columns in the result.setQueryColumns: Sets the number of columns in the result.getAffectedRows: Returns the number of affected rows.setAffectedRows: Sets the number of affected rows.getStatement: Returns the current statement object.setStatement: Sets the statement object.
Fields:
$instance: The connection instance used for dynamic operations.$optionsHandler: The options handler for managing configuration.$reportHandler: The report handler for managing configuration.$metadata: The metadata handler for managing configuration.$statement: The statement handler for managing configuration.
Note that some of these methods are used to manage metadata, which is an instance of the Metadata class. The metadata is used to store information about the query, such as the query string, parameters, rows fetched, and columns.
Properties
| static protected IConnection | $instance | ||
| static protected IOptions | $optionsHandler | ||
| static protected IReport | $reportHandler | ||
| protected Metadata | $metadata | ||
| protected mixed|null | $statement |
Methods
Initialize statements with required handlers
Get the database connection instance
Set a value using dynamic method call
Get a value using dynamic method call
Get the options handler instance
Get the report handler instance
Reset all metadata to default values
Get all metadata
Get the current query string
Set the query string
Get the current query parameters
Set the query parameters
Get number of rows fetched
Set number of rows fetched
Get number of columns in result
Set number of columns in result
Get number of affected rows
Set number of affected rows
Get current statement object
Set statement object
Details
__construct(IConnection $instance, IOptions $optionsHandler, IReport $reportHandler)
Initialize statements with required handlers
static IConnection
getInstance()
Get the database connection instance
void
set(string $name, mixed $value)
Set a value using dynamic method call
mixed
get(string $name)
Get a value using dynamic method call
IOptions
getOptionsHandler()
Get the options handler instance
IReport
getReportHandler()
Get the report handler instance
void
setAllMetadata()
Reset all metadata to default values
object
getAllMetadata()
Get all metadata
string
getQueryString()
Get the current query string
void
setQueryString(string $params)
Set the query string
array|null
getQueryParameters()
Get the current query parameters
void
setQueryParameters(array|null $params)
Set the query parameters
int|false
getQueryRows()
Get number of rows fetched
void
setQueryRows(callable|int|false $params)
Set number of rows fetched
int|false
getQueryColumns()
Get number of columns in result
void
setQueryColumns(int|false $params)
Set number of columns in result
int|false
getAffectedRows()
Get number of affected rows
void
setAffectedRows(int|false $params)
Set number of affected rows
mixed
getStatement()
Get current statement object
void
setStatement(mixed $statement)
Set statement object