Datatable Server Side with firebird

Datatable Server Side with firebird

alissonxalissonx Posts: 25Questions: 0Answers: 0
edited April 2014 in General
Hi,

its possible to use firebird with server side?

thank you

Replies

  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Sure. You can use server-side processing with any database you want. The Server-side processing protocol is described here: http://datatables.net/usage/server-side

    Allan
  • alissonxalissonx Posts: 25Questions: 0Answers: 0
    thank you Allan!
  • alissonxalissonx Posts: 25Questions: 0Answers: 0
    Hi,

    i'm trying to change this CODE from MYSQL to FIREBIRD, but is almost impossible.

    FIREBIRD don't have the functions "SQL_CALC_FOUND_ROWS" and "FOUND_ROWS"

    just have "COUNT"

    /*
    * SQL queries
    * Get data to display
    */
    echo $sQuery = "
    SELECT SQL_CALC_FOUND_ROWS `".str_replace(" , ", " ", implode("`, `", $aColumns))."`
    FROM $sTable
    $sWhere
    $sOrder
    $sLimit
    ";
    $rResult = ibase_query($gaSql['link'],$sQuery)
    or die(ibase_errmsg());


    /* Data set length after filtering */
    $sQuery = "
    SELECT FOUND_ROWS()
    ";
    $rResultFilterTotal = ibase_query($gaSql['link'],$sQuery)
    or die(ibase_errmsg());
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    Just do a COUNT(*) with the where statement. That's all that the calc found rows is doing.

    Allan
  • alissonxalissonx Posts: 25Questions: 0Answers: 0
    ok thank you... and FOUND_ROWS?
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    That's what you are replacing. SQL_CALC_FOUND_ROWS makes it possible to use FOUND_ROWS my MySQL.

    Have a look at the server-side processing documentation to understand the data that you are returning: http://datatables.net/usage/server-side . You could ignore the demo PHP version completely if you wanted!

    Another option is to look at the libraries that come with DataTables 1.10 which use general SQL and PDO for the database connection in PHP.

    Allan
  • alissonxalissonx Posts: 25Questions: 0Answers: 0
    Right, i'm replacing Mysql by Firebird (have a lot of modifications)

    Left one issue...

    i'm getting this error "DataTables warning (table id = 'ESTOQUE'): Added data (size 0) does not match known number of columns (7)"

    Whats is the parameter that counts columns on php script?

    I'm not seeing nothing here.

    http://datatables.net/usage/server-side

    Follows my javascript code, I think that is ok... and the problem is on the php with firebird connection script.

    [code]
    $(document).ready(function() {
    $('#ESTOQUE').dataTable( {
    "aoColumns": [ //This identifies column data types to aid sorting.
    {"sTitle": "CODIGO", "sName": "CODIGO", "aTargets": [ 0 ] },
    {"sTitle": "DESCRICAO", "sName": "DESCRICAO", "aTargets": [ 1 ] },
    {"sTitle": "CODMARCA", "sName": "CODMARCA", "aTargets": [ 2 ] } ,
    {"sTitle": "REFERENCIA", "sName": "REFERENCIA", "aTargets": [ 3 ] } ,
    {"sTitle": "PRECOVENDA", "sName": "PRECOVENDA", "aTargets": [ 4 ] } ,
    {"sTitle": "PRECOPRAZO", "sName": "PRECOPRAZO", "aTargets": [ 5 ] } ,
    {"sTitle": "QTDE", "sName": "QTDE", "aTargets": [ 6 ] }
    ] ,
    "bDeferRender": true,
    "bProcessing": true,
    "bPaginate": true,
    "bLengthChange": false,
    "bFilter": true,
    "bSort": true,
    "iDisplayLength": 30,
    "bInfo": true,
    "sPaginationType": "full_numbers",
    "bAutoWidth": true,
    "bServerSide": true,
    "sAjaxSource": "estoque.produtos.ajax.php"
    } );
    } );
    [/code]

    Thank you so much Allan!
  • alissonxalissonx Posts: 25Questions: 0Answers: 0
    Hi Allan,

    I've found the solution...

    MYSQL
    [code] $row[] = $aRow[ $aColumns[$i] ];[/code]

    FIREBIRD
    [code]$row[] = $aRow->$aColumns[$i];[/code]
This discussion has been closed.