Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

(click on this box to dismiss)

What is the difference between synchronous and asynchronous modes in PHP cubrid_execute()?

In cubrid_execute() documentation is says that the developer can specify which mode to use: either synchronous or asynchronous. What is the difference between them and how they affect the performance?
link comment (0) accepted answer
asked 2 years ago
6 Answers

Hello eye!

  1. Synchronous and asynchronous modes apply only for prepared queries.
  2. Synchronous and asynchronous modes apply only to SELECT queries as in this type of queries only you retrieve the data.

Considering the above statements, if the parameter is set to CUBRID_EXEC_QUERY_ALL, which is the default option, a synchronous mode (sync_mode) is used to retrieve query results immediately after executing ALL prepared queries. In other words, in sync_mode the server will execute ALL your queries without returning any data, and only after all of them are executed, you can go through the resultset.

Also in case CUBRID_EXEC_QUERY_ALL is set, the following rules are applied.

  • The return value is the result of the first query.
  • If an error occurs in any query, the execution is processed as a failure.
  • In a query composed of q1, q2, q3, if an error occurs in q2 after q1 succeeds in execution, the result of q1 remains valid. That is, the previous successful query executions are not rolled back when an error occures.
  • If a query is executed successfully, the result of the second query can be obtained using cubrid_next_result().

On the other hand, if CUBRID_ASYNC is set, an asynchronous mode (async_mode) is used. In this case the results will be retrieved immediately each time cubrid_execute() is called.

Hope this answer will help you!

link comment (0)
answered 2 years ago

You are either using a very old browser or a browser that is not supported.
In order to browse you need to have one of the following browsers:

Internet Explorer: Mozilla Firefox: Google Chrome: