Thanks Simon, the create process is a one off. As for the table name I did use this approach as to not accumulate too much data in one table and instead split the data in multiple tables. From a design POV in sqlite is this a mistake. And will the pragma for php eliminate locks ? On Oct 25, 2014 7:23 PM, "Simon Slavin" <slav...@bigfraud.org> wrote:
> On 25 Oct 2014, at 3:31pm, Ali Jawad <alijaw...@gmail.com> wrote: > > > bash script > > > > sqlite3 websites.db "PRAGMA busy_timeout=1500;CREATE TABLE [$SITE] (DATE > > INT ,EU INT , US INT);" > > Creating and destroying tables always involves a long lock. > > > php script > > > > $ret = $db->query("PRAGMA busy_timeout=1500;SELECT eu,us,date FROM > [$site] > > ORDER BY date(DATE) DESC LIMIT 10"); > > This doesn't work. The query will process only the query command. You > want something more like > > // do this just once, soon after creating the $db connection > $ret = $db-exec("PRAGMA busy_timeout=1500"); > > // do this when you need the result > $ret = $db->query("SELECT eu,us,date FROM [$site] ORDER BY date(DATE) DESC > LIMIT 10"); > > By the way ... I notice you are creating a table with a variable name. > This is usually a bad sign. It might make more sense to put your data into > one table, and add a column which contains the $site . Then you don't need > to create a new table when you have data for a new site. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users