Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

using prefix on database tables


Guest

Recommended Posts

Posted

Hi,

I'm new to this forum. I am currently evaluating shop software for a customer. I found this issue not only on osCommerce but on other PHP software also:

 

If I setup database tables, there is no unique prefix used on tables names.

 

Here in Germany, most providers only allow one mySQL database per account. So if somebody wants to set up a shop on a shared server, it may lead into problems if any other database script may run on the same shared account.

 

For my software, I always use a global variable $prefix which I add to all table names so that a table "products" will become {$prefix}products

 

Therefore you can ensure, that the tables names will not confilict with other software running at the same domain. I suggest, to implement this feature in osCommerce also.

 

What do you think?

 

Marian

Posted

you can patch the shop accordingly...

 

in configure.php add somwhere

  define('TABLEPREFIX', 'myShopName');

 

in application_top.php change the tablename-defines

  define('TABLE_ADDRESS_BOOK', $TABLEPREFIX . 'address_book');

 define('TABLE_ADDRESS_FORMAT', $TABLEPREFIX . 'address_format');

 define('TABLE_BANNERS', $TABLEPREFIX . 'banners');

 ...

 ..

 .

 

do this for admin and for catalog...

finally replace the tablenames inside the .sql files... this will probably be the largest amount of work...

 

when finished, track down missed tablenames (sometimes hardcoded from addons for example)... and change them accordingly to include the tableprefix...

use myPHPadmin or any other tool to fix the database ....

 

finally check the backup/restore functions in admin not to include other databases than just the prefixed ones!

Posted
you can patch the shop accordingly...

 

thanks. You are right. I did not see that osCommerce was using constants for the table names because I used the milestone-Version. With the daily snapshot I can see the improvement :)

 

Marian

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...