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

## SYNOPSIS

1. query:reset()
2. query:unbind()

## DESCRIPTION

The function sql:reset() resets a finished query, so it can be run again. The query will be reset to the state right before the call to sql:exec().

All bound values are still bound. However, it is perfectly legal to bind new values to the query before executing it again. You can also call sql:unbind() to remove all bound values prior to starting over.

Reusing a query in this manner saves the time needed to parse the SQL statement into machine code.

## RETURN VALUE

On success, both functions return true. On failure, they return 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:exec, sql:next, sql:value, sql:finish