PDA

View Full Version : redundant queries from installation code?


mtha
07-03-2006, 12:30 PM
CMX,

I've been looking at your vb Plaza installation code, and wondering why you use alot of seperate queries while you can merge them together? Shouldnt it save queries, and run better/faster in the installation process?


example:
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbbux DECIMAL(30, 5) NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbbank DECIMAL(30, 5) NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbp_nextbankinterest INT UNSIGNED NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbp_lastbirthday INT UNSIGNED NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbp_displayflags INT UNSIGNED NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbp_otherflags INT UNSIGNED NOT NULL DEFAULT '0'");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user ADD COLUMN vbp_vbplazaoptions INT UNSIGNED NOT NULL DEFAULT '0'");


why dont use
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user
ADD COLUMN vbbux DECIMAL(30, 5) NOT NULL DEFAULT '0',
ADD COLUMN vbbank DECIMAL(30, 5) NOT NULL DEFAULT '0',
ADD COLUMN vbp_nextbankinterest INT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN vbp_lastbirthday INT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN vbp_displayflags INT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN vbp_otherflags INT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN vbp_vbplazaoptions INT UNSIGNED NOT NULL DEFAULT '0',
...



OR with


$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbbux");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbbank");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbp_nextbankinterest");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbp_lastbirthday");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbp_displayflags");
$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user DROP COLUMN vbp_otherflags");




$db->query_write("ALTER TABLE " . TABLE_PREFIX . "user
DROP COLUMN vbbux,
DROP COLUMN vbbank,
DROP COLUMN vbp_nextbankinterest,
DROP COLUMN vbp_lastbirthday,
DROP COLUMN vbp_displayflags,
DROP COLUMN vbp_otherflags,
...

CMX_CMGSCCC
07-13-2006, 07:26 PM
True, I could probably do all of these, but its a minute point at this time, as I will be working on V2.0 very soon, I will probably incorporate these changes into V2.0

-CMX