final class ZtdMysqliStatement
    extends MysqliStatementBindingBridge
Public API: explicitly declared with @visibility public.

mysqli_stmt wrapper that applies ZTD rewrite/simulation on execute().

Uses delegation pattern: extends mysqli_stmt for type compatibility, but delegates all operations to an inner mysqli_stmt instance.

All public methods are explicitly overridden to prevent parent class implementation from being called.

Properties are delegated via __get/__isset to the delegate instance.

Execute a parameterized simulated insertdoctest
$container = \Testcontainers\Testcontainers::run(\Container\MySql80Container::class);
    $native = new \mysqli(str_replace('localhost', '127.0.0.1', $container->getHost()), 'root', 'root', 'test', $container->getMappedPort(3306));
    $native->set_charset('utf8mb4');
    $native->query('CREATE TABLE contacts (id INT PRIMARY KEY, name VARCHAR(100))');
    $ztd = \ZtdQuery\Adapter\Mysqli\ZtdMysqli::fromMysqli($native);
    $statement = $ztd->prepare('INSERT INTO contacts VALUES (?, ?)');
    $statement->execute([7, 'Alice']) // => true
    $statement->ztdAffectedRows() // => 1
    $ztd->query('SELECT name FROM contacts')->fetch_all(MYSQLI_ASSOC) // => [['name' => 'Alice']]
    $native->query('SELECT name FROM contacts')->fetch_all(MYSQLI_ASSOC) // => []
    $native->query('DROP TABLE contacts');
    $container->stop();

Methods§

public function __construct(mysqli_stmt $delegate, Session $session, ?RewritePlan $plan)

Wrap the prepared statement with its session and optional rewrite plan.

Parameters

$delegatemysqli_stmt
$sessionSession
$plan?RewritePlan
Calls 2
public function __get(string $name): mixed

Delegate property access to the delegate instance.

Handles affected_rows and num_rows specially when ZTD result is available.

Parameters

$namestring

Returns

mixed
Calls 5
public function __isset(string $name): bool

Delegate property isset check to the delegate instance.

Parameters

$namestring

Returns

bool
Calls 1
public function ztdAffectedRows(): int

Get affected rows for ZTD results.

This method exists because mysqli_stmt's C extension property handler takes precedence over __get, making $stmt->affected_rows inaccessible when the parent constructor was not called. This provides a safe alternative for ZtdMysqli to query affected rows after execution.

Returns

int The number of affected rows from ZTD processing, or from the delegate.
Test cases 4
Calls 1
public function execute(array<mixed, mixed>|null $params = null): bool

Execute the statement, applying ZTD simulation as needed.

Parameters

$paramsarray<mixed, mixed>|nullOptional parameters to bind (PHP 8.1+).

Returns

bool

Throws

ZtdMysqliException When the session cannot process the native result.
Test cases 17
Calls 1
public function close()
public function free_result(): void
public function reset(): bool
public function data_seek(int $offset): void

{@inheritDoc}

Parameters

$offsetint
Test cases 1
Calls 1
public function result_metadata(): mysqli_result|false

{@inheritDoc}

Returns

mysqli_result|false
Test cases 1
Calls 1
public function attr_get(int $attribute): int

{@inheritDoc}

Parameters

$attributeint

Returns

int

Throws

ZtdMysqliException When the native attribute cannot be read.
Test cases 1
Calls 2
public function attr_set(int $attribute, int $value): bool

{@inheritDoc}

Parameters

$attributeint
$valueint

Returns

bool
Test cases 1
Calls 1
public function get_warnings(): mysqli_warning|false

{@inheritDoc}

Returns

mysqli_warning|false
Test cases 1
Calls 1
public function more_results(): bool
public function next_result(): bool
public function prepare(string $query): bool

{@inheritDoc}

Parameters

$querystring

Returns

bool
Test cases 1
Calls 1
public function send_long_data(int $param_num, string $data): bool

{@inheritDoc}

Parameters

$param_numint
$datastring

Returns

bool
Test cases 1
Calls 1

Private surface 1§

Implementation details, listed for orientation only.

private StatementExecution $execution

Test cases 29§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 22
Other tests reaching this symbol 7

Relations§

Instantiated in 1
Type checks 1