I developed a website based on a mysql database version 5.5.8 … now that I wanted to put it on my server (which has mysql version 5.1.54) I get some errors … i figured out, that he is able to find the tables, if i write them with a upper case letter as first letter.
The exception is (sorry, its german): "Die Tabelle "Statistic" für die ActiveRecord-Klasse "Statistic" kann nicht in der Datenbank gefunden werden."
Stack trace:
/kunden/316499_70190/Yii/framework/db/ar/CActiveRecord.php(2237)
2225 private $_model;
2226
2227 /**
2228 * Constructor.
2229 * @param CActiveRecord $model the model instance
2230 */
2231 public function __construct($model)
2232 {
2233 $this->_model=$model;
2234
2235 $tableName=$model->tableName();
2236 if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)
2237 throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',
2238 array('{class}'=>get_class($model),'{table}'=>$tableName)));
2239 if($table->primaryKey===null)
2240 $table->primaryKey=$model->primaryKey();
2241 $this->tableSchema=$table;
2242 $this->columns=$table->columns;
2243
2244 foreach($table->columns as $name=>$column)
2245 {
2246 if(!$column->isPrimaryKey && $column->defaultValue!==null)
2247 $this->attributeDefaults[$name]=$column->defaultValue;
2248 }
I now could change all tables to start with an upper case letter, but thats a really bad solution I think … anyone had this error before? Where does it come from and how to solve it?
I guess it has something to do with the built in ORM Framework of Yii maybe?
I get this same exception intermittently at my hosting provider, on the "SHOW COLUMNS FROM …" call. MySQL 5.051a. As a matter of fact I did change my table names to lower case when preparing for multiple applications, by adding a prefix.
@tri your error is different… by the error I would say it’s some permission problems on the /tmp/ folder… as it say “cannot create/write to file /tmp/…”
it could be some server config for the tmp folder… not enough space… or if on linux… maybe got out of free inodes… anyway you need to contact the server support for this…
Thanks for your reply mdomba. Now I know that it’s not Yii, its the Unix System behind the webspace. Do you have any recommendation how to solve this issue the smartest and cleanest way? …
I guess 1 solution still would be, to rename all the tables … but I got a bad feeling with that