Jump to content

Using multiple databases

From NusaATK
Revision as of 07:20, 11 October 2007 by Jgarifuna (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Posted on the forum by user marlbil

1. just add other database in config.inc.php like:

Quote:

$config_db["module1db"]["driver"] = "mysql"; $config_db["module1db"]["host"] = "localhost"; $config_db["module1db"]["db"] = ""; $config_db["module1db"]["user"] = ""; $config_db["module1db"]["password"] = "";

$config_db["module2db"]["driver"] = "mysql"; $config_db["module2db"]["host"] = "localhost"; $config_db["module2db"]["db"] = ""; $config_db["module2db"]["user"] = ""; $config_db["module2db"]["password"] = "";

...


2. then specify the db to use in your nodes:

Quote: $this->setTable("nodename","","module1db"])


3. and, if you use your node in other relations. just add the flag:

for many2one:

Quote: AF_MANYTOONE_LAZY


for one2one: Quote:

AF_ONETOONE_LAZY


Note that some features (like column sort) in the admin page does not work. So, you may also add the flag:

for many2one and one2one:

Quote: AF_NO_SORT