Views: Column dictionaries now store and return pointers on column
pointers instead of column pointers.
This commit is contained in:
@ -798,7 +798,7 @@ static int create_column_dict(Obiview_p view)
|
|||||||
return -1;
|
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);
|
obi_set_errno(OBIVIEW_ERROR);
|
||||||
obidebug(1, "\nError adding a column in a column dictionary");
|
obidebug(1, "\nError adding a column in a column dictionary");
|
||||||
@ -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)
|
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)
|
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const char* column_name)
|
||||||
{
|
{
|
||||||
int i;
|
return (OBIDMS_column_p*)(ht_get(view->column_dict, column_name));
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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.
|
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
|
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.
|
int nb_predicates; /**< Number of predicates to test when closing the view.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user