NextResult - Maple Help

Statement

 NextResult
 retrieve the next result of a multiple statement execute

 Calling Sequence statement:-NextResult( )

Parameters

 statement - Statement module

Description

 • NextResult tries to retrieve the next result from statement. If no results are available, it returns NULL.
 • If a result is available, it will either be an integer corresponding to an update statement, or a Result module corresponding to a query statement.
 • To issue a multi-statement SQL string, the Execute command must be used.
 • Some databases may require that the processing of the current result be completed before the next result is returned by NextResult.

Examples

 > $\mathrm{driver}≔\mathrm{Database}\left[\mathrm{LoadDriver}\right]\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$$\mathrm{stat}≔\mathrm{conn}:-\mathrm{CreateStatement}\left(\right):$

Execute some statements.

 > $\mathrm{res}≔\mathrm{stat}:-\mathrm{Execute}\left("SELECT name FROM animals WHERE id = 1; INSERT INTO\nanimals\left( id, name, number, mass \right) VALUES\left( 14, \text{'}boar\text{'}, 10, 60.67 \right); SELECT name FROM animals WHERE id = 3;"\right):$

Check the value.

 > $\mathrm{res}:-\mathrm{Next}\left(\right);$$\mathrm{res}:-\mathrm{GetData}\left("name"\right)$
 ${"fish"}$ (1)

Get the next result.

 > $\mathrm{stat}:-\mathrm{NextResult}\left(\right)$
 ${1}$ (2)

Now the last result.

 > $\mathrm{res}≔\mathrm{stat}:-\mathrm{NextResult}\left(\right):$$\mathrm{res}:-\mathrm{Next}\left(\right):$$\mathrm{res}:-\mathrm{GetData}\left("name"\right)$
 ${"cat"}$ (3)

Check for more results.

 > $\mathrm{stat}:-\mathrm{NextResult}\left(\right)$

NULL returned, no more results in this Statement Module.