Executes stmt
.
As stmt
can, by design (and if not abused), contain only one SQL statement, the return object will either be:
stmt
is a SELECT statement (usually a
GDA_SQL_STATEMENT_SELECT, see SqlStatementType) containing the results of the
SELECT. The resulting data model is by default read only, but modifications can be enabled, see the
DataSelect's documentation for more information.If last_insert_row
is not null
and stmt
is an INSERT statement, then it will contain (if the
provider used by this supports it) a new Set 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 Set with two holders:
This method may fail with a ServerProviderError domain error (see the ServerProviderError 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 auto-reset 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 Binary
large objects (BLOBs) for more information.
Also see the provider's limitations, and the Advanced GdaDataSelect usage sections.
this | |
stmt |
a Statement object |
model_usage |
in the case where |
last_insert_row |
a place to store a new Set object which contains the values of the last inserted row, or
|
params |
a Set object (which can be obtained using
get_parameters), or |
a Object, or |