Codeigniter and odbc connections

I do not understand why CodeIgniter wraps the name of my table in brackets. When I use the ODI CodeIgniter driver for MS SQL, it shows the errors below, however it works fine using the MySql driver. How can I stop this error?

A Database Error Occurred

Error Number: 37000

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'.

SELECT * FROM (ci_sessions) WHERE session_id = '3ad914bb5f5728e8ac69ad1db8fc9841' AND user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2'

Filename: D:\wamp\www\IVR_Panel\system\database\DB_driver.php

Line Number: 330

I also tried to execute the same query in SQL Server 2005, which works without parentheses, but still errors with them. I use active recording, so I can easily switch between ODBC and MySQL. Where can I change CodeIgniter to remove parentheses?

0
source share
1 answer

CodeIgniter. ODBC (/system/database/drivers/odbc/odbc_driver.php) :

function _from_tables($tables)
{
    if ( ! is_array($tables))
    {
        $tables = array($tables);
    }

    return '('.implode(', ', $tables).')';
}

, , , , , , .

, , , , . , CodeIgniter , - :

function _from_tables($tables)
{
    if ( ! is_array($tables))
    {
        return strstr($tables, ',') ? '('.$tables.')' : $tables;
    }
    else
    {
        return count($tables) > 1 ? '('.implode(', ', $tables).')' : end($tables);
    }
}
+4

All Articles