Database[SQLite] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

Database[SQLite]

  

FetchAll

  

fetch all rows

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

FetchAll( statement, header, valuetype  )

Parameters

statement

-

prepared statement obtained using Prepare command

header

-

return column names in first row of the output, default is false

valuetype

-

type of the output data, 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.

• 

If valuetype is a string then the type conversion it specifies applies to all columns.

• 

If valuetype is a list of strings then type of column is determined by a corresponding entry in the list.

• 

See the Database[SQLite] for more information about type conversion between SQLite and Maple.

Examples

withDatabase[SQLite]

Attach,Bind,ClearBindings,Close,ColumnCount,ColumnNames,Execute,Fetch,FetchAll,FetchRow,Finalize,Open,Opened,Prepare,RESULT_BUSY,RESULT_DONE,RESULT_ROW,Reset,Step

(1)

dbFileTools[JoinPath]kernelopts'datadir',SQLite,G20-Population.db:

connectionOpendb:

Select all data from table - prepare statement

stmtPrepareconnection,SELECT * FROM population

stmtSQLite statement,SELECT * FROM population

(2)

Fetch all rows

FetchAllstmt

53 x 21 MatrixData Type: anythingStorage: rectangularOrder: C_order

(3)

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

(4)

Fetch all rows with column names

FetchAllstmt,'header'=true

DateCAN1960-12-311.79090091071961-12-311.82710001071962-12-311.86140001071963-12-311.89640001071964-12-311.9325000107

(5)

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

(6)

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]