note 116737 added to sqlite3.createaggregate
| From: | sukmaagungsaputra at gmail dot com | Date: | Sat, 21 Feb 2015 05:09:12 +0000 |
| Subject: | note 116737 added to sqlite3.createaggregate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201772@lists.php.net to get a copy of this message | ||
Lacks of example, right?
Let's try to give to SQlite3 the capability like ones of MySQL's
- REGEXP operator,
- MD5 function, and
- GROUP_CONCAT aggregate function
$db = new SQLite3($filename);
$db->createFunction('regexp', function ($a,$b) { return preg_match("/$a/i",
$b); });
$db->createFunction('md5', function ($a) { return md5($a); });
$db->createAggregate ('group_concat',
function(&$context, $rownumber, $str) { $context[]=$str; return $context; },
function(&$context) {return implode(",", (array) $context); });
----
Server IP: 72.52.91.14
Probable Submitter: 120.164.42.203
----
Manual Page -- http://php.net/manual/en/sqlite3.createaggregate.php
Edit -- https://master.php.net/note/edit/116737
Del: integrated -- https://master.php.net/note/delete/116737/integrated
Del: useless -- https://master.php.net/note/delete/116737/useless
Del: bad code -- https://master.php.net/note/delete/116737/bad+code
Del: spam -- https://master.php.net/note/delete/116737/spam
Del: non-english -- https://master.php.net/note/delete/116737/non-english
Del: in docs -- https://master.php.net/note/delete/116737/in+docs
Del: other reasons-- https://master.php.net/note/delete/116737
Reject -- https://master.php.net/note/reject/116737
Search -- https://master.php.net/manage/user-notes.php