[wp-trac] Re: [WordPress Trac] #2317: SQLite support for wp2.0

WordPress Trac wp-trac at lists.automattic.com
Fri Oct 20 01:30:35 GMT 2006


#2317: SQLite support for wp2.0
-------------------------+--------------------------------------------------
 Reporter:  tume         |        Owner:  anonymous
     Type:  enhancement  |       Status:  new      
 Priority:  normal       |    Milestone:  2.2      
Component:  General      |      Version:  2.0      
 Severity:  normal       |   Resolution:           
 Keywords:  sqlite       |  
-------------------------+--------------------------------------------------
Comment (by cdavies):

 I'm a big fan of this feature request, the attached patch still applies
 cleanly to 2.0.4, and I'm using it now. The broken categories bug was easy
 to fix, it was because the code inserts a value in to the cat_ID field.
 That field is marked as the primary key, and as an auto incrementing
 field.

 I don't really know enough about mysql to tell if the original code is a
 defect or not, but here's a diff snippet that makes it work for sqlite.


 {{{
 --- wp-admin/admin-db.php       2006-10-20 01:59:48.400611520 +0100
 +++ /home/cdavies/wordpress-sqlite/wp-admin/admin-db.php        2006-10-20
 00:07:32.231664856 +0100
 @@ -109,7 +109,7 @@
                 $category_parent = 0;

         if (!$update) {
 -               $wpdb->query("INSERT INTO $wpdb->categories (cat_name,
 category_nicename, category_description, category_parent) VALUES
 ('$cat_name', '$category_nicename', '$category_description',
 '$category_parent')");
 +               $wpdb->query("INSERT INTO $wpdb->categories (cat_ID,
 cat_name, category_nicename, category_description, category_parent) VALUES
 ('1', '$cat_name', '$category_nicename', '$category_description',
 '$category_parent')");
                 $cat_ID = $wpdb->insert_id;
         } else {
                 $wpdb->query ("UPDATE $wpdb->categories SET cat_name =
 '$cat_name', category_nicename = '$category_nicename',
 category_description = '$category_description', category_parent =
 '$category_parent' WHERE cat_ID = '$cat_ID'");
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2317#comment:7>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list