DataTables and Editor issue

DataTables and Editor issue

nidmaknidmak Posts: 3Questions: 1Answers: 0

Hello,
I downloaded DT1.10 and Editor 1.3.1. I'm running Postgres 9.0.17, PHP Version 5.3.28.
Installed both, and changed php config for database connection.
Run the editor example and I receive error:

DataTables warning Table id=example - SQLSTATE[42601]
Syntax Error 7: syntax error at or near "'id'"
LINE 1: SELECT id as 'id', first_name as 'first_name'....

I checked postgres error log, there's similar error.
2014-06-20 17:14:48 MYT ERROR: syntax error at or near "'id'" at character 15
2014-06-20 17:14:48 MYT STATEMENT: SELECT id as 'id', first_name as 'first_name', last_name as 'last_name', updated_date as 'updated_date', registered_date as 'registered_date' FROM users

I ran the above select statement in PGADMIN 3 also giving error.

When I remove the single quote, it's working.

Any idea on how shall I proceed in running the DT and Editor?
Thanks.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin
    Answer ✓

    Hi,

    I'm afraid there is a bug in the current version of Editor when using Postgres! I'm going to release 1.3.2 with the fix next week, but until then the fix is actually fairly simple. In the file php/Database/Driver/Postgres/Query.php add the following line into the class that is defined in the file:

     protected $_field_quote = '"';
    

    And that should do it!

    Regards,
    Allan

  • nidmaknidmak Posts: 3Questions: 1Answers: 0
    edited June 2014

    Thanks, Allan.
    Let me try now....

    UPDATE:
    It's working.....

  • nidmaknidmak Posts: 3Questions: 1Answers: 0

    I do not want to create another thread because it's similar environment.

    During the SQL installation, there's error during the creation of TODO Table:

    2014-06-20 16:39:54 MYT ERROR: column "done" is of type boolean but expression is of type integer at character 550
    2014-06-20 16:39:54 MYT HINT: You will need to rewrite or cast the expression.

    INSERT INTO todo (item, done, priority)
        VALUES
            ( 'Send business plan to clients', 1, 1 ),
            ( 'Web-site copy revisions',       0, 2 ),
            ( 'Review client tracking',        0, 2 ),
            ( 'E-mail catchup',                0, 3 ),
            ( 'Complete worksheet',            0, 4 ),
            ( 'Prep sales presentation',       0, 5 );
    

    Boolean value does not accept 0 or 1. I change the script to T & F.

    INSERT INTO todo (item, done, priority)
        VALUES
            ( 'Send business plan to clients', T, 1 ),
            ( 'Web-site copy revisions',       F, 2 ),
            ( 'Review client tracking',        F, 2 ),
            ( 'E-mail catchup',                F, 3 ),
            ( 'Complete worksheet',            F, 4 ),
            ( 'Prep sales presentation',       F, 5 );
    

    This might create future issue in my current installation.

  • allanallan Posts: 61,734Questions: 1Answers: 10,110 Site admin
    Answer ✓

    Sorry yes, that's another one that will be in the 1.3.2 release... I've used "t" in the fix, but any boolean will do (I really thought Postgres did accept 0 and 1 as false and true before - an old version possibly... Or more likely my bad memory ;-) ).

    Allan

This discussion has been closed.