| Home | How To | Online Documentation | Support | Download | Order |
|
|
Fetching multiple result setsIt is possible to process more than one result set returned from a batch or stored procedure using SQLAPI++. To execute a command and process multiple result sets you should do the following:
For example, let's fetch rows from this sample query (batch): Step 1. Creating a command object and setting a command text.To execute a command we need two objects: SAConnection (connection object) and SACommand (command object). SACommand
cmd(&Connection, The line above creates a command object cmd based on previously created and connected connection object Connection (for creating and connection Connection object see Connecting to databases ). Second parameter is our sample command text. Step 2. Binding input parameters.The Library provides several ways for binding input variables.
To get more details see Binding input parameters. Step 3. Execute the command.To execute a command use SACommand::Execute method: cmd.Execute(); Step 4. Processing the result sets.Now we have to process all result sets returned. // Process first result set // Process second result set If number of result sets is not known at compile time we can process result sets while SACommand::isResultSet returns true: int nResulSets = 0; Problems and QuestionsIf you haven't found the answer to your questions or have some problems on using the Library, please, send e-mail to howto@sqlapi.com.
|
|