I'm constructing a Data Access Object within a project utilizing the Yii framework. One of the insert queries is relatively complicated as it is spread out over three related tables.
At this time, I have the SQL queries written out, and am not using QueryBuilder.
At the beginning of the insert function, I have
$connection = Yii::app()->db;
$transaction = $connection->beginTransaction();
try {
$command = $connection->createCommand($this->insertQuestion);
//multiple $command->bindParam() calls
According to the documentation, a CDbCommand
instance can be reused to build multiple queries. However, CdbCommand::reset
must be called when reusing for a new query.
This only appears within the QueryBuilder portion of the documentation. As I'm using CdbCommand::bindParam
to bind variables to the query without using QueryBuilder, is it necessary for me to do
$command->reset();
$command->setText($sqlText);
$command->bindParam("sqlVar", $variable, PDO::PARAM_INT);
Is it possible to skip using CDbCommand::reset
in this situation?