Support for MySQL INSERT DELAYED

I realize that INSERT DELAYED is a MySQL-specific SQL extension, but it would still be nice for Yii to support it. Overriding CDbCommandBuilder::createInsertCommand() is currently very complicated as it requires overriding a bunch of other classes. All you need to do is add an optional parameter that, when set to true, would result in creation of INSERT DELAYED statement:




-public function createInsertCommand($table,$data)

+public function createInsertCommand($table,$data,$delayed=false)

{

	$this->ensureTable($table);

	$fields=array();

	$values=array();

	$placeholders=array();

	$i=0;

	foreach($data as $name=>$value)

	{

		if(($column=$table->getColumn($name))!==null && ($value!==null || $column->allowNull))

		{

			$fields[]=$column->rawName;

			if($value instanceof CDbExpression)

			{

				$placeholders[]=$value->expression;

				foreach($value->params as $n=>$v)

					$values[$n]=$v;

			}

			else

			{

				$placeholders[]=self::PARAM_PREFIX.$i;

				$values[self::PARAM_PREFIX.$i]=$column->typecast($value);

				$i++;

			}

		}

	}

	if($fields===array())

	{

		$pks=is_array($table->primaryKey) ? $table->primaryKey : array($table->primaryKey);

		foreach($pks as $pk)

		{

			$fields[]=$table->getColumn($pk)->rawName;

			$placeholders[]='NULL';

		}

	}

+	$delayed = ($delayed and $this->getDbConnection()->getDriverName() == 'mysql') ? 'DELAYED' : '';

-	$sql="INSERT INTO {$table->rawName} (".implode(', ',$fields).') VALUES ('.implode(', ',$placeholders).')';

+	$sql="INSERT $delayed INTO {$table->rawName} (".implode(', ',$fields).') VALUES ('.implode(', ',$placeholders).')';

	$command=$this->getDbConnection()->createCommand($sql);


	foreach($values as $name=>$value)

		$command->bindValue($name,$value);


	return $command;

}

INSERT DELAYED works only with MyISAM, MEMORY, ARCHIVE, and BLACKHOLE tables. For engines that do not support DELAYED, an error occurs.

http://dev.mysql.com/doc/refman/5.5/en/insert-delayed.html

It is also deprecated, which I was not aware of at the time of writing this, so please ignore this request.