Solar_Sql_Adapter_Oracle::quoteInto()
public
mixed
Solar_Sql_Adapter_Oracle::quoteInto
( string $text
, mixed $data
)
Quotes a value and places into a piece of text at a placeholder; the placeholder is a question-mark.
Inherited from Solar_Sql_Adapter.
Parameters
(string)
$text
: The text with placeholder(s).(mixed)
$data
: The data value(s) to quote.
Returns
(mixed) An SQL-safe quoted value (or string of separated values) placed into the orignal text.
Description
Quotes a value and places into a piece of text at a placeholder; the placeholder is a question-mark.
<?php
$sql = Solar::factory('Solar_Sql');
// replace one placeholder
$text = "WHERE date >= ?";
$data = "2005-01-01";
$safe = $sql->quoteInto($text, $data);
// => "WHERE date >= '2005-01-02'"
// replace multiple placeholders
$text = "WHERE date BETWEEN ? AND ?";
$data = array("2005-01-01", "2005-01-31");
$safe = $sql->quoteInto($text, $data);
// => "WHERE date BETWEEN '2005-01-01' AND '2005-01-31'"
// single placeholder with array value
$text = "WHERE foo IN (?)";
$data = array('a', 'b', 'c');
$safe = $sql->quoteInto($text, $data);
// => "WHERE foo IN ('a', 'b', 'c')"
// multiple placeholders and array values
$text = "WHERE date >= ? AND foo IN (?)";
$data = array('2005-01-01, array('a', 'b', 'c'));
$safe = $sql->quoteInto($text, $data);
// => "WHERE date >= '2005-01-01' AND foo IN ('a', 'b', 'c')"