Do a small component for my Yii app. Code
$connection = Yii::app()->getComponent('db');
$sql = 'SELECT * FROM {{settings}}';
$command = $connection->createCommand($sql);
raises error
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{settings}}' at line 1. The SQL statement executed was: SELECT * FROM {{settings}}
Tell me what went wrong. I can't use braces to escape the table name?
Thanks
UPDATE:
It seem this is Yii Query Bulduer bug.
if I use this configuration
'db'=>array(
'connectionString' => '...',
'emulatePrepare' => ...,
'username' => '...',
'password' => '...',
'charset' => '...',
'tablePrefix' => ''
),
pay attention to the empty tablePrefix — all works fine.
Removing this key I get the problem described above. But I don't need table prefix. I just want to use a component that can work with prefixes, not only in my application.