Is there any chance to get SQL statement executed?

Is there any chance to get SQL statement executed?

alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0

Is this SQL statement query generated by editor is saved anywhere in classes? is there any way to display it for debuging purposes?

This question has an accepted answers - jump to answer

Answers

  • AshbjornAshbjorn Posts: 55Questions: 2Answers: 16

    Hi alpatunel,

    Your inquiry is very vague, but to clear some things up. Editor does not generate SQL statements by itself, the information that is changed needs to be processed on the server.

    Are you referring to the .NET Library that comes with the commercial version of Editor?

    It would really help if you could be more specific about what you are referring to, or it is perhaps me that lacks knowledge =)

    Hope this helps,

  • alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0

    Dear Ashbjorn

    I am a registered user and have a paid licence. I am using php library with datatables editor.
    I used the editor in my project and got some issues. for debugging purposes I need to see the sql query (statement) which is created by datatables editor's php libraries.

    Is there any way to display this value to the screen (temporarily of course) like:

    $editor->query->show() ??? etc
    more clear way:

    $edt->inst($_db, 'MasterTableName')
                    ->fields($flds)
                    ->where("DetailTableName.language", $_SESSION['lng']) //->which is 'turkish'
                    ->leftJoin("DetailTableName", "DetailTableName.MasterID", '=', "MasterTableName.ID")
                    ->process($_POST)
                    ->json();
    

    what is the sql query when I run this example.

    hope this is clear

    regards

  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin
    Answer ✓

    Hi,

    Yes indeed it is possible to see the query that the Editor libraries construct - although you'll need to dump it to a file (you could echo it, but that will result in JSON errors, which might be acceptable for you while debugging...).

    What to do is look in the Database/Drivers/Mysql/Query.php file (assuming you are using MySQL - the others have a similar file) and then look at the _prepare method. Near the bottom you will find a file_put_contents() function call that has been commented out. Comment it back in, or add whatever debugging you want to get the information from the $sql parameter and that will show the generated query.

    Its a bit messy at the moment I know - in future I'll add a debugging option that will give this information more easily.

    Regards,
    Allan

  • alpaltunelalpaltunel Posts: 14Questions: 3Answers: 0

    Your are great man :)
    I have no problem with echoing through page because I will see it and then disable it.
    thank you

This discussion has been closed.