The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
diff betw $vbulletin->db->query_write and $db->query_write
Whats the difference between $vbulletin->db->query_write and $db->query_write and can this effect vbulletin negatively to use the wrong one or cause table locking errors? Thanks
|
#2
|
||||
|
||||
There is no difference. They are the same because of this code:
PHP Code:
The only reason for it, is to lighten the lookup load on the PHP engine. It's faster to lookup $db->query_write() than it is to lookup $vbulletin->db->db_query_write(). But it's not really noticibly faster unless you're running thousands upon thousands of queries at once. |
#3
|
|||
|
|||
I doubt it is any faster, it is only shorter to type so saves a bit of work for the developers.
|
#4
|
||||
|
||||
Note that $db is not always in scope - I always use $vbulletin->db to be safe.
|
#5
|
||||
|
||||
Quote:
array1 = {23, 1, 453, 87, 6, 2, 7, 9, 10, 135, 37, 134, 64, 1975, 23,753,235,97} value1 = array1[ indexof(235) ] In order to call 235 by value (or name) instead of by index, we have to use the "index of" function which searches the array linearly until it finds 235. But if we do that search and assign it to a variable, then we don't have to keep doing that time wasting search. By calling the db object by name from the $vbulletin object - the PHP engine has to do a linear search in the $vbulletin object. But if you only do that once to assign the db object to $db, you don't have to do that linear search every single time. It is faster to lookup $db than it is to lookup $vbulletin->db. However, the difference in speed is very small, and it's only noticible if you're doing thousands upon thousands of queries at once. But as I mentioned before, and as Dismounted pointed out, $db doesn't always exist - and if it doesn't (especially in custom .php files) you would have to define it yourself. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|