INSERT INTO fruit VALUES
('apple', 'red', 150),
('banana', 'yellow', 250),
('kiwi', 'brown', 75),
('lemon', 'yellow', 25),
('orange', 'orange', 300),
('pear', 'green', 150),
('watermelon', 'pink', 90)",
'statement' =>
"SELECT name, colour, calories
FROM fruit
WHERE calories <= :calories AND colour = :colour",
'input_parameters' => array(':calories' => 150, ':colour' => 'red'),
'PDO::FETCH_ASSOC',
],
[
'exec_statement' =>
"CREATE TABLE fruit
(name, colour, calories INT);
INSERT INTO fruit VALUES
('apple', 'red', 150)",
'statement' =>
"SELECT name, colour, calories
FROM fruit
WHERE calories 150 AND colour = 'red'",
'driver_options' => array('PDO::ATTR_CURSOR' => 'PDO::CURSOR_SCROLL'),
],
];
public $input_args = ['driver_options', 'exec_statement', 'input_parameters', 'statement'];
if (! $this->result['pdostatement'] = $pdo->prepare($statement, $driver_options)) {
// note: sqlite does not support scrolling cursors
$this->method_to_exec = false;
return;
}
if ($driver_options) {
// forces the driver options that do not seem to be working as a param of prepare()
pdo__prepare::fix_driver_options($pdo, $driver_options);
}