Skip to content

Commit

Permalink
Merge pull request contiki-os#321 from nvt/antelope-domain-check
Browse files Browse the repository at this point in the history
Prevent erroneous index creation for non-numerical attributes in Antelope.
  • Loading branch information
Nicolas Tsiftes committed Aug 7, 2013
2 parents 2a4b985 + b27fb1b commit aa2f351
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/antelope/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ index_create(index_type_t index_type, relation_t *rel, attribute_t *attr)
return DB_STORAGE_ERROR;
}

if(attr->domain != DOMAIN_INT && attr->domain != DOMAIN_LONG) {
PRINTF("DB: Cannot create an index for a non-number attribute!\n");
return DB_INDEX_ERROR;
}

api = find_index_api(index_type);
if(api == NULL) {
PRINTF("DB: No API for index type %d\n", (int)index_type);
Expand Down

0 comments on commit aa2f351

Please sign in to comment.