tflori/orm

just another orm...

View the Project on GitHub tflori/orm

Build Status Test Coverage Maintainability Latest Stable Version Total Downloads

» API Reference » ORM\QueryBuilder\ExecutesQueries

ORM\QueryBuilder\ExecutesQueries

Table of Contents

Abstract

Trait ExecutesQueries for QueryBuilder

Hold all methods required from the query builder to execute queries.

Methods

ORM\QueryBuilder\ExecutesQueries::all

public function all(): array<int,mixed>
Get all rows from the query result

Please note that this will execute the query - further modifications will not have any effect.

If the query fails you should get an exception. Anyway if we couldn’t get a result or there are no rows it returns an empty array.

Returns array<int,mixed>  

ORM\QueryBuilder\ExecutesQueries::all

↑ top


ORM\QueryBuilder\ExecutesQueries::delete

public function delete(): int
Execute a delete statement on the current table with current where conditions
Returns int The number of deleted rows

ORM\QueryBuilder\ExecutesQueries::delete

↑ top


ORM\QueryBuilder\ExecutesQueries::insert

public function insert(array $rows): int
Execute an insert statement on the current table
Returns int The number of inserted rows
Parameters
Parameter Type Description
$rows array  

ORM\QueryBuilder\ExecutesQueries::insert

↑ top


ORM\QueryBuilder\ExecutesQueries::one

public function one(): mixed|null
Get the next row from the query result

Please note that this will execute the query - further modifications will not have any effect.

If the query fails you should get an exception. Anyway if we couldn’t get a result or there are no more rows it returns null.

Returns mixed|null  

ORM\QueryBuilder\ExecutesQueries::one

↑ top


ORM\QueryBuilder\ExecutesQueries::reset

public function reset(): $this
Reset the position of the cursor to the first row
Returns $this  

ORM\QueryBuilder\ExecutesQueries::reset

↑ top


ORM\QueryBuilder\ExecutesQueries::setFetchMode

public function setFetchMode(
    int $mode, 
    int|string|object $classNameObject = null, 
    array $constructorArgs = null, 
): $this
Proxy to PDOStatement::setFetchMode()

Please note that this will execute the query - further modifications will not have any effect.

Returns $this  
Parameters
Parameter Type Description    
$mode int one of the PDO::FETCH_ constants    
$classNameObject **int string object** class (FETCH_CLASS), column number (FETCH_COLUMN), object (FETCH_INTO)
$constructorArgs array arguments to pass to the constructor (FETCH_CLASS)    

See Also:

ORM\QueryBuilder\ExecutesQueries::setFetchMode

↑ top


ORM\QueryBuilder\ExecutesQueries::update

public function update(array $updates): int
Execute an update statement for the current query

NOTE: not all drivers support UPDATE with JOIN (or FROM). Has to be implemented in the database abstraction layer.

$updates should be an array which columns to update with what value. Use expressions to bypass escaping.

Returns int The number of affected rows
Parameters
Parameter Type Description
$updates array An array of columns to update

ORM\QueryBuilder\ExecutesQueries::update

↑ top