Kayako logo
Duplicate Requests Duplicated feature requests.

Closed Thread
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  (#1) Old
Sheep Offline
Member
 
Sheep's Avatar
 
Posts: 333
Join Date: Feb 2007
Location: Lyon, France
improve dbcore - 03-07-2007, 08:11 AM

Jamie could you tell a core develloper about a quick fix that i -need-, please?

I can't see it (because the function.php is encoded and i think that the global $dbcore is defined here) but i guess that the dbcore is based on the mysql_query()

but
http://www.php.net/manual/en/function.mysql-query.php
Quote:
mysql_query() sends an unique query (multiple queries are not supported) to the currently active database
the UNIQUE query is what is disturbing me as i need a multiple querry
PHP Code:
$dbCore->query("SELECT @myLeft := lft, @myRight := rgt FROM swsermrightgroup WHERE rightgroupid = $groupid;");
$dbCore->query("SELECT rightgroupid,name FROM swsermrightgroup WHERE lft<@myLeft AND rgt>@myRight ORDER BY rightgroupid;"); 
would become
PHP Code:
$dbCore->query("SELECT @myLeft := lft, @myRight := rgt FROM swsermrightgroup WHERE rightgroupid = $groupid;
SELECT rightgroupid,name FROM swsermrightgroup WHERE lft<@myLeft AND rgt>@myRight ORDER BY rightgroupid;"
); 
The difference comes that only 1 transaction is opened. (performance and request integrity: no other transaction should interupt this one between the 2 request). Currently, a double acces (an other php page called in the same time) might execute a query between the two queries and could change the results that i should expect (i think. But i'm not 100% sure as this part is hidden).

The following comment is a nice tips on how to handle multiple queries
http://www.php.net/manual/en/functio...uery.php#37870

PHP Code:
function mysql_exec_batch ($p_query$p_transaction_safe true) {
  if (
$p_transaction_safe) {
      
$p_query 'START TRANSACTION;' $p_query '; COMMIT;';
    };
  
$query_split preg_split ("/[;]+/"$p_query);
  foreach (
$query_split as $command_line) {
    
$command_line trim($command_line);
    if (
$command_line != '') {
      
$query_result mysql_query($command_line);
      if (
$query_result == 0) {
        break;
      };
    };
  };
  return 
$query_result;

The
PHP Code:
 'START TRANSACTION;' $p_query '; COMMIT;'
Is what is interesting.
I could do a dbcore query with START TRANSACTION every time (but damn that's quite boring!)

changing the dbCore->query won't change anything in the actual code but will allow developpers to handle multiple querry.


If the answer is "sorry this won't be done" that's no problem because i'll define it by myself but i think this can be a core improvment.

Greetings,
Antoine


Antoine "Sheep" BERMON
-- I left kayako's community: do NOT contact me for job offers, thx --

Last edited by Sheep; 03-07-2007 at 08:16 AM.
   
  (#2) Old
Jamie Edwards Online
Operations Manager
 
Jamie Edwards's Avatar
 
Posts: 5,119
Join Date: Jan 2006
Location: United Kingdom
03-07-2007, 09:19 AM

Provided that transactions are supported, then yes you can use transactions and strung queries. Multiple databases will also be supported in the next product line version.


Jamie Edwards (jamie.edwards ]at[ kayako.com)
----------------------------------------------------------------
---
  • New to the forum? New user's guide here.
  • Submit bug reports here.
  • Submit support tickets via the members area.
  • Submit sales queries either via live chat or via e-mail.
  • There is no official ETA on Version 4.
   
  (#3) Old
Sheep Offline
Member
 
Sheep's Avatar
 
Posts: 333
Join Date: Feb 2007
Location: Lyon, France
03-07-2007, 09:29 AM

Edit: hmm wait, i think i have read too fast your message. You're telling me that transaction is alread used, ok, then forget my post
Edit: hmm, duplicates? woops


Antoine "Sheep" BERMON
-- I left kayako's community: do NOT contact me for job offers, thx --

Last edited by Sheep; 03-07-2007 at 09:39 AM. Reason: deleted dumb request
   
Closed Thread

Tags
dbcore, improve

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Documentation for dbCore class? JustinCarmony SupportSuite, eSupport and LiveResponse 6 07-06-2008 08:29 AM



Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46