| Home | How To | Online Documentation | Support | Download | Order |
|
|
A SACommand object defines a specific command that you intend to execute against a data source.
A SACommand object may be used to query a database and return records, insert or update data, to manipulate the structure of a database, or to run a stored procedure. With the methods of a SACommand object you can do the following:
You can construct command based on the given connection, or with no associated SAConnection object using appropriate SACommand constructor. If you create new command with no connection, you need to use setConnection method before executing any other SACommand methods. To set command text use setCommandText method. If the command has parameters, a set of SAParam objects creates implicitly. You can get the number of parameters with ParamCount method and look them through (and assign) with Param and ParamByIndex methods. Values for the input parameters can also be supplied by operator <<. To prepare a command use Prepare method. If you will not prepare a command it will be prepared implicitly before execution. If needed a command will be implicitly opened. If, for some reason, you want to open a command explicitly use Open method. To execute a command use Execute method. A command will be implicitly closed in destructor. If, for some reason, you want to close a command explicitly use Close method. To test whether a command is opened use isOpened method. A command (an SQL statement or procedure) can have a result set after executing. To check whether a result set exists use isResultSet method. If result set exists, a set of SAField objects created implicitly. SAField object contains full information about a field (name, type, size, etc.) and a field's value after fetching a row (FetchNext method). You can get the number of fields with FieldCount method and look them through with Field method or operator [] . If command has output parameters, you can get them after a command execution using Param and ParamByIndex methods. 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. |
|||||||||||||||||