Microsoft SQL Server Support
|Reported by:||pmjones||Owned by:||westi|
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.
Change History (28)
- Keywords dev-feedback 2nd-opinion added
- Milestone changed from Unassigned to Future Release
- Version set to 2.9
- Cc westia removed
- Owner changed from ryan to westi
- Status changed from new to reviewing
- Milestone Future Release deleted
- Resolution set to wontfix
- Status changed from reviewing to closed
comment:11 follow-up: ↓ 12 @azaozz — 5 years ago
- Milestone set to Future Release
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:22 follow-up: ↓ 23 @new28006 — 3 years ago
- Severity changed from normal to major
- Version changed from 2.9 to 3.3
comment:24 @dd32 — 3 years ago
- Severity changed from major to normal
- Version changed from 3.3 to 2.9