FetchAll - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Database[SQLite]

  

FetchAll

  

fetch all rows from a prepared SQL statement

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

FetchAll( statement, opts )

Parameters

statement

-

prepared SQL statement obtained using the Prepare command

opts

-

(optional) equation(s) of the form option = value; specify options for the FetchAll command

Options

• 

header = truefalse

  

True means return column names in first row of the output; default is false.

• 

valuetype = string or list(string)

  

The valuetype option specifies the type of the value. It may be one of the strings "auto", "blob", "float", "integer", "text", or a list of those strings. If a list, then the type of a column is specified by the corresponding element in the list; if a string, then it specifies the type of all columns. See the Database[SQLite] help page for more information about type conversion between SQLite and Maple. The default is "auto".

Description

• 

The FetchAll command returns all available rows from the prepared statement.

• 

There is no need to call Step after preparing the statement as FetchAll command will perform this.

Examples

withDatabaseSQLite:

dbFileToolsJoinPathkerneloptsdatadir,SQLite,G20-Population.db:

connectionOpendb:

Select all data from table - prepare statement

stmtPrepareconnection,SELECT * FROM population

stmtSQLite statement,SELECT * FROM population

(1)

Fetch all rows

FetchAllstmt

Finalizestmt:

Limit amount of data to date and population for Canada and first five rows

stmtPrepareconnection,SELECT date, CAN FROM population LIMIT 5

stmtSQLite statement,SELECT date, CAN FROM population LIMIT 5

(2)

Fetch all rows with column names

FetchAllstmt,header=true

DateCAN1960-12-311.7909009×1071961-12-311.8271000×1071962-12-311.8614000×1071963-12-311.8964000×1071964-12-311.9325000×107

(3)

Fetch the same data, but change the valuetype to "integer" for the first column and "text" for the second

Resetstmt

FetchAllstmt,header=true,valuetype=integer,text

DateCAN196017909009.0196118271000.0196218614000.0196318964000.0196419325000.0

(4)

Finalizestmt:

Closeconnection:

Compatibility

• 

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

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

Database[SQLite][Finalize]

Database[SQLite][Prepare]

Database[SQLite][Step]