Releases: bpolaszek/where
Releases · bpolaszek/where
Random named placeholders
To avoid conflicts with existing placeholders into the same query, we added support for random named placeholders in field helpers. They can be simply enabled by passing ??
as the $placeholder
argument.
Examples:
use function BenTools\Where\field;
$condition = field('foo')->equals('bar');
echo $condition; // "foo = ?"
var_dump($condition->getValues()); // ['bar']
$condition = field('foo')->equals('bar', null);
echo $condition; // "foo = bar"
var_dump($condition->getValues()); // []
$condition = field('foo')->equals('bar', 'baz');
echo $condition; // "foo = :baz"
var_dump($condition->getValues()); // ['baz' => 'bar']
$condition = field('foo')->equals('bar', '??');
echo $condition; // "foo = :pbdnsvvx"
var_dump($condition->getValues()); // ['pbdnsvvx' => 'bar']
$condition = field('foo')->in(['bar', 'baz']);
echo $condition; // "foo IN (?, ?)"
var_dump($condition->getValues()); // ['bar', 'baz']
$condition = field('foo')->in(['bar', 'baz'], '??');
echo $condition; // "foo IN (:qifhdhff, :rqxshnae)"
var_dump($condition->getValues()); // ['qifhdhff' => 'bar', 'rqxshnae' => 'baz']
Preview Helper
Expression objects now have a preview()
method, allowing you to debug prepared statements.
Initial release
1.0 Initial commit