GdaCommand

Name

GdaCommand -- Command management

Synopsis



GdaCommand* gda_command_new                 (void);
void        gda_command_free                (GdaCommand *cmd);
GdaConnection* gda_command_get_connection   (GdaCommand *cmd);
void        gda_command_set_connection      (GdaCommand *cmd,
                                             GdaConnection *cnc);
gchar*      gda_command_get_text            (GdaCommand *cmd);
void        gda_command_set_text            (GdaCommand *cmd,
                                             gchar *text);
GDA_CommandType gda_command_get_cmd_type    (GdaCommand *cmd);
void        gda_command_set_cmd_type        (GdaCommand *cmd,
                                             GDA_CommandType type);
GdaRecordset* gda_command_execute           (GdaCommand *cmd,
                                             gulong *reccount,
                                             gulong flags);
void        gda_command_create_parameter    (GdaCommand *cmd,
                                             gchar *name,
                                             GDA_ParameterDirection inout,
                                             GDA_Value *value);

Object Hierarchy


  GtkObject
   +----GdaCommand

Description

Details

gda_command_new ()

GdaCommand* gda_command_new                 (void);

This function allocates the memory for a command object.


gda_command_free ()

void        gda_command_free                (GdaCommand *cmd);

This function frees the memory of command object and cuts the association with its connection object.


gda_command_get_connection ()

GdaConnection* gda_command_get_connection   (GdaCommand *cmd);

Returns the gda_Connection object which is used by the command.


gda_command_set_connection ()

void        gda_command_set_connection      (GdaCommand *cmd,
                                             GdaConnection *cnc);

Associates a connection with a command. All functions with this command will use the connection to talk to the data source. If the command is already associated with a connection, this association is destroyed.


gda_command_get_text ()

gchar*      gda_command_get_text            (GdaCommand *cmd);

Gets the command string which is executed when the gda_command_execute() function is called.


gda_command_set_text ()

void        gda_command_set_text            (GdaCommand *cmd,
                                             gchar *text);

Sets the command which is executed when the gda_command_execute() function is called.


gda_command_get_cmd_type ()

GDA_CommandType gda_command_get_cmd_type    (GdaCommand *cmd);

Gets the type of the command


gda_command_set_cmd_type ()

void        gda_command_set_cmd_type        (GdaCommand *cmd,
                                             GDA_CommandType type);

Sets the command which is executed when the gda_command_execute() function is called.


gda_command_execute ()

GdaRecordset* gda_command_execute           (GdaCommand *cmd,
                                             gulong *reccount,
                                             gulong flags);

This function executes the command which has been set with gda_command_set_text(). It returns a GdaRecordset pointer which holds the results from this query. If the command doesn't return any results, like insert, or updaste statements in SQL, an empty result set is returnd.


gda_command_create_parameter ()

void        gda_command_create_parameter    (GdaCommand *cmd,
                                             gchar *name,
                                             GDA_ParameterDirection inout,
                                             GDA_Value *value);

This function creates a new parameter for the command. This is important if you want to use parameterized statements like "select * from table where key = ?" and substitute the value for key at a later time. It also comes handy if you don't want to convert each parameter to it's string representation (floating point values).

The inout parameter defines if the value parameter is used to pass a value to the statement or to receive a value. In the exampel abov the input parameter will have a value of PARAM_IN. The value PARAM_OUT is used for output parameters when the command executes a precoedure.

value points to a GDA_Value variable (there will be helper functions to create such varbales from the basic C types). This variable must hold a valid value when the gda_command_execute() function is called and the inout parameter is either PARAM_IN or PARAM_INOUT. If the inoput parameter is PARAM_OUT, memory is allocated by the library and the user must free it using CORBA_free().

IMPORTANT: use the CORBA functions to allocate the memory for the value parameter if it's not a simple data type (integer, float, ...)