Commit 3319ede8 by Celine Mercier

Views: Column dictionaries now store and return pointers on column

pointers instead of column pointers.
parent fc20b83a
......@@ -798,7 +798,7 @@ static int create_column_dict(Obiview_p view)
return -1;
}
if (ht_set(view->column_dict, (((view->infos)->column_references)[i]).alias, (view->columns)[i]) < 0)
if (ht_set(view->column_dict, (((view->infos)->column_references)[i]).alias, (view->columns)+i) < 0)
{
obi_set_errno(OBIVIEW_ERROR);
obidebug(1, "\nError adding a column in a column dictionary");
......@@ -2032,8 +2032,8 @@ int obi_view_add_column(Obiview_p view,
const char* indexer_name,
const char* associated_column_name,
obiversion_t associated_column_version,
const char* comments,
bool create) // all infos for creation or open
const char* comments,
bool create) // all infos for creation or open
{
int i;
OBIDMS_column_p column;
......@@ -2199,21 +2199,13 @@ int obi_view_delete_column(Obiview_p view, const char* column_name)
OBIDMS_column_p obi_view_get_column(Obiview_p view, const char* column_name)
{
return (OBIDMS_column_p)(ht_get(view->column_dict, column_name));
return (OBIDMS_column_p)(*((OBIDMS_column_p*)(ht_get(view->column_dict, column_name))));
}
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const char* column_name)
{
int i;
for (i=0; i < (view->infos)->column_count; i++)
{
if (strcmp((((view->infos)->column_references)[i]).alias, column_name) == 0)
return ((view->columns)+i);
}
obidebug(1, "\nError: column not found");
return NULL;
return (OBIDMS_column_p*)(ht_get(view->column_dict, column_name));
}
......
......@@ -119,7 +119,7 @@ typedef struct Obiview {
OBIDMS_column_p columns[MAX_NB_OPENED_COLUMNS]; /**< Array of pointers on all the columns of the view.
*/
hashtable_p column_dict; /**< Hash table storing the pairs of column names or aliases with the associated
* column pointers.
* pointers on column pointers (OBIDMS_column_p*).
*/
int nb_predicates; /**< Number of predicates to test when closing the view.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment