Database[SQLite] - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

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

Database[SQLite]

 Bind
 bind value to a parameter in prepared statement

 Calling Sequence Bind( statement, parameter, value, valuetype )

Parameters

 statement - prepared statement obtained using Prepare command

Description

 • The Bind command resets value bindings for parameters in prepared SQL statement.
 • parameter is the index of the SQL parameter to be set. The leftmost SQL parameter has an index of 1.
 • See the Database[SQLite] for more information about type conversion between SQLite and Maple.

Examples

 > $\mathrm{with}\left({\mathrm{Database}}_{\mathrm{SQLite}}\right):$
 > $\mathrm{connection}≔\mathrm{Open}\left(":memory:"\right):$
 > $\mathrm{Execute}\left(\mathrm{connection},"CREATE TABLE test \left(val\right)"\right):$
 > $\mathrm{stmt}≔\mathrm{Prepare}\left(\mathrm{connection},"INSERT INTO test VALUES \left(?\right)"\right)$
 ${\mathrm{stmt}}{≔}{"SQLite statement"}{,}{"INSERT INTO test VALUES \left(?\right)"}$ (1)
 > $\mathrm{Bind}\left(\mathrm{stmt},1,"value 1"\right)$
 > $\mathrm{Step}\left(\mathrm{stmt}\right):$
 > $\mathrm{Finalize}\left(\mathrm{stmt}\right):$
 > $\mathrm{stmt}≔\mathrm{Prepare}\left(\mathrm{connection},"SELECT * FROM test"\right)$
 ${\mathrm{stmt}}{≔}{"SQLite statement"}{,}{"SELECT * FROM test"}$ (2)
 > $\mathrm{FetchAll}\left(\mathrm{stmt}\right)$
 $\left[\begin{array}{c}{"value 1"}\end{array}\right]$ (3)
 > $\mathrm{Finalize}\left(\mathrm{stmt}\right):$
 > $\mathrm{Close}\left(\mathrm{connection}\right):$

Compatibility

 • The Database[SQLite][Bind] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also