Close
Close window
FetchAll - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

Database[SQLite]

FetchAll

fetch all rows from a prepared SQL statement

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

1960年12月31日1.80671000×1086.67070000×1089.2500572×1077.2814900×1074.6637746×1077.2775883×1075.2400000×1075.0199700×1071.19897000×1081961年12月31日1.83691000×1086.60330000×1089.4943000×1077.3377632×1074.7293811×1077.4988037×1075.2800000×1075.0536350×1071.21236340900000006×1081962年12月31日1.86538000×1086.65770000×1089.5832000×1077.4025784×1074.7990159×1077.7286629×1075.3250000×1075.0879450×1071.22590643400000006×1081963年12月31日1.89242000×1086.82335000×1089.6812000×1077.4714353×1074.8697015×1077.9643017×1075.3650000×1075.1252000×1071.23960074400000006×1081964年12月31日1.91889000×1086.98355000×1089.7826000×1077.5318337×1074.9361165×1078.2017016×1075.4000000×1075.1675350×1071.25344802900000006×1081965年12月31日1.94303000×1087.15185000×1089.8883000×1077.5963695×1074.9945471×1078.4379369×1075.4348050×1075.2112350×1071.26745000×1081966年12月31日1.96560000×1087.35400000×1089.9790000×1077.6600311×1075.0430631×1078.6721875×1075.4648500×1075.2519000×1071.27468492900000006×1081967年12月31日1.98712000×1087.54550000×1081.00725000×1087.6951336×1075.0829214×1078.9052356×1075.4943600×1075.2900500×1071.28196115799999997×1081968年12月31日2.00706000×1087.74510000×1081.01061000×1087.7294314×1075.1175036×1079.1377490×1075.5211700×1075.3235750×1071.28927892099999994×1081969年12月31日2.02677000×1087.96025000×1081.03172000×1087.7909682×1075.1518731×1079.3709914×1075.5441750×1075.3537950×1071.29663845500000000×10853 × 21 Matrix

(2)
>

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

(3)

Fetch all rows with column names

>

FetchAllstmt,header=true

DateCAN1960年12月31日1.7909009×1071961年12月31日1.8271000×1071962年12月31日1.8614000×1071963年12月31日1.8964000×1071964年12月31日1.9325000×107

(4)

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

(5)
>

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 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /