Geeklog 1.4.1 Microsoft SQL Server Support
- Monday, September 18 2006 @ 05:33 pm EDT
- Contributed by: randy
- Views: 20,313
The objective of the Microsoft SQL (MSSQL) port is to provide another database alternative to MYSQL to take advantage of SQL server in business environments where Mysql may be a barrier to entry. The goal was to provide the ability for GL1.4.0 to work in either Mysql or MS SQL server with zero code changes required to be done by the end user. The version(s) of SQL supported are SQL 2000 and above, including the MSDE.
Using the abilities of MS SQL server, I have written helper User-Defined-Functions (UDFs), views, triggers and stored procedures to assist SQL server in coping with MYSQL function calls as well as help GL1.4's code base cope with data differences between MYSQL and SQL server.
The MSSQL class that I've written mimicks the MYSQL class' members that already exist in the /system/databases directory.
Installation of a SQL instance of Geeklog 1.4.1 follows the same steps as creating a fresh MySQL instance, however it has these slightly different dependencies:
Important Notes:
Plugins which require MSSQL support will require a MSSQL installer file and database detection routine developed to support SQL Server. I have personally converted some plugins to work on a MSSQL instance - just be aware that plugins specifically written for MySQL will not work "out of the box" on the SQL Server instance.
Also note that the MSSQL class does not overcome badly coded SQL routines which MySQL may be more forgiving with. Properly formatted SQL statements are a must and become very important - so watch out for things like including the right columns for a group by clause.
The MSSQL class does NOT approximate each and every MySQL function for SQL server. Only those critical functions which Geeklog 1.4.1 relies on is approximated by the MSSQL class and supporting database functions, triggers and stored procedures.
Enjoy the new database abilities of Geeklog!
An example plugin that was created to show an approach to isolate the database layer from the application logic can be found here in the downloads library.
Since Mysql has a few proprietary functions, it's impossible to have a MS SQL server equivalent function. A few examples are LIMIT, REPLACE INTO, UNIX_TIMESTAMP, TO_DAYS, DATE_FORMAT, DESCRIBE.... the list goes on and on. However the MSSQL class takes many of these into account and automatically translates some MYSQL specific function calls into SQL server equivalents.Using the abilities of MS SQL server, I have written helper User-Defined-Functions (UDFs), views, triggers and stored procedures to assist SQL server in coping with MYSQL function calls as well as help GL1.4's code base cope with data differences between MYSQL and SQL server.
The MSSQL class that I've written mimicks the MYSQL class' members that already exist in the /system/databases directory.
Installation of a SQL instance of Geeklog 1.4.1 follows the same steps as creating a fresh MySQL instance, however it has these slightly different dependencies:
- PHP installed and configured to use the Microsoft SQL server extensions.
- MS SQL server (MSDE) installed - any version 2000 or greater.
- A SQL database and database user created for Geeklog to use. This item is no different than the comperable MySQL step for installation, but needs to be carried out on the SQL server by a user who has enough access rights to create new databases.
Important Notes:
Plugins which require MSSQL support will require a MSSQL installer file and database detection routine developed to support SQL Server. I have personally converted some plugins to work on a MSSQL instance - just be aware that plugins specifically written for MySQL will not work "out of the box" on the SQL Server instance.
Also note that the MSSQL class does not overcome badly coded SQL routines which MySQL may be more forgiving with. Properly formatted SQL statements are a must and become very important - so watch out for things like including the right columns for a group by clause.
The MSSQL class does NOT approximate each and every MySQL function for SQL server. Only those critical functions which Geeklog 1.4.1 relies on is approximated by the MSSQL class and supporting database functions, triggers and stored procedures.
Enjoy the new database abilities of Geeklog!