| GNOME Data Access 4.0 manual | ||||
|---|---|---|---|---|
GdaPModelGdaPModel — Proposed base implementation for data models returned by the execution of a SELECT statement |
#include <providers-support/gda-pmodel.h>
GdaPModel;
GdaPModelClass;
void gda_pmodel_take_row (GdaPModel *model,
GdaPRow *row,
gint rownum);
GdaPRow* gda_pmodel_get_stored_row (GdaPModel *model,
gint rownum);
GdaConnection* gda_pmodel_get_connection (GdaPModel *model);
gboolean gda_pmodel_set_modification_query (GdaPModel *model,
GdaStatement *mod_stmt,
GError **error);
gboolean gda_pmodel_compute_modification_queries
(GdaPModel *model,
const gchar *target,
gboolean use_all_fields_if_no_pk,
GError **error);
This data model implements the GdaDataModel interface and is the proposed base object when database providers implement a data model returned when a SELECT statement has been executed.
Specifically it offers the following features:
See the Virtual methods for recordsets section for more information about how to implement the virtual methods.
typedef struct {
GObject object;
GdaPModelPrivate *priv;
/* read only information */
GdaPStmt *prep_stmt; /* use the "prepared-stmt" property to set this */
gint nb_stored_rows; /* number of GdaPRow objects currently stored */
gint advertized_nrows; /* set when the number of rows becomes known */
GdaConnection *cnc;
} GdaPModel;
GObject |
base object |
GdaPModelPrivate * |
private data |
GdaPStmt * |
SELECT prepared statement for which the execution gave this object |
gint |
|
gint |
initially set to -1, set to a value >= 0 when the number of rows in the data model is known |
GdaConnection * |
typedef struct {
GObjectClass parent_class;
/* GDA_DATA_MODEL_ACCESS_RANDOM */
gint (*fetch_nb_rows) (GdaPModel *model);
gboolean (*fetch_random) (GdaPModel *model, GdaPRow **prow, gint rownum, GError **error);
gboolean (*store_all) (GdaPModel *model, GError **error);
/* GDA_STATEMENT_MODEL_CURSOR_* */
gboolean (*fetch_next) (GdaPModel *model, GdaPRow **prow, gint rownum, GError **error);
gboolean (*fetch_prev) (GdaPModel *model, GdaPRow **prow, gint rownum, GError **error);
gboolean (*fetch_at) (GdaPModel *model, GdaPRow **prow, gint rownum, GError **error);
} GdaPModelClass;
GObjectClass |
parent object class |
|
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM |
|
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_RANDOM |
|
|
|
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD |
|
virtual method which must be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD |
|
virtual method which can be implemented when access method is GDA_DATA_MODEL_ACCESS_CURSOR_FORWARD or GDA_DATA_MODEL_ACCESS_CURSOR_BACKWARD |
void gda_pmodel_take_row (GdaPModel *model, GdaPRow *row, gint rownum);
Stores row into model, externally advertized at row number rownum. The reference to
row is stolen.
GdaPRow* gda_pmodel_get_stored_row (GdaPModel *model, gint rownum);
Get the GdaPRow object stored within model at row rownum
GdaConnection* gda_pmodel_get_connection (GdaPModel *model);
Get a pointer to the GdaConnection object which was used when model was created
(and which may be used internally by model).
|
a GdaPModel data model |
Returns : |
a pointer to the GdaConnection, or NULL
|
gboolean gda_pmodel_set_modification_query (GdaPModel *model, GdaStatement *mod_stmt, GError **error);
Forces model to allow data modification using mod_stmt as the statement executed when the corresponding
modification is requested
|
a GdaPModel data model |
|
a GdaStatement (INSERT, UPDATE or DELETE) |
|
a place to store errors, or NULL
|
Returns : |
TRUE if no error occurred. |
gboolean gda_pmodel_compute_modification_queries
(GdaPModel *model,
const gchar *target,
gboolean use_all_fields_if_no_pk,
GError **error);
Makes model try to compute INSERT, UPDATE and DELETE statements to be used when modifying model's contents
|
a GdaPModel data model |
|
the name of the target to modify (a table name or alias) |
|
set to TRUE if all fields must be used in the WHERE condition when no primary key exists |
|
a place to store errors, or NULL
|
Returns : |
TRUE if no error occurred. |