Pregunta

I define 2 functions:

sqlite3_create_function( m_db.db(), "regexp", 2, SQLITE_UTF8, NULL, mysqlite_regexp, NULL, NULL );
sqlite3_create_function( m_db.db(), "regexp2", 2, SQLITE_UTF8, NULL, mysqlite_regexp2, NULL, NULL ) ;

And if i made a query like SELECT Images.ImageID FROM Images WHERE Images.Filename REGEXP \"truc\", only with REGEXP it works.

With REGEXP2 I have an error, "near REGEXP2: syntax error"

Why?

¿Fue útil?

Solución

The REGEXP operator is defined to redirect to the regexp user function.

Except GLOB, no other operators are defined in this way. If you want to call other functions, you have to call them as functions:

SELECT ImageID FROM Images WHERE regexp('truc', Filename);
SELECT ImageID FROM Images WHERE regexp2('truc', Filename);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top