I am having a problem with a parameter query that is using a wild card in Sqlite.
The SQL.ExecQuery2 is returning the wrong rows.
It looks something like this (quick example-may have typos):
Sql.ExecQuery2("select * from countries where country like ? and population <= ?", array as String("canada/%", 1))
If I use ExecQuery and hard code the "canada/%" into the sql statement, it returns the correct rows.
If I replace the ExecQuery2 parameter with "canada/ottawa" without the "%" it works fine .
Only when using the wildcard character "%" do I have problems. If the 2nd parameter =1, then it returns rows for population=1 and population=3 which is clearly wrong.
If I drop the 2nd parameter "population <= ?" then it works fine.
The wildcard "%" in the 1st parameter is somehow screwing up the filtering of the 2nd parameter in the where clause to limit the rows returned. (I'm getting population=3 for the returned rows when the 2nd parameter is equal to 1).
Has anyone else noticed this. Is there a fix for it?
If no one else has noticed this, then I will create a test program and submit it.
TIA
Using B4A 9.80
The SQL.ExecQuery2 is returning the wrong rows.
It looks something like this (quick example-may have typos):
Sql.ExecQuery2("select * from countries where country like ? and population <= ?", array as String("canada/%", 1))
If I use ExecQuery and hard code the "canada/%" into the sql statement, it returns the correct rows.
If I replace the ExecQuery2 parameter with "canada/ottawa" without the "%" it works fine .
Only when using the wildcard character "%" do I have problems. If the 2nd parameter =1, then it returns rows for population=1 and population=3 which is clearly wrong.
If I drop the 2nd parameter "population <= ?" then it works fine.
The wildcard "%" in the 1st parameter is somehow screwing up the filtering of the 2nd parameter in the where clause to limit the rows returned. (I'm getting population=3 for the returned rows when the 2nd parameter is equal to 1).
Has anyone else noticed this. Is there a fix for it?
If no one else has noticed this, then I will create a test program and submit it.
TIA
Using B4A 9.80