![]() | ![]() | ![]() | libgda API reference | ![]() |
---|
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);
GdaCommand * gda_command_new (void);
This function allocates the memory for a command object.
Returns : | a pointer to the command object |
void gda_command_free (GdaCommand *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. |
GdaConnection * gda_command_get_connection (GdaCommand *cmd);
Returns the
cmd : | the command object |
Returns : | a pointer to the |
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.
cmd : | The command object |
cnc : | The connection object |
gchar * gda_command_get_text (GdaCommand *cmd);
Gets the command string which is executed when the gda_command_execute()
function is called.
cmd : | the |
Returns : | a reference to the command string. |
void gda_command_set_text (GdaCommand *cmd,gchar *text);
Sets the command which is executed when the gda_command_execute()
function is called.
cmd : | the |
text : | the command to perform. There are some special texts which are reckognized by the servers. See the server documantation for a list of special commands. |
GDA_CommandType gda_command_get_cmd_type (GdaCommand *cmd);
Gets the type of the command
cmd : | the |
Returns : | the type of the command |
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.
cmd : | the |
type : | the type of the command. See the provider specification which command type is understood and the semantics of the different types. |
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
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. |
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
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 inoput
parameter is 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 |
<<< GdaBatch | GdaConnectionPool >>> |