[Xerte] Has anyone tried Xerte toolkits with a MSSQL database?

Paul Swanson Paul.Swanson at harlandfs.com
Wed Aug 18 17:54:31 BST 2010

A string replace might work for the query string, but it seems like it
would be dodgy to replace the functions that way. Having custom
functions for selecting and connecting to the database, and for
executing queries might be the better route. You could set a constant or
global in the config file when using MSSQL, then use that in a custom
function to run the correct php function. Something like:


define ('MSSQL', true);  // in the config file ONLY if using MSSQL


Then, in a custom function file (or the config file):


function do_query ($query, $resource) { 

// Runs the query, must have query string as the first argument and 

// database resource link as the second argument


     if (MSSQL) {

           $result = mssql_query ($query, $resource);

     } else {

           $result = mysql_query ($query, $resource);


     return $result;



Then you would have to change all the queries to use do_query() in place
of the native PHP MySQL functions.


You'll need to do something on that same order to make the database
connection. And if you are using a transactional method, there will need
to be custom functions for commit and rollback. All of my experience is
with MySQL, though, so I don't know what pitfalls lie ahead. And I've
only used Desktop Xerte, I'm not familiar with using XOT. This would
require significant changes to XOT, so it's something that would be best
done at the development level. And your PHP must be built with the
correct extensions to enable the MSSQL functions. Xerte is open-source,
so you can give it a go, but it would not be a trivial undertaking. It
would be far easier to install MySQL, if that is an option for you.


From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Patrick
Sent: Wednesday, August 18, 2010 4:17 AM
To: Xerte discussion list
Subject: RE: [Xerte] Has anyone tried Xerte toolkits with a MSSQL


It won't work as the queries are all MYSQL php functions, a string
replace might work?


We thought about doing some abstraction work, but we don't need to here.


Perhaps some one more technical could advise on the feasibility of a
string replace?


From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Carter
Sent: 18 August 2010 12:13
To: 'xerte at lists.nottingham.ac.uk'
Subject: [Xerte] Has anyone tried Xerte toolkits with a MSSQL database?




Has anyone tried the Xerte toolkits with a MSSQL database?


Si :)


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it.
Please do not use, copy or disclose the information contained in this
message or in any attachment. Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham. 

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system: you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20100818/c0d13c3d/attachment.html

More information about the Xerte mailing list