AJAX Source - Oracle Server Side Processing

AJAX Source - Oracle Server Side Processing

TriscuitCheeseTriscuitCheese Posts: 3Questions: 0Answers: 0
edited December 2012 in DataTables 1.9
I'm working on implementing the new Oracle based server side processing from "http://www.datatables.net/development/server-side/php_oracle'. I ran into a few issues and have worked through most of them but am now stuck at one point. I created the "ajax" example table and added the data as provided. I've change the connection information to my database and it does connect correctly. I think I am missing something in a configuration but I don't know for sure.

When I run the server_processing.php example this is the only return I can get:
{"sEcho":0,"iTotalRecords":"57","iTotalDisplayRecords":0,"aaData":[]}

When I run the example page displaying the information there are no records shown but it does show the total at the bottom and act like it will page through properly.

I can't figure out why the other information is not populating as it should be. I've tried echoing out the queries used and a variable called "rowsNumerator" is listed but has no value anywhere that I can find and causes the query to fail when I try to run it manually. Is there a reference for this "rowsNumerator" that needs to be listed somewhere?

I fought with myself for close to 5 hours yesterday before I saw the connection lines having a line break between them in the example. Anyone with thoughts or happen to know just what I'm missing?

Thanks in advance.

Replies

  • dthunsterblichdthunsterblich Posts: 20Questions: 0Answers: 0
    edited January 2013
    Hey!

    Could you provide your initialization code?

    I also run into some trouble with the PHP Oracle Script. Apperently it is not used by a wide range of people. I found this post: http://www.datatables.net/forums/discussion/comment/24418#Comment_24418
    It contains a problem I'm also having with that script. I established a very poor workaround:

    [code]
    error_reporting(0);
    [/code]

    I just turned off the error reporting in order to prevent datatables from running into a "JSON formatting error".

    Maybe this will populate your form as well.

    P.S. If someone has a solution for this... I would be pleased to hear.
  • TriscuitCheeseTriscuitCheese Posts: 3Questions: 0Answers: 0
    edited March 2013
    Below are the two files I am trying to use to get a working example.

    [code]
    <?php
    $aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );
    /* Indexed column (used for fast and accurate table cardinality) */
    $sIndexColumn = "id";
    /* DB table to use */
    $sTable = "ajax";

    $conn = getDBConnection();
    //$conn = oci_connect($gaSql['user'], $gaSql['password'], $connection_string);
    if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
    }
    $sLimit = "";
    if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
    {
    $sLimit = "WHERE rowsNumerator BETWEEN :iDisplayStart AND :iDisplayEnd";
    }
    if ( isset( $_GET['iSortCol_0'] ) )
    {
    $sOrder = "ORDER BY ";

    for ( $i=0 ; $i $iTotal,
    "iTotalDisplayRecords" => $iFilteredTotal,
    "aaData" => array()
    );

    oci_execute($statmntFinal);

    while ( $aRow = oci_fetch_array($statmntFinal, OCI_ASSOC) )
    {
    $row = array();
    for ( $i=0 ; $i
    [/code]

    The result I get when running this file is:
    {"sEcho":0,"iTotalRecords":"57","iTotalDisplayRecords":0,"aaData":[]}

    If I go here I see the full 57 records with details.
    http://www.datatables.net/release-datatables/examples/server_side/scripts/server_processing.php

    [code]
    <?php require('required/main.php'); ?>
    <?php
    echo '';
    echo '';
    ?>
    <?php generateH("Sample Header"); ?>
    tr.highlight{ background-color:#B8B8B8; cursor:pointer; }





    var asInitVals = new Array();
    $(document).ready(function() {
    var oTable = $('#msgs').dataTable( {
    "sDom": 'Tr<"clear">lftip', "sPaginationType": "full_numbers",
    "iDisplayLength": 10, "aLengthMenu": [[10, 40, 100, -1], [10, 40, 100, "All"]],
    "oTableTools": {"aButtons": [ "copy", "csv", "print" ],"sSwfPath": "./swf/copy_csv_xls_pdf.swf"},
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "./ssajaxtest.php"
    });
    } );





    engine
    browser
    platform
    version
    grade




    Loading data from server...




    engine
    browser
    platform
    version
    grade



    <?php generateF(); ?>
    [/code]

    This shows the same 57 records but does not display the records in the table.
  • TriscuitCheeseTriscuitCheese Posts: 3Questions: 0Answers: 0
    Update:

    If I "echo $sQueryFinal;" this query out I get the following which fails and produces an error.

    SELECT ENGINE, BROWSER, PLATFORM, VERSION, GRADE
    FROM (SELECT ENGINE,
    BROWSER,
    PLATFORM,
    VERSION,
    GRADE,
    ROW_NUMBER() OVER() ROWSNUMERATOR
    FROM AJAX
    WHERE 1 = 1) QRY
    ORDER BY ROWSNUMERATOR

    But... if I add the ordering in manually it produces the results desired.
    Changed:
    ROW_NUMBER() OVER() ROWSNUMERATOR
    ROW_NUMBER() OVER(order by 1) ROWSNUMERATOR

    SELECT ENGINE, BROWSER, PLATFORM, VERSION, GRADE
    FROM (SELECT ENGINE,
    BROWSER,
    PLATFORM,
    VERSION,
    GRADE,
    ROW_NUMBER() OVER(order by 1) ROWSNUMERATOR
    FROM AJAX
    WHERE 1 = 1) QRY
    ORDER BY ROWSNUMERATOR

    So now I'm looking to see what is causing the ordering to not be picked up and set. If I can find out what's causing that I'll let everyone know. Thanks.
This discussion has been closed.