Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Back  Login

Gda::Command Diff - Ruby-GNOME2 Project Website

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

= class Gda::Command
The Gda::Command object holds data needed to issue a command to the
providers. Applications usually create a Gda::Command (via
Gda::Command.new), set its properties and pass it over to the database using
the Gda::Connection methods.

One interesting thing about Gda::Command's is that they can be reused over
and over. That is, applications don't need to create a command every time
they want to run something on the connected database. Moreover, the ability
to create command strings with placeholders allows the use of parameters to
specify the values for those placeholders. Thus, an application can create
a command of the form:

INSERT INTO employees VALUES (id, name, address, salary)

and reuse the same command over and over, just using different values for
the placeholders.

The value for the placeholders is specified when sending the Gda::Command
to a database connection, which is done via the
Gda::Connection#execute_command method.

== Object Hierarchy
* Object
  * GLib::Boxed
    * Gda::Command

== Class Methods
--- Gda::Command.new(text, type, options=Gda::Command::OPTION_STOP_ON_ERRORS)
    Creates a new Gda::Command from the parameters.  If there are conflicting
    options, this will set options to Gda::Command::DEFAULT_OPTION.
    * options: options for the command (see ((<GdaCommandOptions|Gda::Command#GdaCommandOptions>))).  
    * text: text of the command.
    * type: type of the command (see ((<GdaCommandType|Gda::Command#GdaCommandType>))).
    * Returns: a newly allocated Gda::Command object.

== Instance Methods
--- command_type
    This method returns the command type (see ((<GdaCommandType|Gda::Command#GdaCommandType>))).
    * Returns: the command type (see ((<GdaCommandType|Gda::Command#GdaCommandType>))).

--- command_type=(type)
    Sets the command type.
    * type: the command type (see ((<GdaCommandType|Gda::Command#GdaCommandType>))).  
    * Returns: the given parameter 'type'.

--- options
    This method returns options of the command (see ((<GdaCommandOptions|Gda::Command#GdaCommandOptions>))).
    * Returns: options of the command (see ((<GdaCommandOptions|Gda::Command#GdaCommandOptions>))).

--- options=(options)
    Sets command options.
    * options: see ((<GdaCommandOptions|Gda::Command#GdaCommandOptions>)).  
    * Returns: the given parameter 'options'.

--- set_command_type(type)
    Sets the command type.
    * type: the command type (see ((<GdaCommandType|Gda::Command#GdaCommandType>))).  
    * Returns: self.

--- set_options(options)
    Sets command options.
    * options: see ((<GdaCommandOptions|Gda::Command#GdaCommandOptions>)).  
    * Returns: self.

--- set_text(text)
    Sets the text of the command.
    * text: the command text.  
    * Returns: self.

--- set_transaction(xaction)
    Sets the GdaTransaction associated with the command.
    * xaction: a Gda::Transaction object.  
    * Returns: self.

--- text
    This method returns the text of the command.
    * Returns: the text of the command.

--- text=(text)
    Sets the text of the command.
    * text: the command text.  
    * Returns: the given parameter 'text'.

--- to_s
    Synonym for Gda::Command#text.
    * Returns: the text of the command.

--- transaction
    This method returns the Gda::Transaction object associated with the command.
    * Returns: the Gda::Transaction object associated with the command.

--- transaction=(xaction)
    Sets the GdaTransaction associated with the command.
    * xaction: a Gda::Transaction object.  
    * Returns: the given parameter 'xaction'.

== Constants
=== GdaCommandOptions
--- OPTION_BAD_OPTION
--- OPTION_IGNORE_ERRORS
--- OPTION_STOP_ON_ERRORS

=== GdaCommandType
--- TYPE_INVALID
--- TYPE_PROCEDURE
--- TYPE_SCHEMA
--- TYPE_SQL
--- TYPE_TABLE
--- TYPE_XML

== See Also
((<Gda>)).

- ((<lrz>))