note 104978 added to function.sqlite-create-function

From: Date: Wed, 20 Jul 2011 05:44:39 +0000
Subject: note 104978 added to function.sqlite-create-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-181713@lists.php.net to get a copy of this message
Although you can create an UDF named 'regexp()', I think it won't be registered as REGEXP operator.. <?php //registering REGEXP function my_sqlite_regexp($x,$y){ return (int)preg_match("$yi",$x); } echo $db->createFunction('regexp','my_sqlite_regexp',2); //testing regexp as function, working $res = $db->query("SELECT * FROM x WHERE regexp(c,'h')", SQLITE_ASSOC , $err) ; //testing regexp as operator, not working, near "REGEXP": syntax error $res = $db->query("SELECT * FROM x WHERE c REGEXP 'h'", SQLITE_ASSOC , $err); ?> I'd also swapped the function parameters $x and $y, but also not works.. ----- From SQLite documentation: "The REGEXP operator is a special syntax for the regexp() user function. No regexp() user function is defined by default and so use of the REGEXP operator will normally result in an error message. If a application-defined SQL function named "regexp" is added at run-time, that function will be called in order to implement the REGEXP operator." ---- Server IP: 69.147.83.197 Probable Submitter: 202.169.237.239 ---- Manual Page -- http://www.php.net/manual/en/function.sqlite-create-function.php Edit -- https://master.php.net/note/edit/104978 Del: integrated -- https://master.php.net/note/delete/104978/integrated Del: useless -- https://master.php.net/note/delete/104978/useless Del: bad code -- https://master.php.net/note/delete/104978/bad+code Del: spam -- https://master.php.net/note/delete/104978/spam Del: non-english -- https://master.php.net/note/delete/104978/non-english Del: in docs -- https://master.php.net/note/delete/104978/in+docs Del: other reasons-- https://master.php.net/note/delete/104978 Reject -- https://master.php.net/note/reject/104978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#181713) next »