[wp-trac] [WordPress Trac] #10918: Microsoft SQL Server Support

WordPress Trac wp-trac at lists.automattic.com
Tue Oct 6 17:23:13 UTC 2009


#10918: Microsoft SQL Server Support
-----------------------------+----------------------------------------------
 Reporter:  pmjones          |       Owner:  ryan      
     Type:  feature request  |      Status:  new       
 Priority:  normal           |   Milestone:  Unassigned
Component:  Database         |     Version:            
 Severity:  normal           |    Keywords:            
-----------------------------+----------------------------------------------
 For a long time, many have asked for WordPress to support other database
 types.  Of course, this causes some issues, as it is difficult to
 implement database abstraction within WordPress using a conventional
 method like PDO (because PDO lacks PHP4 support). It would also mean
 restructuring queries to be more generic, which would compromise the MySQL
 optimizations WordPress has implemented. Finally, it would be a huge
 undertaking and would affect a lot of the core WordPress code.

 This patch solves the database abstraction request by using SQL dialect
 translations, and provides support for the MS-SQL dialect. Taking this
 approach means there are no changes to queries or function calls in the
 WordPress codebase. WordPress developers and plugin developers do not have
 to keep track of the database backend.  They can write their queries for
 MySQL, since that's the official WordPress database, and not have to think
 about it after that.

 Starting with the WordPress recommendation of creating a wpdb database
 class for the database type in question, we have created a structure for
 database abstraction within WordPress, with only minimal changes to the
 current code (more info in readme.txt).  The new wpdb class and its
 support classes provide support for MS-SQL by translating on-the-fly from
 MySQL to MS-SQL.  While it's likely not optimal for MS-SQL, it does not
 affect MySQL optimized queries at all.

 The translation system supports all SELECT, INSERT, UPDATE, DELETE,
 CREATE, ALTER, etc. queries, whether issued by WordPress or by a plugin.
 It also maps column types on-the-fly and caches them as needed.  Any other
 queries that require translations will have it readily available. This way
 the mapping array should not require constant maintenance with changes to
 the WP core schema. Likewise, any installed plugins that create tables
 will update the mapping array as well, which in turn will handle any
 translation issues for that plugin.

 One corollary benefit is that others might contribute the necessary wpdb
 db class, schema, and translations for other popular databases using this
 initial MS-SQL implementation as an example. Of course, that's up to the
 community.

 We hope the attached patches meet with approval.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10918>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list