gda-command

Name

gda-command — one line description goes here.

Synopsis



Gda_Command* gda_command_new                (void);
void        gda_command_free                (Gda_Command *cmd);
Gda_Connection* gda_command_get_connection  (Gda_Command *cmd);
gint        gda_command_set_connection      (Gda_Command *cmd,
                                             Gda_Connection *cnc);
gchar*      gda_command_get_text            (Gda_Command *cmd);
void        gda_command_set_text            (Gda_Command *cmd,
                                             gchar *text);
Gda_Recordset* gda_command_execute          (Gda_Command *cmd,
                                             gulong *reccount,
                                             gulong flags);
void        gda_command_create_parameter    (Gda_Command *cmd,
                                             gchar *name,
                                             GDA_ParameterDirection inout,
                                             GDA_Value *value);

Description

Details


gda_command_new()

Gda_Command* gda_command_new                (void);

This function allocates the memory for a command object.

Returns : a pointer to the command object


gda_command_free()

void        gda_command_free                (Gda_Command *cmd);

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

cmd : The command object which should be deallocated.


gda_command_get_connection()

Gda_Connection* gda_command_get_connection  (Gda_Command *cmd);

Returns the gda_Connection object which is used by the command.

cmd : the command object
Returns : a pointer to the gda_Connection object


gda_command_set_connection()

gint        gda_command_set_connection      (Gda_Command *cmd,
                                             Gda_Connection *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.

cmd : The command object
cnc : The connection object
Returns : -1 on error, 0 on success


gda_command_get_text()

gchar*      gda_command_get_text            (Gda_Command *cmd);

cmd : 
Returns : 


gda_command_set_text()

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

cmd : 
text : 


gda_command_execute()

Gda_Recordset* gda_command_execute          (Gda_Command *cmd,
                                             gulong *reccount,
                                             gulong flags);

This function executes the command which has been set with gda_command_set_text(). It returns a Gda_Recordset 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.

cmd : the command object
reccount : a pointer to a gulong variable. In this variable the number of affected records is stored.
flags : flags to categorize the command.
Returns : a pointer to a recordset or a NULL pointer if there was an error.


gda_command_create_parameter()

void        gda_command_create_parameter    (Gda_Command *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, ...)

cmd : the command object
name : the name of the parameter
inout : direction of the parameter
value : value of the parameter