Database[SQLite] - Maple Programming Help

Home : Support : Online Help : Connectivity : Database Package : SQLite : Database/SQLite/Reset

Database[SQLite]

 Reset
 reset prepared statement

 Calling Sequence Reset( statement, clear )

Parameters

 statement - prepared statement obtained using Prepare command clear - clear all bound values, default is false

Description

 • The Reset command resets the prepared SQL statement so that it can be executed again.
 • When clear = true is passed, ClearBindings is also called after the statement is reset.

Examples

 > $\mathrm{with}\left(\mathrm{Database}\left[\mathrm{SQLite}\right]\right)$
 $\left[{\mathrm{Attach}}{,}{\mathrm{Bind}}{,}{\mathrm{ClearBindings}}{,}{\mathrm{Close}}{,}{\mathrm{ColumnCount}}{,}{\mathrm{ColumnNames}}{,}{\mathrm{Execute}}{,}{\mathrm{Fetch}}{,}{\mathrm{FetchAll}}{,}{\mathrm{FetchRow}}{,}{\mathrm{Finalize}}{,}{\mathrm{Open}}{,}{\mathrm{Opened}}{,}{\mathrm{Prepare}}{,}{\mathrm{RESULT_BUSY}}{,}{\mathrm{RESULT_DONE}}{,}{\mathrm{RESULT_ROW}}{,}{\mathrm{Reset}}{,}{\mathrm{Step}}\right]$ (1)
 > $\mathrm{db}≔\mathrm{FileTools}\left[\mathrm{JoinPath}\right]\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"SQLite","G20-Population.db"\right]\right):$
 > $\mathrm{connection}≔\mathrm{Open}\left(\mathrm{db}\right):$

Select data from table - prepare statement

 > $\mathrm{stmt}≔\mathrm{Prepare}\left(\mathrm{connection},"SELECT * FROM population"\right)$
 ${\mathrm{stmt}}{≔}{"SQLite statement"}{,}{"SELECT * FROM population"}$ (2)

Fetch all rows

 > $\mathrm{FetchAll}\left(\mathrm{stmt}\right)$
  (3)

Reset the statement and select data again

 > $\mathrm{Reset}\left(\mathrm{stmt}\right):$
 > $\mathrm{FetchAll}\left(\mathrm{stmt}\right)$
  (4)
 > $\mathrm{Finalize}\left(\mathrm{stmt}\right):$
 > $\mathrm{Close}\left(\mathrm{connection}\right):$

Compatibility

 • The Database[SQLite][Reset] command was introduced in Maple 18.