Run 1 Line of SQL before the rest of the code

Hi, I have a script that has " double quotes as column identifiers instead of backticks (there are capitals in our column names) which works on Postgres but not mysql (both need to be supported) unless you run set sql_mode = ‘ANSI_QUOTES’;

So my question is, how to run that before yii executes anything else, because as far as I understand it, this needs to be run in the same connection so it has to use

$command = Yii::app()->db->createCommand('SET sql_mode = \'ANSI_QUOTES\'');


Check CDbConnection.initSQLs.

In your case:

'db' => array(

   'initSQLs' => array(

      'SET sql_mode = \'ANSI_QUOTES\'',



Thanks, that worked!