a #GdaStatement object
a #GdaSet object (which can be obtained using gda.statement.Statement.getParameters), or null
in the case where stmt is a SELECT statement, specifies how the returned data model will be used
a place to store a new #GdaSet object which contains the values of the last inserted row, or null
a #GObject, or null if an error occurred
Executes stmt.
As stmt can, by design (and if not abused), contain only one SQL statement, the return object will either be: <itemizedlist> <listitem><para>a #GdaDataSelect object (which is also a #GdaDataModel) if stmt is a SELECT statement (usually a GDA_SQL_STATEMENT_SELECT, see #GdaSqlStatementType) containing the results of the SELECT. The resulting data model is by default read only, but modifications can be enabled, see the #GdaDataSelect's documentation for more information.</para></listitem> <listitem><para>a #GdaSet for any other SQL statement which correctly executed. In this case (if the provider supports it), then the #GdaSet may contain value holders named: <itemizedlist> <listitem><para>a (gint) #GdaHolder named "IMPACTED_ROWS"</para></listitem> <listitem><para>a (GObject) #GdaHolder named "EVENT" which contains a #GdaConnectionEvent</para></listitem> </itemizedlist></para></listitem> </itemizedlist>
If last_insert_row is not null and stmt is an INSERT statement, then it will contain (if the provider used by cnc supports it) a new #GdaSet object composed of value holders named "+<column number>" starting at column 0 which contain the actual inserted values. For example if a table is composed of an 'id' column which is auto incremented and a 'name' column then the execution of a "INSERT INTO mytable (name) VALUES ('joe')" query will return a #GdaSet with two holders: <itemizedlist> <listitem><para>one with the '+0' ID which may for example contain 1 (note that its "name" property should be "id")</para></listitem> <listitem><para>one with the '+1' ID which will contain 'joe' (note that its "name" property should be "name")</para></listitem> </itemizedlist>
This method may fail with a GDA_SERVER_PROVIDER_ERROR domain error (see the #GdaServerProviderError error codes).
Note1: If stmt is a SELECT statement which has some parameters and if params is null, then the statement can't be executed and this method will return null.
Note2: If stmt is a SELECT statement which has some parameters and if params is not null but contains some invalid parameters, then the statement can't be executed and this method will return null, unless the model_usage has the GDA_STATEMENT_MODEL_ALLOW_NOPARAM flag.
Note3: If stmt is a SELECT statement which has some parameters and if params is not null but contains some invalid parameters and if model_usage has the GDA_STATEMENT_MODEL_ALLOW_NOPARAM flag, then the returned data model will contain no row but will have all the correct columns (even though some of the columns might report as GDA_TYPE_NULL). In this case, if (after this method call) any of params' parameters change then the resulting data model will re-run itself, see the GdaDataSelect's <link linkend="GdaDataSelect--auto-reset">auto-reset</link> property for more information.
Note4: if model_usage does not contain the GDA_STATEMENT_MODEL_RANDOM_ACCESS or GDA_STATEMENT_MODEL_CURSOR_FORWARD flags, then the default will be to return a random access data model
Note5: If stmt is a SELECT statement which returns blob values (of type GDA_TYPE_BLOB), then an implicit transaction will have been started by the database provider, and it's up to the caller to close the transaction (which will then be locked) once all the blob ressources have been liberated (when the returned data model is destroyed). See the section about <link linkend="gen:blobs">Binary large objects (BLOBs)</link> for more information.
Also see the <link linkend="limitations">provider's limitations</link>, and the <link linkend="data-select">Advanced GdaDataSelect usage</link> sections.