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
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());
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.
Replies
Allan
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());
Allan
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
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!
I've found the solution...
MYSQL
[code] $row[] = $aRow[ $aColumns[$i] ];[/code]
FIREBIRD
[code]$row[] = $aRow->$aColumns[$i];[/code]