Documentation

Command extends Command
in package

FinalYes

Class for executing commands at the access point.

This class extends SqlCommand and provides methods for preparing and executing queries.

Tags
inheritDoc

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 a query and returns a QueryInfo object.
ExecuteReader()  : IDataReader
Executes a query and returns an IDataReader.
PrepareQueryString()  : string
Prepares the query string by adding pagination and other necessary modifications for the specific driver.
_prepareStatement()  : string
Prepares the query with parameters.

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 a query and returns a QueryInfo object.

public ExecuteNonQuery([string|null $returning = null ]) : QueryInfo
Parameters
$returning : string|null = null

(Optional) The column name to return after executing the query.

Return values
QueryInfo

A QueryInfo object containing information about the executed query.

ExecuteReader()

Executes a query and returns an IDataReader.

public ExecuteReader([bool $info = true ]) : IDataReader
Parameters
$info : bool = true

Whether to execute a query to get the 'affected' variable.

Return values
IDataReader

An instance of IDataReader containing the query results.

PrepareQueryString()

Prepares the query string by adding pagination and other necessary modifications for the specific driver.

public PrepareQueryString() : string
Return values
string

The prepared query string.

_prepareStatement()

Prepares the query with parameters.

private _prepareStatement(string $query) : string
Parameters
$query : string

The query string with placeholders.

Return values
string

The prepared query string with parameters replaced.


        
On this page

Search results