Welcome Guest, Not a member yet? Register   Sign In
Field Name Problem In CI3
#6
Sad 

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
Reply


Messages In This Thread
Field Name Problem In CI3 - by mertdogan - 11-24-2014, 02:39 PM
RE: Field Name Problem In CI3 - by Rufnex - 11-24-2014, 03:24 PM
RE: Field Name Problem In CI3 - by slax0r - 11-25-2014, 01:23 AM
RE: Field Name Problem In CI3 - by Narf - 11-25-2014, 01:35 AM
RE: Field Name Problem In CI3 - by mertdogan - 11-26-2014, 10:16 AM
RE: Field Name Problem In CI3 - by caju - 11-30-2014, 07:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB