5

Can you tell me if Joomla SQL drivers support prepared statements? As far as I understand, the MySQLi driver does not prepare SQL statements. But Joomla also supports MySQL PDO driver. Does this driver prepare SQL statements? Is it safe to use Joomla SQL wrappers?

1
1

Prepared Statements are possible in Joomla 4

$db    = JFactory::getDbo();
$query = $db->getQuery(true);

$value = 'string';

$query->select($db->quoteName('something'))
      ->from($db->quoteName('#__table_name'))
      ->where($db->quoteName('foo') . ' = :myfield')
      ->bind(':myfield', $value);

$db->setQuery($query);

$records = $db->loadObjectList();

Some references:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.