Welcome Guest, Not a member yet? Register   Sign In
MSSQL and Active Record love hate tragedy (1.5.4 => 1.6.2)
#11

[eluser]Morty[/eluser]
Thanks cristian_c, that's what we called commenting out the function. Did you try a DISTINCT statement recently? It does not work here, could you please check that you have the same issue?

TIA,
Morty
#12

[eluser]Morty[/eluser]
I found how to make DISTINCT work. You have to delete all DISTINCT words from your selects then issue a $this->db->distinct(); in order to make it work.

Hope that'll help.
#13

[eluser]jmrhoades[/eluser]
I too have the same problem and the above advice of commenting-out the body of _protect_identifiers does the trick.
#14

[eluser]gusa[/eluser]
the problem is bigger than i thought.
in SQL Server, expressions like:

select column1, column2, convert(text, column3), convert(text, column4) from ...

are allowed. when i try to execute, i get a sintax error. that's because CI is telling SQL Server to execute (sort of):

select column1, column2, convert(text, column3), column4) from ...

i think the bug is in DB_active_rec.php, which explodes the select clause into an array, using the character ',' as a separator.

i will try to fix it by tomorrow.
#15

[eluser]Unknown[/eluser]
In a similar situation with the odbc driver and Microsoft Sql Server I had to modify _from_tables in odbc_driver.php for 1.7.0 from:

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

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

to

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

if (count($tables) > 1)
{
return '('.implode(', ', $tables).')';
} else {
return $tables[0];
}

I noticed that mssql_driver had the same sql construct as odbc_driver. MSSQL doesn't like statements like:

select * from (tablename)

Also I noticed that escape_str in odbc_driver.php tries to call _remove_invisible_characters (right below a comment that says "odbc doesn't require escaping" so I had to take that out too.

I've been using CI on mysql well for the last few weeks at home but have to use MSSQL at work. Should I just avoid active record altogether for MSSQL?

- Dave
#16

[eluser]gusa[/eluser]
[quote author="hazlett_david" date="1228302572"]
I've been using CI on mysql well for the last few weeks at home but have to use MSSQL at work. Should I just avoid active record altogether for MSSQL?[/quote]

imho you should use active record with mssql wherever you can. i used ar+mssql in many projects. you'll find more benefits than issues.




Theme © iAndrew 2016 - Forum software by © MyBB