Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 General Discussions
  #1  
Old 03-15-2014, 04:05 PM
PSiggy PSiggy is offline
 
Join Date: Dec 2012
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL Query Syntax

Hi!

I'd like to ask about this:
https://www.vbulletin.com/docs/html/...ards_sql_query

Is that syntax still valid in VB5? I'm trying to port some things I did back in VB4 to VB5 and this seems not to work at all.

If that syntax is still valid, can anyone give me some example of simple php code/widget that will do some reading from DB please?

Thank you!
Reply With Quote
  #2  
Old 03-18-2014, 10:07 PM
DragonByte Tech's Avatar
DragonByte Tech DragonByte Tech is offline
 
Join Date: Feb 2010
Location: Scotland
Posts: 8,814
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Unfortunately that syntax isn't going to work at all

If you take a look at any of our released vB5 mods, you'll find a file /upload/core/packages/<packagename>/db/mysql/querydefs.php where complex queries are stored.

You then need to use the DB Assertor similar to this:
Code:
$data = vB::getDbAssertor()->getRows('DBTechAjaxThreads:getDataForCache-' . $tableShort, array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED), false, $keyField);
Or if you want to run simpler queries, you can use something like
Code:
		$nodes = vB::getDbAssertor()->getRows('vBForum:node', array(
			vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT,
			vB_dB_Query::COLUMNS_KEY => array('nodeid', 'lastupdate'),
			vB_dB_Query::CONDITIONS_KEY => array(
				array('field' => 'starter', 'value' => $nodeid, 'operator' => vB_dB_Query::OPERATOR_EQ)
			)
		));
I don't believe there's any documentation for this in the wild just yet, so your best bet would be to examine as many vB5 mods / core vB5 files as you can and try to pick it up as you go.

Hope that helps


Fillip
Reply With Quote
3 благодарности(ей) от:
PSiggy, RichieBoy67, Zachery
  #3  
Old 03-18-2014, 10:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yves wrote some documentation on it. Perhaps it is over on vbulletin.com
Reply With Quote
  #4  
Old 03-19-2014, 05:55 AM
PSiggy PSiggy is offline
 
Join Date: Dec 2012
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the reply!
Reply With Quote
  #5  
Old 03-19-2014, 07:14 AM
AndroidXDA AndroidXDA is offline
 
Join Date: Mar 2014
Location: UK
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need the code to pull something from a part of the database and display it under username in vbulletin.

Any help would be great!

Thx
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 09:31 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.06301 seconds
  • Memory Usage 2,194KB
  • Queries Executed 11 (?)
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
  • (5)post_thanks_box
  • (3)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete