Multiple ordered SQL queries
I checked all topic related to MySQL queries but I didn't find out how to solve my problem.
How can I make 3-4 SQL threaded queries but they should run in exact order: 1. Query 1 -> give results 2. Query 2 -> give results ... Query 2 should be executed after I get all results from query 1. I can make something like this: Code:
SQL_TQuery(hdatabase, Q1Res, query1, userid); Is there any other solution how to solve it? |
Re: Multiple ordered SQL queries
Quote:
Essentially, the threaded versions are there so you don't have to wait for a response from the database before you continue execution. |
Re: Multiple ordered SQL queries
IIRC MySQL allows you to chain queries separating them by ;
|
Re: Multiple ordered SQL queries
Quote:
Quote:
|
Re: Multiple ordered SQL queries
Quote:
|
Re: Multiple ordered SQL queries
SM MYSQL EXTENSION does NOT do concurrent requests. that is
function(){ threadedquery1 threadedquery2 threadedquery3 threadedquery4 threadedquery5 to a different database } Query 1 will always finish before query 2...etc. Even if they are different database connections. The extension basically has 1 thread, looks at the pending queries, takes the top one, waits for it to return and calls the results callback function on the next game frame. Rinse and repeat. The queue has priority, so just keep all your sequential queries the same priority. MYSQL queries are also limited to a max of 10 / second (arbitrary? limit set by dvander) |
Re: Multiple ordered SQL queries
So it will alway s be like:
function(){ threadedquery1 callback query1 threadedquery2 callback query2 threadedquery3 callback query3 threadedquery4 callback query4 threadedquery5 to a different database callback query5 } For me its important that "threadedquery2" should run after whole code in "callback query1" executes. Limit is 10/sec not 20/sec ? |
Re: Multiple ordered SQL queries
Quote:
|
Re: Multiple ordered SQL queries
Quote:
threadedquery1 threadedquery2 threadedquery3 threadedquery4 threadedquery5 to a different database } function completes immediately because all these queries are queued into another thread. The whole purpose of threaded queries is that they do not BLOCK the function. threadquery1 callback will happen before threadquery2 can actually start. the callback is called whenever the results are returned. queries can share callbacks if your queries rely on the results of the previous query, just SQL_TQuery within the results callback. |
All times are GMT -4. The time now is 19:20. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.