Log in

View Full Version : An idea to the "Query Problem"


Andreas
06-15-2005, 10:41 PM
This work might be useless, and it might be difficult to understand it - but I wanted to give it a shot at least ;)

We all know that is is difficult (and in most cases not possible) to modify queries through Plugins.
IMHO this is a major problem for many hacks, and thus they will rely on file edits.

Therefore, my idea was to create a Query Class to be able to manipulate queries.
I did that ... but the class isn't fully implemented yet, nor optimized or anything.
Consider it proof-of-concept code or a tech-demo.

I took forumdisplay.php as an example and replaced all queries with this class.
As there are many changes the instructions would become quite long and complicated, therefore I just created a unified diff file you can apply to an unmodified vBulletin 3.5.0 Beta 1 forumdisplay.php

"Installation instructions"

Upload class_query.php to folder includes.

Execute

patch<forumdisplay.patch

Note: I have included a Windows port of GNU patch, the full package can be found at http://unxutils.sourceforge.net/

Then upload the patched forumdisplay.php

In order to use the new Hooks, you must add the following entries to hooktype forumdisplay in file includes/xml/hooks_vbulletin.xml:


<hook>query_forumread_update</hook>
<hook>query_forumusers</hook>
<hook>query_announcements</hook>
<hook>query_threadscount</hook>
<hook>query_stickies</hook>
<hook>query_getthreadids</hook>
<hook>query_threads</hook>


Let me know what you think :)

merk
06-17-2005, 12:42 AM
Great Idea, though there is heaps of stuff to be done on this class.

Group by is the first one that comes to mind :)

But this could be the first step towards database abstraction.

Andreas
06-17-2005, 01:00 AM
The class would indeed need a lot of work.
That's why I said it's just to proof the concept :)

Paul M
06-17-2005, 01:25 AM
Won't this add a lot of php processing time to every query ?

merk
06-17-2005, 01:43 AM
the microseconds it adds are a tradeoff of flexability of database abstraction and or hacks not needing to modify even more things.

Paul M
06-17-2005, 04:02 AM
LOL - When I suggested adding hooks to allow the replacing of some functions, I got shot down because "it would add extra processing time", which is exactly what this will do as well - oh well. :disappointed:

It's a nice idea, but I would be wary of the overhead it adds. :)

merk
06-17-2005, 05:06 AM
functions are slightly different. (though people who talk about peformance overheads of an if statement imo dont know what they're talking about)