render_complex_sql and DATE_FORMAT with MySQL

I’m having a problem using the render_complex_sql method in conjunction with DATE_FORMAT with MySQL. Running the query direct against the dates produces the correct output but when the same query is run through render_complex_sql() the output for start_date and end_date includes extra backslashes.

For example…

Here’s my query:
SELECT id, DATE_FORMAT(FROM_UNIXTIME(etimestamp), ‘%m/%d/%Y %H:%i’) AS start_date, DATE_FORMAT(FROM_UNIXTIME(endtimestamp), ‘%m/%d/%Y %H:%i’) AS end_date, title AS text FROM events WHERE calendar_id = 53815

Against MySQL output is:

‘80552200’, ‘12/12/2014 19:00’, ‘12/20/2014 19:00’, ‘test event’

Run through render_complex_sql (notice extra backslashes):
‘80552200’, ‘12/12/2014 19:00’, ‘12/20/2014 19:00’, ‘test event’

Any help would be great!

Run through render_complex_sql (notice extra backslashes):
'80552200', '12\/12\/2014 19:00', '12\/20\/2014 19:00', 'test event'

Is it an output from the json | xml data feed ?
In case of json output it may be a valid data because in json

'12\/12' == '12/12'

render_complex_sql do not apply any extra formatting on its own, it just execs the provided SQL code

Thanks for the reply. I was using JSON like this…

$conn = new JSONSchedulerConnector($res);

And when switching to XML like this, the events show up correctly.

$conn = new SchedulerConnector($res);

However, I’m still interested in using JSON instead of XML. Here’s the JSON response that appears in a JavaScript alert when switching back to JSONScheduleConnector().

{ "data": [ { "id": "80552201", "start_date": "12\/02\/2014 08:00", "end_date": "12\/02\/2014 09:00", "text": "test event" }, { "id": "80552200", "start_date": "12\/12\/2014 19:00", "end_date": "12\/20\/2014 19:00", "text": "another event" }, { "id": "80552197", "start_date": "12\/01\/2014 10:53", "end_date": "12\/31\/2014 19:00", "text": "and another event" } ] }

I’m not doing anything else besides running it through render_complex_sql. I did notice however, that removing the DATE_FORMAT functions from the SQL sends the dates back with dashes ( - ) instead of slashes. Is it possible the complex_sql method is somehow adding or incorrectly escaping slashes when DATE_FORMAT is used?


The same data actually works in my tests

Extra slashes is an escaping, that must not hurt json parsing.
Are you using the similar code to load the data ( scheduler.load(url, “json”) ) or some custom ajax solution ?