Method Global:WorldDBQueryAsync [-] [+]

Executes an asynchronous SQL query on the world database and passes an ElunaQuery to a callback function.

The query is executed asynchronously (i.e. the server keeps running while the query is executed in parallel, and results are passed to a callback function). If you need to execute the query synchronously, use Global:WorldDBQuery instead.

WorldDBQueryAsync("SELECT entry, name FROM creature_template LIMIT 10", function(Q)
    if Q then
        repeat
            local entry, name = Q:GetUInt32(0), Q:GetString(1)
            print(entry, name)
        until not Q:NextRow()
    end
end)

Synopsis

WorldDBQueryAsync( sql, callback )

Arguments

string sql

Query to execute.

function callback

Function that will be called when the results are available.

Returns

Nothing.

Generated on
©2016 - Eluna Lua Engine