multible databases

In CS-Cart 2.2.1 Changelog i found this point:



[+] The ability to connect to several databases at the same time was added.



Can anybody give me more information to this fact. What can i do, where to configure …?

Hello, karrde!



This functionality has been added just to the code. There are no settings in the store administration panel. Basically this functionality is not used in CS-Cart by default. The ability to connect to several databases at the same time has been added in order to use it in the further improvements of CS-Cart (or in the custom modifications).



Let me explain how it works on the whole.



CS-Cart connects to the main database, which is defined in the “config.local.php” file. In order to connect to additional database the db_initiate function is used. For example:



db_initiate('localhost', 'user', 'password', 'db_namd', 'sph', 'prefix')


where “sph” is the name of the database (this name is used only internally in the code), prefix is the prefix.



After successful connection to the additional database, requests to it are executed in the following way.

Main database:


SELECT * ....




or


main#SELECT * ...




Additional database:


sph#SELECT * ...
sph#INSERT ...




I hope this answers your question.

Yes, it does. Thanks.