wp_post在blog_cn数据库中,而stat_weibo在task数据库中。现在两个数据表需要进行连表查询,该如何实现?
光阴似箭催人老,日月如移越少年。
Also note that these two databases are in one mariadb instance. Cross-mariadb, cross-server join is not possible
Override the ActiveRecord::getDb() method and return to connect to the database according to the configured db component by default.
You can do this if the two databases are in the same Mysql server
Override the tableName() method of the Weibo model class:
public static function tableName() { preg_match("/dbname=([^;]+)/i", self::getDb()->dsn, $matches); return $matches[1].'.weibo'; }
If the two databases are not in the same Mysql server, there is no solution for the time being
Also note that these two databases are in one mariadb instance. Cross-mariadb, cross-server join is not possible
Override the ActiveRecord::getDb() method and return to connect to the database according to the configured db component by default.
You can do this if the two databases are in the same Mysql server
Override the tableName() method of the Weibo model class:
If the two databases are not in the same Mysql server, there is no solution for the time being