for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SimpleCrud\Queries\Sqlite;
use SimpleCrud\SimpleCrudException;
use SimpleCrud\Queries\Mysql;
use PDO;
/**
* Manages a database select count query in Mysql databases.
*
* @property \SimpleCrud\Table $table
*/
trait UpdateDeleteTrait
{
protected static $options;
* Adds a LIMIT clause.
* @param int $limit
* @param bool $force
* @return self
public function limit($limit, $force = false)
if (!$this->hasCompiledOption('ENABLE_UPDATE_DELETE_LIMIT')) {
if (!$force) {
return $this;
}
throw new SimpleCrudException('Unable to add LIMIT because ENABLE_UPDATE_DELETE_LIMIT compiled option is disabled');
$this->limit = $limit;
limit
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
* Adds an offset to the LIMIT clause.
* @param int $offset
public function offset($offset)
throw new SimpleCrudException('Unable to add LIMIT offset because ENABLE_UPDATE_DELETE_LIMIT compiled option is disabled');
$this->offset = $offset;
offset
* Check whether the sqlite has a compiled option.
* @param string $name
* @return bool
public function hasCompiledOption($name)
if (self::$options === null) {
self::$options = $this->table->getDatabase()->execute('pragma compile_options')->fetchAll(PDO::FETCH_COLUMN);
return in_array($name, self::$options);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: