Page 2 of 2

Re: Fresh Install with sqlite3

Posted: Wed Oct 13, 2010 4:10 pm
by garvinhicking
Hi!

Well, if you're asking for it - there's been a report that editing a static page (through the static page plugin) will not work using SQLite. I suppose it's due to some NULL column or other type mismatches, but haven'T yet been able to setup a sqlite environment to test it with.

The referring thread is in german so I figure it'll not help you further. Are you by chance using the static page plugin?

Regards,
Garvin

Re: Fresh Install with sqlite3

Posted: Wed Oct 13, 2010 11:17 pm
by nth
That's actually one of the things the first patch fixes (among other seemingly read only fields).

sqlite3.inc.php has a comment about "SQLite3 only fetches by assoc, we will emulate the other result types" (index and both index and column name). So pdo-sqlite did the same emulation (copy-paste from the sqlite3.inc.php). But upon further reading, turns out the PDO sqlite driver supports all 3 result types. Thus, when sometimes updating a row the correct data for a column given by column name would be immediately overwritten by the old data, that was still present in the column index form:

Code: Select all

    [0] => Array
        (
            [name] => template
            [0] => template
            [value] => new_value
            [1] => old_value
        )
So I removed the part that did the 'emulation', and now it works as advertised. I think. :mrgreen:

As for the plugin itself, at a first glance it seems it also needs a one liner, to take into account the new db type:

Code: Select all

*** serendipity_event_staticpage.php.orig       2010-10-13 23:33:07.000000000 +0300
--- serendipity_event_staticpage.php    2010-10-13 23:56:21.000000000 +0300
***************
*** 2441,2447 ****
              $group     = '';
              $distinct  = 'DISTINCT';
              $find_part = "(headline ILIKE '%$term%' OR content ILIKE '%$term%')";
!         } elseif ($serendipity['dbType'] == 'sqlite') {
              $group     = 'GROUP BY id';
              $distinct  = '';
              $term      = serendipity_mb('strtolower', $term);
--- 2441,2447 ----
              $group     = '';
              $distinct  = 'DISTINCT';
              $find_part = "(headline ILIKE '%$term%' OR content ILIKE '%$term%')";
!         } elseif ($serendipity['dbType'] == 'sqlite' || $serendipity['dbType'] == 'sqlite3' || $serendipity['dbType'] == 'pdo-sqlite') {
              $group     = 'GROUP BY id';
              $distinct  = '';
              $term      = serendipity_mb('strtolower', $term);