1
Vote

stmt->query VS stmt->prepare + stmt->execute

description

Not a bug, just some optimization for App/Db/Adapter/Sqlsrv.php
Doing:
$stmt = $this->prepare($sql);
$stmt->execute($bind);
But not $stmt = $this->query($sql, $bind);
Could be faster because Zend_Db_Adapter_Abstract::query does several checks like
"$sql instanceof Zend_Db_Select" and "!is_array($bind)"
If you are sure that $sql is just sql string and $bind is array you do not need query function :)

comments

juokaz wrote May 22, 2009 at 2:22 PM

Where exactly this code is in App_Db_Adapter_Sqlsrv? Line 291?

lizdeika wrote May 25, 2009 at 6:09 AM

Several places: 291, 349, 366,

wrote May 25, 2009 at 11:05 PM

wrote Feb 12, 2013 at 8:44 PM