vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   An idea to the "Query Problem" (https://vborg.vbsupport.ru/showthread.php?t=83170)

Andreas 06-15-2005 10:41 PM

An idea to the "Query Problem"
 
1 Attachment(s)
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
Code:

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:

Code:

<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)


All times are GMT. The time now is 09:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02949 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete