Jump to content

Using multiple databases: Difference between revisions

From NusaATK
m Use Multiple Databases in ATK Applications moved to Using multiple databases
Gabilan (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Posted on the [http://www.achievo.org/forum/viewtopic.php?t=3121&highlight=multiple+database forum] by user marlbil
{{Howto|Advanced|Marlbil}}
 
Posted on the [http://www.achievo.org/forum/viewtopic.php?t=3121&highlight=multiple+database forum] by user marlbil (Marlon Bilog)


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


Quote:
<syntaxhighlight lang="php">
 
$config_db["module1db"]["driver"] = "mysql";  
$config_db["module1db"]["driver"] = "mysql";  
$config_db["module1db"]["host"] = "localhost";  
$config_db["module1db"]["host"] = "localhost";  
Line 18: Line 19:


...  
...  
 
</syntaxhighlight>


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


Quote:
<syntaxhighlight lang="php">
$this->setTable("nodename","","module1db"])
  $this->setTable("nodename","","module1db");
 
</syntaxhighlight>


'''3. and, if you use your node in other relations. just add the flag:'''  
'''3. and, if you use your node in other relations. just add the flag:'''  
Line 30: Line 31:
for many2one:  
for many2one:  


Quote:
  AF_MANYTOONE_LAZY
AF_MANYTOONE_LAZY




for one2one:  
for one2one:  
Quote:


AF_ONETOONE_LAZY  
  AF_ONETOONE_LAZY  




Line 44: Line 43:
for many2one and one2one:  
for many2one and one2one:  


Quote:
  AF_NO_SORT
AF_NO_SORT

Latest revision as of 03:12, 21 April 2008

ATK Howto: Using multiple databases

Complexity: Advanced
Author: Marlbil

List of other Howto's

Posted on the forum by user marlbil (Marlon Bilog)

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

$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:

  $this->setTable("nodename","","module1db");

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

for many2one:

 AF_MANYTOONE_LAZY


for one2one:

 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:

 AF_NO_SORT