Database[SQLite] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

Database[SQLite]

  

Step

  

evaluate prepared SQL statement

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

Prepare( statement )

Parameters

statement

-

prepared statement obtained using Prepare command

Description

• 

The Evaluate command evaluates the prepared SQL statement.

• 

Possible return values are:

– 

RESULT_BUSY means that the database engine was unable to acquire the database locks it needs to do its job. If the statement is a COMMIT or occurs outside of an explicit transaction, then you can retry the statement. If the statement is not a COMMIT and occurs within an explicit transaction then you should rollback the transaction before continuing.

– 

RESULT_DONE means that the statement has finished executing successfully. Step should not be called again on this prepared statement without first calling Reset to reset the statement back to its initial state.

– 

RESULT_ROW is returned each time a new row of data is ready for processing. The values may be accessed using the Fetch or FetchRow commands. Call Step again to retrieve the next row of data.

Examples

withDatabaseSQLite

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

(1)

Create in memory database

dbOpen:memory::

Create table test with on column val1

Executedb,CREATE TABLE test (val1)

Insert sample data - prepare statement

stmtPreparedb,INSERT INTO test VALUES ('row1'), ('row2'), ('row3')

stmtSQLite statement,INSERT INTO test VALUES ('row1'), ('row2'), ('row3')

(2)

Execute the statement

Stepstmt:

Finalize the statement

Finalizestmt:

Select data from table - prepare statement

stmtPreparedb,SELECT * FROM test

stmtSQLite statement,SELECT * FROM test

(3)

Evaluate the statement to get the first row

Stepstmt:

Get value

Fetchstmt,0

row1

(4)

Evaluate statement to get the next row

Stepstmt:

Get value

Fetchstmt,0

row2

(5)

Evaluate the statement to the next row

Stepstmt:

Get value

Fetchstmt,0

row3

(6)

Finalize the statement

Finalizestmt:

Close database connection

Closedb:

Compatibility

• 

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