php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74217 Allow creation of deterministic sqlite functions
Submitted: 2017-03-07 14:19 UTC Modified: 2017-03-29 05:21 UTC
From: remo dot laubacher at ortic dot com Assigned: nikic
Status: Closed Package: SQLite related
PHP Version: 7.1.3RC1 OS: any
Private report: No CVE-ID:
 [2017-03-07 14:19 UTC] remo dot laubacher at ortic dot com
Description:
------------
SQLite has an option to define a custom function as deterministic, and by that allowing it to be indexed. This obviously has a huge impact on the performance.

Adding SQLITE_DETERMINISTIC (0x800) to the 4th parameter does the trick, check this for more information:
https://www.sqlite.org/c3ref/create_function.html

From what my basic C skills tell me, it's currently hard-coded in PHP:
https://github.com/php/php-src/blob/master/ext/sqlite3/sqlite3.c#L933

Exposing the 4th parameter would give us this flexibility.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-10 17:37 UTC] andrew dot nester dot dev at gmail dot com
thanks! I just added PR to added desired behaviour but suppose that it requires proper RFC.
 [2017-03-10 17:40 UTC] cmb@php.net
-Package: SQLite related +Package: PDO SQLite
 [2017-03-10 18:02 UTC] cmb@php.net
-Package: PDO SQLite +Package: SQLite related
 [2017-03-10 18:02 UTC] cmb@php.net
The PR targets PDO_sqlite as well as sqlite3, so I'm changing the
package back to "SQLite related".
 [2017-03-12 17:30 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2017-03-12 17:30 UTC] nikic@php.net
PR merged into 7.1.
 [2017-03-12 19:25 UTC] remo dot laubacher at ortic dot com
Thanks guys, I'm impressive about how smooth this went!
 [2017-03-17 14:08 UTC] cmb@php.net
JFTR: documented with <http://svn.php.net/viewvc?view=revision&revision=342155>.
 [2017-03-29 05:21 UTC] remi@php.net
Notice SQLITE_DETERMINISTIC is only available in recent sqlite versions, so this change break build with system libsqlite (reproduced on RHEL/CentOS-7 which have sqlite 3.7.17

Patch ready (#ifdef), will apply after a set of tests
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Thu Jun 22 18:02:00 2017 UTC