Command
in package
Represents a database command abstraction.
Table of Contents
Properties
- $connection : IConnection|null
- $page : int
- $pagesize : int
- $params : array<string|int, mixed>|null
- $query : string
- $type : string
- $_commandtext : string
- The command text.
- $_connection : IConnection|null
- The database connection associated with the command.
- $_page : int
- The current page number.
- $_pagesize : int
- The page size for pagination.
- $_params : array<string|int, mixed>|null
- The parameters for the command.
Methods
- __construct() : mixed
- Constructs a new Command object.
- __get() : mixed
- Magic method to get properties dynamically.
- __set() : void
- Magic method to set properties dynamically.
- ExecuteNonQuery() : QueryInfo
- Executes the command and returns query information.
- ExecuteReader() : IDataReader
- Executes the command and returns a data reader.
- PrepareQueryString() : string
- Prepares the query string before execution.
Properties
$connection read-only
public
IConnection|null
$connection
The database connection associated with the command.
$page read-only
public
int
$page
The current page number.
$pagesize read-only
public
int
$pagesize
The page size for pagination.
$params read-only
public
array<string|int, mixed>|null
$params
The parameters for the command.
$query read-only
public
string
$query
The command text.
$type read-only
public
string
$type
The type of the command (e.g., SELECT, INSERT, UPDATE, DELETE).
$_commandtext
The command text.
protected
string
$_commandtext
= ''
$_connection
The database connection associated with the command.
protected
IConnection|null
$_connection
= null
$_page
The current page number.
protected
int
$_page
= -1
$_pagesize
The page size for pagination.
protected
int
$_pagesize
= 10
$_params
The parameters for the command.
protected
array<string|int, mixed>|null
$_params
= null
Methods
__construct()
Constructs a new Command object.
public
__construct([string $commandtext = '' ][, IConnection|null $connection = null ]) : mixed
Parameters
- $commandtext : string = ''
-
The command text.
- $connection : IConnection|null = null
-
(optional) The database connection. Default is null.
__get()
Magic method to get properties dynamically.
public
__get(string $property) : mixed
Parameters
- $property : string
-
The name of the property.
Return values
mixed —The value of the property, or null if the property does not exist.
__set()
Magic method to set properties dynamically.
public
__set(string $property, mixed $value) : void
Parameters
- $property : string
-
The name of the property.
- $value : mixed
-
The value to set.
ExecuteNonQuery()
Executes the command and returns query information.
public
abstract ExecuteNonQuery([string|null $returning = null ]) : QueryInfo
Parameters
- $returning : string|null = null
-
(optional) The returning clause for the query. Default is null.
Return values
QueryInfo —The query information.
ExecuteReader()
Executes the command and returns a data reader.
public
abstract ExecuteReader([bool $info = true ]) : IDataReader
Parameters
- $info : bool = true
-
(optional) Whether to include query info. Default is true.
Return values
IDataReader —The data reader.
PrepareQueryString()
Prepares the query string before execution.
public
abstract PrepareQueryString() : string
Return values
string —The prepared query string.