Guys I think there's a problem with that driver. First I wanted that someone clarify the necessity to put double quotation marks in almost all words on the query. This is a problem when you try to use an INNER JOIN as the code below:
PHP Code:
$this->db->select("data,tab,tma");
$this->db->from("abHistorico as ab");
$this->db->join("tmap","ab.id_fila = tmap.id_fila AND ab.data BETWEEN data_inicial AND data_final","LEFT");
$this->db->where("data BETWEEN '$date_start' AND '$date_end'");
The SQLSERVER 2012 notifies the error below:
Incorrect sintax near 'BETWEEN'.
SELECT "data", "tab", "tma" FROM "abHistorico" as "ab" LEFT JOIN "tmap" ON "id_fila" = "id_fila" AND "ab"."data" "BETWEEN" "data_inicial" AND data_final WHERE data BETWEEN '20140901' AND '20140930'
As you can see there are double quotes on the fields as well in BETWEEN inside the inner join clause. If I remove these quotation the query will work. I know this is due to escaping thing, but I want to use the active record class without to have to include a false parameter on theses methods every time, because is annoying. I need help on this problem. And more I want to keep escaping single quotes from the queries.
I am using PHP 5.5, SQLSERVER 2012. If I use ODBC and configure to user the SQL Server Native Client 11.0 the problem is gone, but I have to configure the driver for each database version (Use Sql Server driver sucks).
Regards,
Caju