Reimplementado joins en el modelo
This commit is contained in:
parent
090b4124da
commit
c0f5da67ac
|
@ -76,7 +76,7 @@ DbOperation;
|
||||||
**/
|
**/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DbModel * obj;
|
DbModel * self;
|
||||||
GQueue * operations;
|
GQueue * operations;
|
||||||
SqlList * stmts;
|
SqlList * stmts;
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,6 @@ typedef struct
|
||||||
gchar * alias;
|
gchar * alias;
|
||||||
GSList * pkeys;
|
GSList * pkeys;
|
||||||
GHashTable * columns;
|
GHashTable * columns;
|
||||||
GSList * parent_columns;
|
|
||||||
GSList * child_columns;
|
|
||||||
}
|
}
|
||||||
TableInfo;
|
TableInfo;
|
||||||
|
|
||||||
|
@ -192,8 +190,6 @@ static void table_info_free (TableInfo * table_info)
|
||||||
g_free (table_info->alias);
|
g_free (table_info->alias);
|
||||||
g_slist_free (table_info->pkeys);
|
g_slist_free (table_info->pkeys);
|
||||||
g_hash_table_unref (table_info->columns);
|
g_hash_table_unref (table_info->columns);
|
||||||
g_slist_free (table_info->parent_columns);
|
|
||||||
g_slist_free (table_info->child_columns);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------- ColumnDef
|
//----------------------------------------------- ColumnDef
|
||||||
|
|
1141
db/db-model.c
1141
db/db-model.c
File diff suppressed because it is too large
Load Diff
114
db/db-model.h
114
db/db-model.h
|
@ -27,11 +27,11 @@
|
||||||
#define DB_MODEL_LOG_DOMAIN (g_quark_from_string ("DbModel"))
|
#define DB_MODEL_LOG_DOMAIN (g_quark_from_string ("DbModel"))
|
||||||
|
|
||||||
#define DB_TYPE_MODEL (db_model_get_type())
|
#define DB_TYPE_MODEL (db_model_get_type())
|
||||||
#define DB_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DB_TYPE_MODEL, DbModel))
|
#define DB_MODEL(self) (G_TYPE_CHECK_INSTANCE_CAST ((self), DB_TYPE_MODEL, DbModel))
|
||||||
#define DB_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DB_TYPE_MODEL))
|
#define DB_IS_MODEL(self) (G_TYPE_CHECK_INSTANCE_TYPE ((self), DB_TYPE_MODEL))
|
||||||
#define DB_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DB_TYPE_MODEL, DbModelClass))
|
#define DB_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DB_TYPE_MODEL, DbModelClass))
|
||||||
#define DB_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DB_TYPE_MODEL))
|
#define DB_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DB_TYPE_MODEL))
|
||||||
#define DB_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DB_TYPE_MODEL, DbModelClass))
|
#define DB_MODEL_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS ((self), DB_TYPE_MODEL, DbModelClass))
|
||||||
|
|
||||||
#define DB_TYPE_MODEL_UPDATE_FLAGS (db_model_update_flags_get_type())
|
#define DB_TYPE_MODEL_UPDATE_FLAGS (db_model_update_flags_get_type())
|
||||||
|
|
||||||
|
@ -185,102 +185,102 @@ GType db_model_update_flags_get_type () G_GNUC_CONST;
|
||||||
DbModel * db_model_new (DbConn * conn, SqlStmt * stmt);
|
DbModel * db_model_new (DbConn * conn, SqlStmt * stmt);
|
||||||
DbModel * db_model_new_with_sql (DbConn * conn, const gchar * sql);
|
DbModel * db_model_new_with_sql (DbConn * conn, const gchar * sql);
|
||||||
DbModel * db_model_new_with_file (DbConn * conn, const gchar * file);
|
DbModel * db_model_new_with_file (DbConn * conn, const gchar * file);
|
||||||
DbConn * db_model_get_conn (DbModel * obj);
|
DbConn * db_model_get_conn (DbModel * self);
|
||||||
void db_model_set_conn (DbModel * obj, DbConn * conn);
|
void db_model_set_conn (DbModel * self, DbConn * conn);
|
||||||
const GvnParamSpec * db_model_get_spec (DbModel * obj, gint col);
|
const GvnParamSpec * db_model_get_spec (DbModel * self, gint col);
|
||||||
const gchar * db_model_get_column_name (DbModel * obj, gint col);
|
const gchar * db_model_get_column_name (DbModel * self, gint col);
|
||||||
gint db_model_get_column_index (DbModel * obj, const gchar * name);
|
gint db_model_get_column_index (DbModel * self, const gchar * name);
|
||||||
void db_model_refresh (DbModel * obj);
|
void db_model_refresh (DbModel * self);
|
||||||
const SqlStmt * db_model_get_stmt (DbModel * obj);
|
const SqlStmt * db_model_get_stmt (DbModel * self);
|
||||||
void db_model_set_stmt (DbModel * obj, SqlStmt * stmt);
|
void db_model_set_stmt (DbModel * self, SqlStmt * stmt);
|
||||||
void db_model_add_pre_stmt (DbModel * obj, SqlStmt * stmt);
|
void db_model_add_pre_stmt (DbModel * self, SqlStmt * stmt);
|
||||||
void db_model_add_post_stmt (DbModel * obj, SqlStmt * stmt);
|
void db_model_add_post_stmt (DbModel * self, SqlStmt * stmt);
|
||||||
DbModelStatus db_model_get_status (DbModel * obj);
|
DbModelStatus db_model_get_status (DbModel * self);
|
||||||
const gchar * db_model_get_main_table (DbModel * obj);
|
const gchar * db_model_get_main_table (DbModel * self);
|
||||||
DbModelUpdateFlags db_model_get_update_flags (DbModel * obj);
|
DbModelUpdateFlags db_model_get_update_flags (DbModel * self);
|
||||||
void db_model_request_update_flags (DbModel * obj
|
void db_model_request_update_flags (DbModel * self
|
||||||
,DbModelUpdateFlags flags);
|
,DbModelUpdateFlags flags);
|
||||||
void db_model_unset_update_flags (DbModel * obj
|
void db_model_unset_update_flags (DbModel * self
|
||||||
,DbModelUpdateFlags flags);
|
,DbModelUpdateFlags flags);
|
||||||
void db_model_set_mode (DbModel * obj, DbModelMode mode);
|
void db_model_set_mode (DbModel * self, DbModelMode mode);
|
||||||
DbModelMode db_model_get_mode (DbModel * obj);
|
DbModelMode db_model_get_mode (DbModel * self);
|
||||||
void db_model_toggle_mode (DbModel * obj);
|
void db_model_toggle_mode (DbModel * self);
|
||||||
gboolean db_model_get_last (DbModel * obj, DbIter * iter);
|
gboolean db_model_get_last (DbModel * self, DbIter * iter);
|
||||||
void db_model_get (DbModel * obj
|
void db_model_get (DbModel * self
|
||||||
,DbIter * iter
|
,DbIter * iter
|
||||||
,...);
|
,...);
|
||||||
void db_model_set (DbModel * obj
|
void db_model_set (DbModel * self
|
||||||
,DbIter * iter
|
,DbIter * iter
|
||||||
,...);
|
,...);
|
||||||
const GValue * db_model_get_value (DbModel * obj,
|
const GValue * db_model_get_value (DbModel * self,
|
||||||
DbIter * iter,
|
DbIter * iter,
|
||||||
gint col,
|
gint col,
|
||||||
GError ** err);
|
GError ** err);
|
||||||
gboolean db_model_set_value (DbModel * obj,
|
gboolean db_model_set_value (DbModel * self,
|
||||||
DbIter * iter,
|
DbIter * iter,
|
||||||
gint col,
|
gint col,
|
||||||
const GValue * value,
|
const GValue * value,
|
||||||
GError ** err);
|
GError ** err);
|
||||||
gboolean db_model_insert (DbModel * obj, DbIter * iter);
|
gboolean db_model_insert (DbModel * self, DbIter * iter);
|
||||||
void db_model_delete (DbModel * obj, DbIter * iter);
|
void db_model_delete (DbModel * self, DbIter * iter);
|
||||||
DbModelRowOp db_model_get_row_operations (DbModel * obj, DbIter * iter);
|
DbModelRowOp db_model_get_row_operations (DbModel * self, DbIter * iter);
|
||||||
gboolean db_model_has_pending_operations (DbModel * obj);
|
gboolean db_model_has_pending_operations (DbModel * self);
|
||||||
void db_model_perform_operations (DbModel * obj, gboolean retry);
|
void db_model_perform_operations (DbModel * self, gboolean retry);
|
||||||
void db_model_reverse_operations (DbModel * obj);
|
void db_model_reverse_operations (DbModel * self);
|
||||||
void db_model_order_by (DbModel * obj,
|
void db_model_order_by (DbModel * self,
|
||||||
gint col,
|
gint col,
|
||||||
DbSortType order);
|
DbSortType order);
|
||||||
gboolean db_model_search (DbModel * obj,
|
gboolean db_model_search (DbModel * self,
|
||||||
gint col,
|
gint col,
|
||||||
DbIter * iter,
|
DbIter * iter,
|
||||||
gpointer content);
|
gpointer content);
|
||||||
gboolean db_model_search_value (DbModel * obj,
|
gboolean db_model_search_value (DbModel * self,
|
||||||
gint col,
|
gint col,
|
||||||
DbIter * iter,
|
DbIter * iter,
|
||||||
const GValue * value);
|
const GValue * value);
|
||||||
gint db_model_get_nrows (DbModel * obj);
|
gint db_model_get_nrows (DbModel * self);
|
||||||
gboolean db_model_iter_is_valid (DbIter * iter
|
gboolean db_model_iter_is_valid (DbIter * iter
|
||||||
,DbModel * model);
|
,DbModel * model);
|
||||||
void db_model_add_join_columns (DbModel * obj
|
void db_model_add_join (DbModel * self
|
||||||
,const gchar * left
|
,const gchar * master_field
|
||||||
,const gchar * right);
|
,const gchar * slave_field);
|
||||||
SqlBatch * db_model_get_batch (DbModel * obj);
|
SqlBatch * db_model_get_batch (DbModel * self);
|
||||||
void db_model_set_batch (DbModel * obj, SqlBatch * batch);
|
void db_model_set_batch (DbModel * self, SqlBatch * batch);
|
||||||
|
|
||||||
void db_model_set_default_value_from_column (DbModel * obj, const gchar * field, const gchar * column);
|
void db_model_set_default_value_from_column (DbModel * self, const gchar * field, const gchar * column);
|
||||||
void db_model_set_default_value_from_param (DbModel * obj, const gchar * field, GvnParam * param, gboolean link);
|
void db_model_set_default_value_from_param (DbModel * self, const gchar * field, GvnParam * param, gboolean link);
|
||||||
|
|
||||||
//GtkTreeModel-like methods
|
//GtkTreeModel-like methods
|
||||||
|
|
||||||
gint db_model_get_ncols (DbModel * obj);
|
gint db_model_get_ncols (DbModel * self);
|
||||||
GType db_model_get_column_type (DbModel * obj, gint index);
|
GType db_model_get_column_type (DbModel * self, gint index);
|
||||||
gboolean db_model_get_iter_first (DbModel * obj, DbIter * iter);
|
gboolean db_model_get_iter_first (DbModel * self, DbIter * iter);
|
||||||
gboolean db_model_get_iter (DbModel * obj,
|
gboolean db_model_get_iter (DbModel * self,
|
||||||
DbIter * iter,
|
DbIter * iter,
|
||||||
gint path);
|
gint path);
|
||||||
gint db_model_get_path (DbModel * obj, DbIter * iter);
|
gint db_model_get_path (DbModel * self, DbIter * iter);
|
||||||
gboolean db_model_iter_next (DbModel * obj, DbIter * iter);
|
gboolean db_model_iter_next (DbModel * self, DbIter * iter);
|
||||||
gboolean db_model_iter_prev (DbModel * obj, DbIter * iter);
|
gboolean db_model_iter_prev (DbModel * self, DbIter * iter);
|
||||||
void db_model_ref_node (DbModel * obj, DbIter * iter);
|
void db_model_ref_node (DbModel * self, DbIter * iter);
|
||||||
void db_model_unref_node (DbModel * obj, DbIter * iter);
|
void db_model_unref_node (DbModel * self, DbIter * iter);
|
||||||
|
|
||||||
//GtkTreeSortable-like methods
|
//GtkTreeSortable-like methods
|
||||||
|
|
||||||
gboolean db_model_get_sort_column_id (DbModel * obj,
|
gboolean db_model_get_sort_column_id (DbModel * self,
|
||||||
gint * sort_column_id,
|
gint * sort_column_id,
|
||||||
DbSortType * order);
|
DbSortType * order);
|
||||||
void db_model_set_sort_column_id (DbModel * obj,
|
void db_model_set_sort_column_id (DbModel * self,
|
||||||
gint sort_column_id,
|
gint sort_column_id,
|
||||||
DbSortType order);
|
DbSortType order);
|
||||||
void db_model_set_sort_func (DbModel * obj,
|
void db_model_set_sort_func (DbModel * self,
|
||||||
gint sort_column_id,
|
gint sort_column_id,
|
||||||
DbIterCompareFunc func,
|
DbIterCompareFunc func,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
GDestroyNotify destroy);
|
GDestroyNotify destroy);
|
||||||
void db_model_set_default_sort_func (DbModel * obj,
|
void db_model_set_default_sort_func (DbModel * self,
|
||||||
DbIterCompareFunc func,
|
DbIterCompareFunc func,
|
||||||
gpointer data,
|
gpointer data,
|
||||||
GDestroyNotify destroy);
|
GDestroyNotify destroy);
|
||||||
gboolean db_model_has_default_sort_func (DbModel * obj);
|
gboolean db_model_has_default_sort_func (DbModel * self);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in New Issue