Download the PHP package irap/multi-query without Composer
On this page you can find all versions of the php package irap/multi-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download irap/multi-query
More information about irap/multi-query
Files in irap/multi-query
Package multi-query
Short Description Wrapper object around mysqli to combine queries into one.
License none
Homepage http://www.irap.org/
Informations about the package multi-query
MultiQuery Package
This is a package for simplifying the sending multiple PHP Mysqli queries in a single request and handling the responses. This often greatly improve performance by removing the round-trip-time, which is most noticeable when the database is on a remote host.
Example Usage
Basic Example
Full Example
In the example below we run lots of different queries and use the index we get when we added the query in order to get it's result from the multiQuery object later. We also demonstrate how to check that nothing went wrong by checking the status of the object after having run it.
Merged Result Example
If you have partitioned your data using separate tables (e.g. the tables all have the same structure), then you may want to make use of the get_merged_result() method to just stitch all the query results into one
Transactions
This package also has a class to help with making MySQL transactions. Below is an example of using this class:
The transaction will automatically detect and rollback if any of the queries within the transaction object fail. By default, if the transaction fails the object will not retry, but you can configure it to do so. Below is the same example, but this time we have set it to retry up to 5 times when the transaction is run, and to wait 3 seconds between each attempt. The default for the sleep period if you do not set it, is 1 second.
All versions of multi-query with dependencies
ext-mysqli Version *