On 23 Oct 2013, at 1:15pm, Tim Streater <[email protected]> wrote:
> HmmmOK. I'm therefore making a second attempt to use the sqlite3 PHP > interface in my application instead of PDO. There will be about 35 modules to > alter so I hope I can work through any issues. Sorry to put you to the work. Might be worth doing a little test first before making all the changes in all the modules ? > One wrinkle is that with the PDO interface, I can fetchAll and get an array > of the rows returned from a SELECT, which allows me to count how many there > were. This allows me to make an early exit if there are none. You can, buy all means, write your own fetchAll function which reads all the rows and returns them as an array. I have several apps which have such a function. By the way, even though as far as your code is concerned the fetchAll allows you an early exit, it does actually have to fetch all the rows, so it's still doing all the work involved in reading all the rows from the database. > Of course, with PDO, that has internally involved fetching all the rows, > which I could do myself but that seems clumsy. If I need columns x, y, z, I > had wondered about doing: > > select count(*),x,y,z from sometable where …; > > or is that a bad idea? You could have two library routines. One implements the SELECT you supply exactly as you supply it. The other implements the SELECT but instead of fetching the values asked for, it only selects "count(*)". In many cases this second routine should execute significantly faster than the one that reads actual values. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

