[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/dbal/tests/cases/driver/oci/ -> lmbOciInsertTest.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  require_once(dirname(__FILE__) . '/../DriverInsertTestBase.class.php');
  10  require_once(dirname(__FILE__) . '/fixture.inc.php');
  11  
  12  class lmbOciInsertTest extends DriverInsertTestBase
  13  {
  14    function lmbOciInsertTest()
  15    {
  16      parent :: DriverInsertTestBase('lmbOciInsertStatement');
  17    }
  18  
  19    function setUp()
  20    {
  21      $this->connection = lmbToolkit :: instance()->getDefaultDbConnection();
  22      DriverOciSetup($this->connection->getConnectionId());
  23      parent::setUp();
  24    }
  25  
  26    function testInsertIdShouldUseSequence()
  27    {
  28      $sql = "
  29          INSERT INTO founding_fathers (
  30              first, last
  31          ) VALUES (
  32              :first:, :last:
  33          )";
  34      $stmt = $this->connection->newStatement($sql);
  35      $stmt->setVarChar('first', 'Richard');
  36      $stmt->setVarChar('last', 'Nixon');
  37  
  38      $id = $stmt->insertId('id');
  39      $this->assertTrue($id > 0);
  40  
  41      $this->connection->newStatement("DELETE FROM founding_fathers")->execute();
  42  
  43      $new_id = $stmt->insertId('id');
  44      $this->assertEqual($new_id - $id, 1);
  45    }
  46  }
  47  
  48  ?>


Generated: Sat Aug 30 04:38:32 2008 Cross-referenced by PHPXref 0.7