LibSQL Extension
LibSQLStatement Class
LibSQL PHP Extension class LibSQLStatement
The LibSQLStatement
class represents a prepared SQL statement in the LibSQL PHP Extension. It provides methods to execute the prepared statement, retrieve results, and manage parameters.
Class Synopsis
Table of Contents
__construct(string $conn_id, string $sql)
: Construct aLibSQLStatement
Object.finalize(): void
: Finalizes the prepared statement.execute(array $parameters): int
: Executes the prepared statement with given parameters and returns the number of affected rows.query(array $parameters): array
: Executes the prepared statement and retrieves the result set.reset(): void
: Resets the prepared statement.parameterCount(): int
: Gets the number of parameters in the prepared statement.parameterName(int $idx): string
: Gets the name of a parameter by index.columns(): array
: Gets the column names of the result set.
Description
__construct(string $conn_id, string $sql)
: instances are created byLibSQL::prepare()
.finalize()
: Finalizes the prepared statement, releasing any resources associated with it.execute(array $parameters): int
: Executes the prepared statement with the specified parameters and returns the number of affected rows.query(array $parameters): array
: Executes the prepared statement with the specified parameters and retrieves the result set as an array.reset()
: Resets the prepared statement, clearing any previously set parameters or results.parameterCount(): int
: Returns the number of parameters in the prepared statement.parameterName(int $idx): string
: Returns the name of the parameter at the specified index.columns(): array
: Returns an array containing the column names of the result set.
Example
Notes
Ensure proper error handling and parameter validation when using the LibSQLStatement
class to handle potential errors and ensure data integrity.
Was this page helpful?