Please test Nette Database 3.x with the performance fix
- David Grudl
- Nette Core | 8239
Hello,
I’m preparing the release of the new versions Nette Database 3.2 (and 3.1) and would like to ask for your help with testing. You can try it out using:
composer require nette/database:^3.2.x-dev
One of the most exciting changes is a potential performance boost for the Database Explorer. It’s almost unbelievable that a single line of code (see issue #312) could result in the Explorer being several times faster when listing thousands of records. I’d love to know if the fix works for you.
One of the great features of Nette Database is its ability to automatically choose the correct operator based on the type of the value:
$db->query(['SELECT * FROM tbl WHERE', [
'foo' => $foo,
]]);
// SELECT * FROM tbl WHERE foo = 123 if $foo is a value
// SELECT * FROM tbl WHERE foo IS NULL if $foo is null
// SELECT * FROM tbl WHERE foo IN (1, 2, 3) if $foo is an array
Now, this behavior also works with the NOT
operator:
$db->query(['SELECT * FROM tbl WHERE', [
'foo NOT' => $foo,
]]);
// SELECT * FROM tbl WHERE foo != 123
// SELECT * FROM tbl WHERE foo IS NOT NULL
// SELECT * FROM tbl WHERE foo NOT IN (1, 2, 3)
The behavior with empty arrays has also been fixed:
$db->query(['SELECT * FROM tbl WHERE', [
'foo NOT' => [],
]]);
// SELECT * FROM tbl WHERE 1=1
By the way, I’ve completely revamped the documentation and added a new security page.