Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 06-15-2005, 10:41 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default An idea to the "Query Problem"

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
Attached Files
File Type: zip queries_techdemo.zip (34.4 KB, 14 views)
Reply With Quote
  #2  
Old 06-17-2005, 12:42 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 06-17-2005, 01:00 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The class would indeed need a lot of work.
That's why I said it's just to proof the concept
Reply With Quote
  #4  
Old 06-17-2005, 01:25 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Won't this add a lot of php processing time to every query ?
Reply With Quote
  #5  
Old 06-17-2005, 01:43 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the microseconds it adds are a tradeoff of flexability of database abstraction and or hacks not needing to modify even more things.
Reply With Quote
  #6  
Old 06-17-2005, 04:02 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 06-17-2005, 05:06 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

functions are slightly different. (though people who talk about peformance overheads of an if statement imo dont know what they're talking about)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:20 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10988 seconds
  • Memory Usage 2,235KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (1)postbit_attachment
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete