nanos world API Reference Unofficial documentation
Function Server Fast

Database:SelectAsync

Execute a select query asynchronously

Syntax

Lua
my_database:SelectAsync(query, callback = nil, parameters... = nil)

Parameters

Name Type Default Description
query string Query to execute
callback optional function nil Callback
Callback signature function(rows, error)
  • rows table[] All rows returned by the query
  • error string? Error message, if got error
parameters... optional any nil Sequence of parameters to escape into the Query

Examples

Selects from a table asynchronously (SQLite)
my_database:SelectAsync("SELECT * FROM MyTable WHERE name = :0 AND title = :1", function(rows)
	Console.log(NanosTable.Dump(rows))
end, "Val", "AnotherVal")