Please enable JavaScript to view this site.

A-Shell Development History

 

xcall SQL, SQLOP_FETCH_GRID, cmdhdr, $grid()

Fetches entire result set—or what remains of it—into the specified gridmap $grid(). As with INPUT CSV into a gridmap, there are two variations:

In the case of gridmap(int; int; varstr), the grid is indexed by row # and column #, and the first row contains the column (field) names. (The grid will have one more row than the number of rows in the result set.)
In the case of gridmap(int; varstr; varstr), the grid is indexed by row # and column name.

The specified grid will be cleared at the start of each call.

A new cmdhdr.opflags flag, FETCH_NULLS (&h0100) may be specified to cause null fields to be returned as "NULL" instead of as "". .NULL cannot be stored in a collection since assigment of a collection key-value pair to .NULL deletes the item, so "NULL" has to be used here as a proxy.

The cmdhdr fields will be returned as they are for SQLOP_FETCH_ROW, except that info2 will contain the number of rows in the result set.