CodeIgniter Forums
v318 db parser bug (maybe, perhaps) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: v318 db parser bug (maybe, perhaps) (/showthread.php?tid=70516)



v318 db parser bug (maybe, perhaps) - badger - 04-20-2018

up to and including v312, i was able to use queries like the following
PHP Code:
SELECT ..... FROM .... WHERE (a.transdate >= "?") AND (p.prva_id>0) AND (p.prod_id=?) 

Today i made the quantum leap to v318 and such queries crash on the part "(p.prod_id=?)".
Now it will only work if i use (p.prod_id="?") ie enclose the question mark in quotes
Switch back to v312 and it's ok
I don't know if this is a bug or if I've just been lucky in always getting away with sloppy coding.
The quotes are needed for e.g. a date or text but I've never had to use them for integers
Bill


RE: v318 db parser bug (maybe, perhaps) - InsiteFX - 04-20-2018

Your not showing the array that's used for it.

Show all of the method code so that we can help you.


RE: v318 db parser bug (maybe, perhaps) - badger - 04-20-2018

well the full query is shown below. the point i was making is that the site has worked perfectly (very many thanks to the ci developers) in all versions of ci upto and including 3.12 which is what i am using now. when i changed to v318 this morning, it crashed and pointed the error at the final question mark in the query. it only works in v318 if i enclose the question mark in quotes. this was the first database call and my code is littered with queries where question marks related to integers are not in quotes so there was no point in going further with the testing. i'd rather stick with v312 than go back and change a mountain of queries. its no big deal, the site works great so if it aint broke dont fix it
$this->db->query('SELECT a.trans_id AS "id" FROM transitems a LEFT JOIN prodpacks.p ON p.c2g=a.prva_id
WHERE (a.transdate >= "?") AND (a.data_type=1) AND (prva_id>0) AND (p.prod_c2g=?) LIMIT 20',array($date,$prodid))
$date is a string, $prodid is an integer.
bill


RE: v318 db parser bug (maybe, perhaps) - InsiteFX - 04-21-2018

May not be broke but updates are also use to fix Security leaks etc;