Ferreteria/v0.3/class/tDatabaseStorage: Difference between revisions
< Ferreteria | v0.3 | class
Jump to navigation
Jump to search
m (Woozle moved page Ferreteria/class/tDatabaseStorage to Ferreteria/v3/class/tDatabaseStorage without leaving a redirect: this is all v3 documentation, and we still need v2) |
m (4 revisions imported: moving this project here) |
(One intermediate revision by one other user not shown) | |
(No difference)
|
Latest revision as of 16:43, 22 May 2022
/*tttt
CEMENTS tSequentialAccess
USE WITH: tQueryableSource type
*/
trait tDatabaseStorage {
use tSequentialAccess;
// ++ DATA CONTROL ++ //
// CEMENTS: tSequentialAccess
public function RewindRows() {
$this->GetDatabase()->Result_Rewind($this);
}
// -- DATA CONTROL -- //
// ++ DATA STATUS ++ //
/*----
RETURNS: number of rows in the resultset
CEMENTS: tSequentialAccess
*/
public function GetRowCount() {
return $this->GetDatabase()->Result_RowCount($this);
}
// CEMENTS: tSequentialAccess
public function HasRows() {
return $this->GetRowCount() > 0;
}
// -- DATA STATUS -- //
// ++ DATA READ: BASIC ++ //
/*----
ACTION: Retrieves the current row data and advances to the next
RETURNS: row data as an array, or NULL if no more rows
CEMENTS: tSequentialAccess
*/
public function NextRow() {
$db = $this->GetDatabase();
$arVals = $db->Result_NextRow($this);
$ok = FALSE;
if (!is_null($arVals)) {
if (is_array($arVals)) {
//echo 'THIS:<pre>'.print_r($this,TRUE).'</pre>';
$op = $this->LoadRow_fromArray($arVals);
//$this->LoadValues_fromNative($arVals);
$ok = TRUE;
} else {
throw new exception(
'Ferreteria error: Anomalous result from reading a row. Row data: [BEGIN] '
.print_r($arVals,TRUE)
.'[END] SQL: '
.$db->sql
);
}
}
if (!$ok) {
$this->LoadRow_fromArray(array());
}
return $arVals;
}
// -- DATA READ: BASIC -- //
// ++ NOT IMPLEMENTED ++ //
// public function FetchRows($sql) : see tQueryableSource
// public function SelectRows(...) : see tQueryableSource
// public function GetRow_forKey($id) : see tMonokeyQueryableSource
}