DbPoll: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} {{New feature|3.0120|1.2| '''Available only in MTA SA 1.1.1 r3328 and onwards''' }} This function checks the progress of a database query. ==Synta...")
 
No edit summary
Line 13: Line 13:
===Required Arguments===
===Required Arguments===
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]
*'''queryHandle:''' A query handle previously returned from [[dbQuery]]
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for and instant response (which may return nil). Use -1 to wait forever.
*'''timeout:''' How many milliseconds to wait for a result. Use 0 for and instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions


===Returns===
===Returns===

Revision as of 17:54, 26 October 2011

Available only in MTA SA 1.1.1 r3328 and onwards This function checks the progress of a database query.

Syntax

table dbPoll ( handle queryHandle, int timeout )

Required Arguments

  • queryHandle: A query handle previously returned from dbQuery
  • timeout: How many milliseconds to wait for a result. Use 0 for and instant response (which may return nil). Use -1 to wait until a result is ready. Note: A wait here will freeze the entire server just like the executeSQL* functions

Returns

  • nil: Returns nil if the query results are not yet ready. You should try again in a little while. (If you give up waiting for a result, be sure to call dbFree)
  • false: Returns false if the query handle is incorrect.
  • table: Returns a table when the results are ready. This automatically frees the query handle, so you do not have to call dbFree.

Example

This example waits until a result is ready

local result = dbPoll ( qh, -1 )

Requirements

Minimum server version 1.1.1-9.03328
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.1.1-9.03328" />

See Also