Home Contents | # sql:exec | Sql | Core4 Lua Commands

## SYNOPSIS

1. query:exec()
2. query:exec(statement)

## DESCRIPTION

The first form executes a SQL statement that has been previously prepared with sql:prepare().

The second form is synonymous with this:

function exec(query, statement) if (not query:prepare(statement)) then return nil end return query:exec() end

When a SELECT statement has executed successfully, the returned data is iterated with sql:next().

## RETURN VALUE

On success, returns true. On failure, returns nil. In case of an error, the error can be retrieved by calling sql:lastError() on the parent database handle.

## SEE ALSO

sql:bind, sql:prepare, sql:next, sql:value, sql:reset, sql:finish