|
DataTableResult
Represents a set of results returned from a DataTable query.
Autogenerated note: this page is automatically generated from embedded documentation in the PHP source. OverviewConstructorsMethods
Constructor DetailDataTableResultpublic DataTableResult(mixed data, mixed uri) Method Detailnum_fieldspublic void num_fields() Returns the number of fields in the result set. num_rowspublic void num_rows() Returns the number of rows in the result set. resultpublic void result() Returns the query result as an array of objects, or an empty array on any failure. Each field in the original query is mapped to an object variable. For example: $dt = new DataTable('http://api.talis.com/stores/mystore');
$dt->map('http://xmlns.com/foaf/0.1/name', 'name');
$dt->map('http://xmlns.com/foaf/0.1/nick', 'nick');
$dt->select('name,nick')->limit(10);
$res = $dt->get();
foreach ($res->result() as $row) {
echo $row->name;
echo $row->nick;
}
result_arraypublic void result_array() Returns the query result as an array of associative arrays, or an empty array on any failure. The keys and values of the associative array correspond with the fields and values in the results. For example: $dt->select('name,nick')->limit(10);
$res = $dt->get();
rowpublic void row(mixed index) row_arraypublic void row_array(mixed index) Returns an associative array containing a single result row. The $index parameter is optional and defaults to zero. rowdatapublic void rowdata(mixed index) Returns an associative array containing metadata about the values in the specified row. The array keys correspond to field names and the values to another associative array containing the metadata for that field's value. The $index parameter is optional and defaults to zero. The following metadata keys are available:
$dt->select('name,nick')->limit(10);
$res = $dt->get();
$rowdata = $res->rowdata(5);
echo $rowdata['name']['type'];
echo $rowdata['name']['lang'];
echo $rowdata['name']['datatype'];
to_stringpublic void to_string() Returns a tabular string representation of the results. Generated by PHPDoctor 2RC2 | |