can this work with MSSQL can this work with MSSQL
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

can this work with MSSQL

Started by RevoD, August 17, 2004, 04:31:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RevoD

my clients server runs MSSQL, can I still use this script with this type of database management on a windows server?

Joachim Müller

without modification of coppermine core code: no. There have been plans on database abstraction, but so far they only exist in some developer's minds. Coppermine works currently only with mySQL.

GauGau

radianation

What exactly needs to be changed in order for it to work with MSSQL? An idea of the scope would be enough. Thanks.

Joachim Müller

no idea, I have never worked with mssql. Inside the main function declaration of coppermine there's the connection function (there is a slight degree of db abstarction in coppermine). You might want to take a look at include/functions.inc.php, find/**************************************************************************
   Database functions
**************************************************************************/

// Connect to the database
function cpg_db_connect()
{
        global $CONFIG;
        $result = @mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass']);
        if (!$result)
                return false;
        if (!mysql_select_db($CONFIG['dbname']))
                return false;
        return $result;
}

// Perform a database query
function db_query($query, $link_id = 0)
{
        global $CONFIG, $query_stats, $queries;

        $query_start = cpgGetMicroTime();
        if (($link_id)) {
            $result = mysql_query($query, $link_id);
        } else {
                $result = mysql_query($query);
        }
        $query_end = cpgGetMicroTime();
        if (isset($CONFIG['debug_mode']) && (($CONFIG['debug_mode']==1) || ($CONFIG['debug_mode']==2) )) {
                $query_stats[] = $query_end - $query_start;
                $queries[] = $query;
        }
        if (!$result) db_error("While executing query \"$query\" on $link_id");

        return $result;
}

// Error message if a query failed
function db_error($the_error)
{
        global $CONFIG;

        if (!$CONFIG['debug_mode']) {
            cpg_die(CRITICAL_ERROR, 'There was an error while processing a database query', __FILE__, __LINE__);
        } else {

                $the_error .= "\n\nmySQL error: ".mysql_error()."\n";

                $out = "<br />There was an error while processing a database query.<br /><br/>
                    <form name='mysql'><textarea rows=\"8\" cols=\"60\">".htmlspecialchars($the_error)."</textarea></form>";

            cpg_die(CRITICAL_ERROR, $out, __FILE__, __LINE__);
        }
}

// Fetch all rows in an array
function db_fetch_rowset($result)
{
        $rowset = array();

        while ($row = mysql_fetch_array($result)) $rowset[] = $row;

        return $rowset;
}
Maybe it already works if you change those lines to work with mssql, but if it doesn't I'm afraid you will have to look into nearly every file, as they do the actual queries.

GauGau

Goatie

Just wondered if any advance had been made in cpg1.4 in regard to database type abstraction or indeed whether or not MSSQL is now supported?

Nibbler

Please don't ask about 1.4 on the 1.3 support board. There is no support for mssql in 1.4

Goatie

My Apologies. Just didn't see the point in starting a new thread based on an existing topic.