ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:loadbalancer:clusterexecute

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:loadbalancer:clusterexecute [2017/04/19 04:50] mnewnhamv5:reference:loadbalancer:clusterexecute [2017/04/25 01:11] (current) mnewnham
Line 3: Line 3:
 <WRAP right box> <WRAP right box>
 == Applies To == == Applies To ==
-ADOdb Load Balancer+[[v5:loadbalancer:index|ADOdb Load Balancer]]
 == Syntax == == Syntax ==
   mixed clusterExecute(   mixed clusterExecute(
Line 18: Line 18:
 The first two parameters follow the rules as specified in the ADOdb [[v5:reference:connection:execute|execute()]] command. The first two parameters follow the rules as specified in the ADOdb [[v5:reference:connection:execute|execute()]] command.
 ===== $returnAllResults ===== ===== $returnAllResults =====
-The default behavior of the command is to return the result of the execution of the command from first connected server in the pool. If the parameter is set to true, then the results of all executions are collected into an array and returned as a numeric array, ordered by connection. +The default behavior of the command is to return the result of the execution of the command from first connected server in the pool. If the parameter is set to true, then the results of all executions are collected into an array and returned ordered by connection.
-===== $existingConnectionsOnly ==== +
-===== Usage ====+
 <code php> <code php>
 /* /*
-connection to load balancer assumed+Connection pool with 3 MySQL servers
 */ */
 +$a = $db->clusterExecute('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
 +                         false,
 +                         false,
 +                         false);
 +print_r($a);
 +/*
 +* Returns
 +Array
 +(
 +    [0] => ADORecordSet_empty Object
 +        (
 +            [dataProvider] => empty
 +            [databaseType] => 
 +            [EOF] => 1
 +            [_numOfRows] => 0
 +            [fields] => 
 +            [connection] => 
 +        )
  
-$SQL "SET SESSION TIME ZONE";+    [1] => ADORecordSet_empty Object 
 +        ( 
 +            [dataProvider] => empty 
 +            [databaseType] =>  
 +            [EOF] => 1 
 +            [_numOfRows] => 0 
 +            [fields] =>  
 +            [connection] =>  
 +        )
  
-$success $db->clusterExecute($SQL);+    [2] => ADORecordSet_empty Object 
 +        ( 
 +            [dataProvider] => empty 
 +            [databaseType] =>  
 +            [EOF] => 1 
 +            [_numOfRows] => 0 
 +            [fields] =>  
 +            [connection] =>  
 +        )
  
 +)
 +*/
 +
 +$a = $db->clusterExecute('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
 +                         false,
 +                         true,
 +                         false);
 +print_r($a);
 +/*
 +* Returns
 +ADORecordSet_empty Object
 +(
 +    [dataProvider] => empty
 +    [databaseType] => 
 +    [EOF] => 1
 +    [_numOfRows] => 0
 +    [fields] => 
 +    [connection] => 
 +)
 +*/
 </code> </code>
 +===== $existingConnectionsOnly ====
 +If the ''existingConnectionsOnly'' flag is set to true, the command passed to clusterExecute will only be executed against connections that are already in use, otherwise, the clusterExecute command will establish a connection to the database and then execute the command.
  
v5/reference/loadbalancer/clusterexecute.1492570223.txt.gz · Last modified: 2017/04/21 11:37 (external edit)