slStmExecAll

Executes an SQL statement returning a complete result set.

Syntax:

slStmExecAll ( stm-handle [, options] )

Parameters:

(s) stm-handle: SQLite extender statement object handle.

(i) options: [optional] (@slheader|@slRankOne|@slWILTypes) modifies returned contents. See below.

Returns:

(a) result-set: A one or two dimension array or an empty array.

The stStmExecAl function executes a prepared SQL statement obtained by a call to the  slStatement extender function. The function returns all rows of the result set produced by the statement's execution. The passed in statement is automatically resets to its initial state after the function has collected the results.

 

Stm-Handle

The unique identifier representing  a handle to a prepared SQL statement returned from a call to the slStatement function.

  

Options

An optional parameter modifies the function return content. The @slWILTypes option can be combined with the @slHeader or @SlRankOne option using the bit-wise or (|) operator.

Option

Meaning

@slHeader

Use this option to have the function return column names in the first row of the returned array.

@SlRankOne

This option causes the functions return a one dimension (rank one)  array when the statement object's result set contains only one row . If this option is not used a single-row result set requires using to dimension (rank two) array syntax to access the column values of the single row. This option is ignored if the @slHeader option is also used.

@slWILTypes

Causes the returned array to contain array values converted from text to native WIL variable types..  Since SQLite and WIL are both type-flexible, the only significant effect of this option is that SQLite BLOB data is returned in a binary buffer. This makes BLOB values easier to processes under certain conditions but also requires you to either copy or free the binary buffer handle after you have finished with array elements that contain binary buffer handles.

 

Important: there is a limit to the number of binary buffer handles available so do not use this option when an SQL query can potentially return a large number of rows containing BLOB data..  

 

Example:
AddExtender('ilcsl44i.dll', 0, 'ilcsl64i.dll')
; Create a db object handle to Northwind DB
db = slConnect("C:\Examples\northwind.db")
SQL = "SELECT UnitPrice, Quantity, Discount FROM [Order Details] WHERE UnitPrice > ?1;"
; Get a handle to the statement's object
uprice[0] = 100
stm = slStatement(db, SQL, uprice)
; Run the query
rset = slStmExecAll(stm, @slHeader)
; Display the results
SQLiteExFormat=`WWWDLGED,6.2`
SQLiteExCaption=`SlStmExecAll Example`
SQLiteExX=470
SQLiteExY=203
SQLiteExWidth=457
SQLiteExHeight=325
SQLiteExNumControls=003
SQLiteExProcedure=`DEFAULT`
SQLiteExFont=`DEFAULT`
SQLiteExTextColor=`DEFAULT`
SQLiteExBackground=`DEFAULT,DEFAULT`
SQLiteExConfig=0
SQLiteExDPI=`216,10,20`
SQLiteEx001=`198,295,057,019,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
SQLiteEx002=`007,047,443,235,REPORTVIEW,"ResultSet",rset,DEFAULT,DEFAULT,20,@csFirstHeader,DEFAULT,DEFAULT,DEFAULT`
SQLiteEx003=`025,018,411,019,STATICTEXT,"StaticText_1",DEFAULT,"NorthWind database query results",DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
ButtonPushed=Dialog("SQLiteEx")
slClose()
See Also:

slConnect,  slStatementslStmExecslStmExecManyslStmReset