dbPoll | Multi Theft Auto: Wiki Skip to content

dbPoll

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function checks the progress of a database query.

Note

If a column contained a number it is returned as a number, this includes things which were stored as string but are numbers such as "1" would be returned as 1.

Important

It is strongly recommended to use this function in callback, as presented in "This example shows how to obtain data without server freeze."

OOP Syntax Help! I don't understand this!

Syntax

table dbPoll ( handle queryHandle, int timeout, [ bool multipleResults = false ] )
Required Arguments
  • queryHandle: A query handle previously returned from dbQuery
  • timeout: How many milliseconds to wait for a result. Use 0 for an 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 executeSQLQuery
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • multipleResults (default: false): Set to true to enable the return values from multiple queries

Returns

  • table: value

The table is of the format:

Code Examples

shared

This example waits until a result is ready:

local result = dbPoll ( qh, -1 )