![]() |
prefix for your database tables
General
This hack has been created using a vB 2.2.5 but I think it should be working with any vB 2.x.x. This hack is BETA, I'm sure you will get some database errors on your board. Please do NOT use it on production boards. What this hack does This hack allows you to add a prefix to your table names (example: if you use the prefix "vb_" your table "user" would be named "vb_user". This is important if you want to install multiple vBulletins on one database. How does it work If $dbprefix is set in the config.php, the table names are changed in every query. This works as the following: if the table {prefix}{tablename} exists, it will be changed to {prefix}{tablename}, if not, it will be left as {tablename}. This will make it possible to have some tables changed to vb_* and others not. This is for the possibility you want to use some tables (for example the user related tables) in multiple boards. (okay, this is a bit confusing, but my english isn't very well ;)) How to install (there will be a better manual for the final release) ##### # in ./global.php, ./admin/global.php and ./mod/global.php: Replace Code:
$DB_site->password=$dbpassword; Code:
$DB_site->password=$dbpassword; # in ./admin/db_mysql.php: Find Code:
function query($query_string) { Code:
if ($this->prefix != "") { Code:
function fetch_array($query_id=-1,$query_string="") { Code:
function addprefix($query) { # in ./admin/config.php Somewhere, add Code:
// tablename prefix That's all... post bug reports, questions etc. here, do not pm, email or icq me about this hack - you will be ignored. Thanks. |
Wouldn't this make queries slower, PHP-wise? (with all the regex's for each string)
BTW, I don't think you took into consideration qualifying (SELECT tblName.field FROM tblName). :) |
Yes, of course it will make the the board a bit slower (as every hack, only a bit more ;)) but... would you prefer to change 1137 queries by hand? I don't have any benachmark yet but I don't think this will be too drastic...
I don't understand your problem with SELECT tblName.field FROM tblName? This should work without problems... |
Don't forget to mention that you need to have two licences for two boards, and so on :)
|
Let's say I have this query:
Code:
SELECT post.postid, user.username Oh, and you also need to edit /mod/global.php just like the other global.php's. |
It SHOULD work (I will try this query later) - but no warranty, that's why it's beta ;)
EDIT: Yes, it works. It is translated to Code:
SELECT vb_post.postid, vb_user.username FROM vb_post LEFT JOIN vb_user ON (vb_user.userid=vb_post.userid) WHERE vb_post.userid <> 0 |
Well, very nice. :)
|
would this cause any problems when upgradeing?
|
It could cause problems if there are tables used by multiple vBulletin boards and if this tables change between the versions...
Please note, that before running the upgrade script you MUST redo the file changes, otherwise the upgrade script will not work. And don't forget to create a full backup of your database... |
I have set up a test board yesterday on my winxp system here :P apache/mysql/php, so this would be nice to test! I will install several instances and try to run multiple with the same userbase and some other equal sections and see which errors i will run into.
YES< I only have once license, but this is on my second system behind the router, in the network, and not public. URI can't be reached through internet. |
All times are GMT. The time now is 11:19 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|