How to use Clasule RAW
Closed this issue · 2 comments
webserveis commented
How to create a RAW Query from PDO?
webserveis commented
I create this
public function rawQuery($sql) {
$stmt = $this->pdo->prepare($sql);
$stmt->execute();
if ($stmt) {
$result = array();
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$result[] = $row;
}
} else {
$result = null;
}
return $result;
}
kwhat commented
Raw is used to escape a parameterized item in a query. For example: new Conditional('col', '=', new Raw('"no escape"'));
will produce col = "no escape"
instead of col = ?