![]() | ![]() | ![]() | GNOME Data Access manual | ![]() |
---|
It can be made, more or less, as in the old version, using <LINK>gda_command_new()</LINK>, but now, this function needs a few parameters and, in this version, you do not link a command to a connection, so you execute a command in a connection as we'll see <LINK>later</LINK>. You can see how to create commands and examples about this <LINK>here</LINK>.
<EMPHASIS>Non queries</EMPHASIS> are queries that do not return data, as insertions, deletions, and so on. The function we use is <LINK>gda_connection_execute_non_query ()</LINK> and returns the number of affected tuples or -1 in case of error. <LINK>Here</LINK> you see an example.
It is better not to execute more than one SQL sentence for each command because the result can be unexpected.
A normal query is a query that return data. This is made as a <LINK>data model</LINK>, analogous to <EMPHASIS>GdaRecordset</EMPHASIS> in the old version[5].
As you can see in the following example, the function we use to obtain data from a SQL sentence is <LINK>gda_connection_execute_single_command ()</LINK> and needs the parameters of <LINK>non queries</LINK>. The difference is that now the function returns the <LINK>data model</LINK> or <EMPHASIS>NULL</EMPHASIS> in case of error.
As in the case of <LINK>non queries</LINK>, you must not use several semicolon-separated sentences, because you have a special function to do this[6], but it is not recommended.
<< Configuration and connections | Managing data >> |