vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Diffrence between query_read and query_write? (https://vborg.vbsupport.ru/showthread.php?t=210001)

alqassam 03-31-2009 09:58 PM

Diffrence between query_read and query_write?
 
Hello,
I want to know the diffrence between "query_read" and "query_write" commands??

I know i should use "query_read" for ("SELECT","SHOW") and "query_write" for ("INSERT","UPDATE","DELETE","REPLACE",... etc)

But when i revised the file "class_core.php" i found:

PHP Code:

function query_read($sql$buffered true)
    {
        
$this->sql =& $sql;
        return 
$this->execute_query($buffered$this->connection_master);
    } 

PHP Code:

function query_write($sql$buffered true)
    {
        
$this->sql =& $sql;
        return 
$this->execute_query($buffered$this->connection_master);
    } 


The same thing !!
what's the diffrence between them ? and can i use "query_read" for write queries and "query_write" for read queries?

Dismounted 04-01-2009 06:03 AM

At the moment, there is no difference - there may be in the future, but there isn't any now. (Heck, you can have a look ay query() is you want to...)

You should use query_write() when writing data and query_read() when reading data.

Paul M 04-01-2009 06:14 AM

Unless timing is vital, you should use query_read_slave() for reads.

alqassam 04-01-2009 03:22 PM

Nice, I think it's better to make query_write() unbuffered query..
Thank you for the clarification

Antivirus 04-01-2009 10:54 PM

also, one which I use quite frequently is query_first() which returns the first result within an array so you don't have to do db_fetch_array() after the query_read(). Very useful for when you know your query will only return one row

alqassam 04-02-2009 09:33 AM

Thank you Antivirus,
Yes, it's also do free_result query


All times are GMT. The time now is 11:55 AM.

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.01558 seconds
  • Memory Usage 1,719KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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