LC, SQLite and REGEXP

Mike Bonner bonnmike at gmail.com
Sat Feb 7 05:38:04 CET 2015


You have to create a user function for it to work. REGEXP is there in
sqlite, but all it does is refer to a function you create.
>From this page:
http://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query

is this.  If you can figure out how to execute this with revexecutesql
after opening the db, you can then most likely use REGEXP.  The error
pretty much confirms this is the case.

$pdo->sqliteCreateFunction('regexp',
    function ($pattern, $data, $delimiter = '~', $modifiers = 'isuS')
    {
        if (isset($pattern, $data) === true)
        {
            return (preg_match(sprintf('%1$s%2$s%1$s%3$s', $delimiter,
$pattern, $modifiers), $data) > 0);
        }

        return null;
    });


On Fri, Feb 6, 2015 at 9:22 PM, Kay C Lan <lan.kc.macmail at gmail.com> wrote:

> OK, SQLite DB in Valentina Studio I test the following:
>
> SELECT something FROM aTable WHERE anotherThing REGEX '[acdehkiouBW]{4,6}
> Test'
>
> works fine, I get the data I'm looking for. Same SQLite DB accessed via LC,
> selecting and updating all sorts of tables and columns, no problem until I
> run the above statement. The result is:
>
> revdberr,Database Error: no such function: REGEXP
>
> Any clues?
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list