Fetch - Maple Help

Online Help

All Products    Maple    MapleSim


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

Database[SQLite]

  

Fetch

  

fetch value of a single column from a prepared SQL statement

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Fetch( statement, column, opts )

Parameters

statement

-

prepared SQL statement obtained using the Prepare command

column

-

nonnegint; index of the column

opts

-

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

Options

• 

valuetype = string

  

The valuetype option specifies the type of the value. It may be one of the strings "auto", "blob", "float", "integer", or "text". See the Database[SQLite] help page for more information about type conversion between SQLite and Maple. The default is "auto".

Description

• 

The Fetch command returns the value of a column for the current row.

• 

The column parameter specifies the column index; the leftmost column has index 0.

Examples

withDatabaseSQLite:

dbFileToolsJoinPathkerneloptsdatadir,SQLite,G20-Population.db:

connectionOpendb:

Select all data from table - prepare statement

stmtPrepareconnection,SELECT date, CAN FROM population LIMIT 1

stmtSQLite statement,SELECT date, CAN FROM population LIMIT 1

(1)

Stepstmt:

Fetch the first column

Fetchstmt,0

1960-12-31

(2)

Fetch the second column

Fetchstmt,1

1.7909009×107

(3)

Resetstmt

Fetch both columns using all possible values for valuetype option

forvtinauto,blob,float,integer,textdoStepstmt;printvt,Fetchstmt,0,valuetype=vt;printvt,Fetchstmt,1,valuetype=vt;Resetstmtenddo

auto,1960-12-31

auto,1.7909009×107

blob,49575448454950455149

blob,49555748574848574648

float,1960.

float,1.7909009×107

integer,1960

integer,17909009

text,1960-12-31

text,17909009.0

(4)

Finalizestmt:

Closeconnection:

Compatibility

• 

The Database[SQLite][Fetch] 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]