because we’re doing cross-database joins with ActiveRecord, which works pretty nice, btw.
We need the tableName() prefixed with the database name.
So where can I get this info?
at the moment it looks like:
public function tableName() {
// return table name with DB name to get relations from different DBs to work
$name = preg_match("/dbname=([^;]*)/", $this->dbConnection->connectionString, $matches);
return $matches[1].'.PiiFile';
}
the only way i see it is to extend the CDbConnection class and add another property to it called ‘dbName’, in the config you set that name. after that you will be able to access it $this->dbConnection->dbName
Note, that you’ll limit yourself a little to specific DBMS - no matter if you extract it from the DSN or use separate attributes. Not every system uses the concept of db host + db name. Think about SQLite where you’d have a filename instead. That’s probably the reason why a DBMS specific DSN is used instead.