Commit 155f5193 authored by zYne's avatar zYne

New fetchmode constants (implementation later)

parent f11fe0ca
...@@ -227,12 +227,66 @@ final class Doctrine { ...@@ -227,12 +227,66 @@ final class Doctrine {
const FETCH_VHOLDER = 1; const FETCH_VHOLDER = 1;
/** /**
* FETCH RECORD * FETCH RECORD
*
* Specifies that the fetch method shall return Doctrine_Record
* objects as the elements of the result set.
*
* This is the default fetchmode.
*/ */
const FETCH_RECORD = 2; const FETCH_RECORD = 2;
/** /**
* FETCH ARRAY * FETCH ARRAY
*/ */
const FETCH_ARRAY = 3; const FETCH_ARRAY = 3;
/**
* FETCH COLUMN
* Specifies that the fetch method shall return only a single
* requested column from the next row in the result set.
*
*/
const FETCH_COLUMN = 4;
/**
* FETCH ASSOC
*
* Specifies that the fetch method shall return each row as an
* array indexed by column name as returned in the corresponding
* result set. If the result set contains multiple columns with
* the same name, PDO::FETCH_ASSOC returns only a single value per column name.
*
*/
const FETCH_ASSOC = 5;
/**
* FETCH NAMED
*
* Specifies that the fetch method shall return each row as an array indexed
* by column name as returned in the corresponding result set. If the result set
* contains multiple columns with the same name, PDO::FETCH_NAMED returns an
* array of values per column name.
*
*/
const FETCH_NAMED = 6;
/**
* FETCH NUM
*
* Specifies that the fetch method shall return each row as an array indexed by
* column number as returned in the corresponding result set, starting at column 0.
*/
const FETCH_NUM = 7;
/**
* FETCH BOTH
*
* Specifies that the fetch method shall return each row as an array indexed by both
* column name and number as returned in the corresponding result set, starting at column 0.
*/
const FETCH_BOTH = 8;
/**
* FETCH OBJ
*
* Specifies that the fetch method shall return each row as an object with property names
* that correspond to the column names returned in the result set.
*/
const FETCH_OBJ = 9;
/** /**
......
...@@ -44,8 +44,13 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase { ...@@ -44,8 +44,13 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_TDIRTY); $this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_TDIRTY);
$this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_TDIRTY); $this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_TDIRTY);
$count = count($this->dbh);
$e->save(); $e->save();
$this->assertEqual(($count + 13), $this->dbh->count());
$this->assertEqual($e->getState(), Doctrine_Record::STATE_CLEAN);
$this->assertTrue($e->Entity[0] instanceof Entity); $this->assertTrue($e->Entity[0] instanceof Entity);
$this->assertTrue($e->Entity[1] instanceof Entity); $this->assertTrue($e->Entity[1] instanceof Entity);
...@@ -61,9 +66,12 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase { ...@@ -61,9 +66,12 @@ class Doctrine_RecordTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($e->Entity[0]->getState(), Doctrine_Record::STATE_CLEAN);
$this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($e->Entity[1]->getState(), Doctrine_Record::STATE_CLEAN);
$this->assertTrue(is_numeric($e->id));
$e = $e->getTable()->find($e->id); $e = $e->getTable()->find($e->id);
$this->assertTrue($e instanceof Entity);
$this->assertTrue($e->Entity[0] instanceof Entity); $this->assertTrue($e->Entity[0] instanceof Entity);
$this->assertTrue($e->Entity[1] instanceof Entity); $this->assertTrue($e->Entity[1] instanceof Entity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment