aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-03-30 12:12:22 -0300
committerSilvio <silvio@devlet.com.br>2010-03-30 12:12:22 -0300
commit93d4fafcf253b7646172fff5e4798a80773aff3f (patch)
treeafd7a5c970c60b62339733bf15eb39d4ddc233ba
parent1d960150de785261da282e1505360e97ee144493 (diff)
downloadcinisis-93d4fafcf253b7646172fff5e4798a80773aff3f.tar.gz
cinisis-93d4fafcf253b7646172fff5e4798a80773aff3f.tar.bz2
Implementing MaleteDb::rows()
-rw-r--r--classes/MaleteDb.php14
-rw-r--r--index.php3
2 files changed, 14 insertions, 3 deletions
diff --git a/classes/MaleteDb.php b/classes/MaleteDb.php
index 9e8684f..fd10c78 100644
--- a/classes/MaleteDb.php
+++ b/classes/MaleteDb.php
@@ -28,11 +28,21 @@ class MaleteDb implements IsisDb {
if (!is_numeric($id)) {
return FALSE;
}
- $results = $this->db->read($id);
- return $this->tag($results);
+ if ($results !== FALSE) {
+ $results = $this->db->read($id);
+ return $this->tag($results);
+ }
+ else {
+ return FALSE;
+ }
}
public function rows() {
+ $id = 1;
+ while($this->db->read($id)) {
+ $id++;
+ }
+ return $id - 1;
}
public function default_schema() {
diff --git a/index.php b/index.php
index 62a58dd..f2ff677 100644
--- a/index.php
+++ b/index.php
@@ -22,7 +22,8 @@ $schema = Spyc::YAMLLoad('schemas/anu10.yaml');
//$db = new MaleteDb($schema);
$db = new PhpIsisDb($schema);
if ($db) {
- $result = $db->read(4);
+ $result = $db->read(1);
+ //$result = $db->rows();
echo '<pre>';
print_r($result);
echo '</pre>';