Пример #1
0
 public function testQuoteValueWithPdoSqlite()
 {
     if (!$this->adapters['pdo_sqlite'] instanceof \PDO) {
         $this->markTestSkipped('SQLite (PDO_SQLITE) not configured in unit test configuration file');
     }
     $sqlite = new Sqlite($this->adapters['pdo_sqlite']);
     $value = $sqlite->quoteValue('value');
     $this->assertEquals('\'value\'', $value);
     $sqlite = new Sqlite(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_sqlite'])));
     $value = $sqlite->quoteValue('value');
     $this->assertEquals('\'value\'', $value);
 }
Пример #2
0
 /**
  * @covers Zend\Db\Adapter\Platform\Sqlite::quoteIdentifierInFragment
  */
 public function testQuoteIdentifierInFragment()
 {
     $this->assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar'));
     $this->assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar'));
     // single char words
     $this->assertEquals('("foo"."bar" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', array('(', ')', '=')));
     // case insensitive safe words
     $this->assertEquals('("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz) AND (foo.baz = boo.baz)', array('(', ')', '=', 'and')));
 }
Пример #3
0
 /**
  * @covers Zend\Db\Adapter\Platform\Sqlite::quoteValue
  * @covers Zend\Db\Adapter\Platform\Sqlite::quoteTrustedValue
  */
 public function testCanCloseConnectionAfterQuoteValue()
 {
     // Creating the SQLite database file
     $filePath = realpath(__DIR__) . "/_files/sqlite.db";
     if (!file_exists($filePath)) {
         touch($filePath);
     }
     $driver = new \Zend\Db\Adapter\Driver\Pdo\Pdo(array('driver' => 'Pdo_Sqlite', 'database' => $filePath));
     $this->platform->setDriver($driver);
     $this->platform->quoteValue("some; random]/ value");
     $this->platform->quoteTrustedValue("some; random]/ value");
     // Closing the connection so we can delete the file
     $driver->getConnection()->disconnect();
     @unlink($filePath);
     $this->assertFalse(file_exists($filePath));
 }
Пример #4
0
 /**
  * @group ZF2-386
  * @covers Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierInFragment
  */
 public function testQuoteIdentifierInFragmentIgnoresSingleCharSafeWords()
 {
     $this->assertEquals('("foo"."bar" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', array('(', ')', '=')));
 }
Пример #5
0
 /**
  * @covers Zend\Db\Adapter\Platform\Sqlite::quoteIdentifierInFragment
  */
 public function testQuoteIdentifierInFragment()
 {
     $this->assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar'));
     $this->assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar'));
 }