/** * Quotes value * * @param string $value * @return string */ public function quoteValue($value) { if (is_int($value)) { return (string) $value; } elseif (is_float($value)) { return $this->floatConversion ? $this->toFloatSinglePrecision($value) : (string) $value; } elseif (is_null($value)) { return 'NULL'; // Not supported by SphinxQL, but included for consistency with prepared statement behavior } return parent::quoteValue($value); }
public function testQuoteValueWithPdoMysql() { if (!$this->adapters['pdo_mysql'] instanceof \PDO) { $this->markTestSkipped('MySQL (PDO_Mysql) not configured in unit test configuration file'); } $mysql = new Mysql($this->adapters['pdo_mysql']); $value = $mysql->quoteValue('value'); $this->assertEquals('\'value\'', $value); $mysql = new Mysql(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_mysql']))); $value = $mysql->quoteValue('value'); $this->assertEquals('\'value\'', $value); }
/** * @covers Zend\Db\Adapter\Platform\Mysql::quoteValue */ public function testQuoteValue() { $this->assertEquals("'value'", $this->platform->quoteValue('value')); }
/** * @covers Zend\Db\Adapter\Platform\Mysql::quoteValue */ public function testQuoteValue() { $this->setExpectedException('PHPUnit_Framework_Error', 'Attempting to quote a value in Zend\\Db\\Adapter\\Platform\\Mysql without extension/driver support can introduce security vulnerabilities in a production environment'); $this->assertEquals("'value'", $this->platform->quoteValue('value')); }