Hi,
I'm migrating my web app from CI 2.x to CI 3.0. My app uses the 'sqlsrv' driver.
When I try to open my web app I get database errors, for example:
Code:
Error Number: 42000/102
[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near ')'.
SELECT "Data" "Data" FROM (SELECT cf.idCalendari idCalendari, "f"."Data"" FROM GT_CalendarisFestius cf LEFT JOIN GT_Festius f ON cf"."idCalendari = f"."idCalendari)" "festius" WHERE "festius"."idCalendari" IN(5, 6)
I don't know why CI 3 are putting doble quotes inside the SQL, and are doing it badly (as you can see the SQL is bad constructed).
The model is this:
Code:
$this->db->select('Data Data');
$this->db->from('(SELECT cf.idCalendari idCalendari, f."Data" FROM GT_CalendarisFestius cf LEFT JOIN GT_Festius f ON cf.idCalendari = f.idCalendari) festius');
$this->db->where_in('festius.idCalendari', array(5,6));
The same happens with a SELECT like this:
Code:
$this->db->select("CONVERT(VARCHAR(10),a.Dia,105) as Day")
It get transformed to this:
Code:
SELECT CONVERT(VARCHAR(10), "a"."Dia", "105 )" as "Day"
How can I solve it? Is it possible to disable this double quote annoying bug?
Thx