nerostarter.blogg.se

Sqlite case
Sqlite case













In case both arguments are NULL, the NULLIF function returns a NULL value. If the first argument is not equal to the second one, the NULLIF function returns the first argument. A possible mitigation could be to avoid forwarding the WHERE clause to the underlying layer only when the OGRGenSQLResultsLayer has been build from a ExecuteSQL() method that has been called with a OGRSQL dialect. The SQLite NULLIF function accepts two arguments and returns a NULL value if they are equal. That would work, but that would perhaps decrease performance in a few cases that currently work.

sqlite case

We could modify OGRGenSQLResultsLayer to avoid forwarding the WHERE clause to the underlying layer and do the attribute filter itself. The where clause of the SQL is extracted by the OGR SQL parser and forwared back to the underlying layer, in this case the OGRSQLiteTableLayer, through its SetAttributeFilter() method, and this method forwards the where expression to the libsqlite. Compatible with the largest DB in the market: MySQL, MariaDB, PostgreSQL, SQLite, Interbase, SQL Azure, Amazon Aurora, Firebird, Access, Oracle, MS SQLServer. The core of the issue is that when you use OGRSQL dialect, ExecuteSQL fallbacks to generic ExecuteSQL that instanciates a OGRGenSQLResultsLayer. If I understand well, you're hitting the test 5 : the easy workaround for now would be to use test 4.

sqlite case

Hum, I have investigated this a bit and I'm attaching a python script that tests different variations and exhibits cases that work and cases that don't work.















Sqlite case