ColumnCount - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Database[SQLite]

 ColumnCount
 get number of columns in a prepared statement

 Calling Sequence ColumnCount( statement )

Parameters

 statement - prepared SQL statement obtained using the Prepare command

Description

 • The ColumnCount command returns the number of columns in a prepared statement.

Examples

 > $\mathrm{with}\left({\mathrm{Database}}_{\mathrm{SQLite}}\right):$
 > $\mathrm{db}≔{\mathrm{FileTools}}_{\mathrm{JoinPath}}\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"SQLite","G20-Population.db"\right]\right):$
 > $\mathrm{connection}≔\mathrm{Open}\left(\mathrm{db}\right):$

Select all data from table - prepare statement

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

Number of columns

 > $\mathrm{ColumnCount}\left(\mathrm{stmt}\right)$
 ${21}$ (2)

Fetch all rows

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

Compatibility

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