Skip to main content
The LibSQLTransaction class represents a database transaction in the LibSQL PHP Extension. It provides methods to manage database transactions, execute SQL statements within transactions, and retrieve transaction details.

Class Synopsis

Table of Contents

Description

  • __construct(string connid,stringconn_id, string trx_mode): Construct by LibSQL::transaction().
  • changes(): int: Returns the number of rows changed by the last SQL statement executed within the transaction.
  • isAutocommit(): bool: Checks if the transaction is set to autocommit.
  • exec(string stmt,arraystmt, array parameters = []): int: Executes an SQL statement within the transaction with optional parameters and returns the number of affected rows.
  • query(string stmt,arraystmt, array parameters = []): array: Executes a query within the transaction with optional parameters and returns the result set as an array.
  • commit(): void: Commits the transaction, making all changes permanent.
  • rollback(): void: Rolls back the transaction, undoing all changes made within the transaction.

Example

Notes

Ensure proper error handling and transaction management when using the LibSQLTransaction class to handle potential errors and ensure data integrity.