Pheasant\Database\Binder::bind PHP Method

bind() public method

Interpolates quoted values in a string with ? in it.
public bind ( $sql, array $params = [] ) : string
$params array
return string
    public function bind($sql, array $params = array())
    {
        return $this->_bindInto('\\?', $sql, $params, function ($binder, $param) use($sql) {
            return $binder->sqlValue($param);
        });
    }

Usage Example

Beispiel #1
0
 public function testBindIntoAQueryWithQuotesInQuotes()
 {
     $binder = new Binder();
     $this->assertEquals($binder->bind("name='\"' and llamas=?", array(24)), "name='\"' and llamas='24'");
 }