LibSQL Result
On this page, you will find more information about the libSQL Result and available functions.
The LibSQLResult
class represents the result set of a LibSQL query. It provides methods for retrieving query results and metadata about the result set.
Methods
fetchArray
Fetches the result set as an array or an iterator.
Parameters
LibSQL::LIBSQL_BOTH
(optional): The fetching mode. Defaults toLibSQL::LIBSQL_BOTH
(both associative and numerical arrays).LibSQL::LIBSQL_ASSOC
: Return an associative array.LibSQL::LIBSQL_NUM
: Return a numerical array.LibSQL::LIBSQL_BOTH
: Return both associative and numerical arrays.LibSQL::LIBSQL_ALL
: Return all results.LibSQL::LIBSQL_LAZY
: Return a generator for lazy-loading results.
Returns
array|LibSQLIterator
- The fetched result set
Example
Read more detail about LibSQLIterator Class
finalize
Finalizes the result set and frees the associated resources.
Returns
- (void)
Example
reset
Resets the result set for re-execution. This can be used to iterate over the same results multiple times.
Returns
void
Example
columnName
Retrieves the name of a column by its index.
Parameters
int $column
: The index of the column (zero-based).
Returns
A string
containing the name of the specified column.
Example
columnType
Retrieves the type of a column by its index.
Parameters
int $column
: The index of the column (zero-based).
Returns
A string
containing the data type of the specified column.
Example
numColumns
Retrieves the number of columns in the result set.
Returns
An int
representing the total number of columns in the result set.