diff options
author | Silvio <silvio@devlet.com.br> | 2010-04-08 15:56:59 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-04-08 15:56:59 -0300 |
commit | 5288d2bd1572f6c1f59ba87bb111ba9344f2f9a9 (patch) | |
tree | 0e3234103755713a24491b77d3c4751d6b6c0544 | |
parent | b91f359f1c5bb89d7c22e8cf234f71105140cdf9 (diff) | |
download | cinisis-5288d2bd1572f6c1f59ba87bb111ba9344f2f9a9.tar.gz cinisis-5288d2bd1572f6c1f59ba87bb111ba9344f2f9a9.tar.bz2 |
Minor fixes
-rw-r--r-- | classes/MaleteDb.php | 6 | ||||
-rw-r--r-- | classes/PhpIsisDb.php | 2 | ||||
-rw-r--r-- | schemas/anu10.yaml | 3 | ||||
-rw-r--r-- | tests/read.php | 12 |
4 files changed, 17 insertions, 6 deletions
diff --git a/classes/MaleteDb.php b/classes/MaleteDb.php index 37586e2..7fa0afa 100644 --- a/classes/MaleteDb.php +++ b/classes/MaleteDb.php @@ -74,11 +74,13 @@ class MaleteDb implements IsisDb { * @see IsisDb::read() */ public function rows() { - $id = 0; + // The first entry in a malete database has id 1 and + // not 0, therefore $id's initial value should be 1. + $id = 1; while($this->db->read($id)) { $id++; } - return $id; + return $id - 1; } /** diff --git a/classes/PhpIsisDb.php b/classes/PhpIsisDb.php index c568743..9e885d9 100644 --- a/classes/PhpIsisDb.php +++ b/classes/PhpIsisDb.php @@ -49,7 +49,7 @@ class PhpIsisDb implements IsisDb { */ public function read($id) { $results = isis_search('$', $this->db); - if (!isis_data_seek($results, $id)) { + if (!isis_data_seek($results, $id-1)) { return FALSE; } diff --git a/schemas/anu10.yaml b/schemas/anu10.yaml index 9900f0e..7de8a03 100644 --- a/schemas/anu10.yaml +++ b/schemas/anu10.yaml @@ -9,10 +9,13 @@ fields: name: Data 3: name: Titulo + repeat: Yes 4: name: Autor + repeat: Yes 5: name: Assuntos primarios + repeat: Yes 6: name: Assuntos secundarios repeat: Yes diff --git a/tests/read.php b/tests/read.php index bc3221e..933d844 100644 --- a/tests/read.php +++ b/tests/read.php @@ -11,6 +11,8 @@ </head> <body> +<table><tr> + <?php // Import Malete Library. @@ -19,11 +21,11 @@ require_once '../index.php'; $configs = array( 0 => array( 'implementation' => 'PhpIsis', - 'database' => 'tupi', + 'database' => 'anu10', ), 1 => array( 'implementation' => 'Malete', - 'database' => 'tupi', + 'database' => 'anu10', ), ); @@ -37,13 +39,17 @@ foreach ($configs as $config) { $rows = $isis->db->rows(); // Format output. + echo '<td>'; echo '<pre>'; - echo "Connection test:\n"; + echo 'Implementation: '. $config['implementation'] ."\n"; echo "Rows: $rows\n"; print_r($result); echo '</pre>'; + echo '</td>'; } } ?> + +</tr></td></table> </body> |