get_last_statement() 공개 정적인 메소드

Useful for access to PDOStatement::rowCount() or error information
public static get_last_statement ( ) : PDOStatement
리턴 PDOStatement
예제 #1
0
 public function testFindOneOverDifferentConnections()
 {
     ORM::for_table('widget')->find_one();
     $statementOne = ORM::get_last_statement();
     $this->assertInstanceOf('MockPDOStatement', $statementOne);
     ORM::for_table('person', self::ALTERNATE)->find_one();
     $statementOne = ORM::get_last_statement();
     // get_statement is *not* per connection
     $this->assertInstanceOf('MockDifferentPDOStatement', $statementOne);
     $expected = "SELECT * FROM `widget` LIMIT 1";
     $this->assertNotEquals($expected, ORM::get_last_query());
     // Because get_last_query() is across *all* connections
     $this->assertEquals($expected, ORM::get_last_query(ORM::DEFAULT_CONNECTION));
     $expectedToo = "SELECT * FROM `person` LIMIT 1";
     $this->assertEquals($expectedToo, ORM::get_last_query(self::ALTERNATE));
 }
예제 #2
0
 public function testGetLastPdoStatement()
 {
     ORM::for_table('widget')->where('name', 'Fred')->find_one();
     $statement = ORM::get_last_statement();
     $this->assertInstanceOf('MockPDOStatement', $statement);
 }