Skip to content

Commit

Permalink
Add implementation of TableView::find_fist_binary() using the same id…
Browse files Browse the repository at this point in the history
…ea as is used in TableView::find_fist_string()
  • Loading branch information
kspangsege committed May 13, 2013
1 parent 4090b8a commit ce60f6c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions src/tightdb/table_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ size_t TableViewBase::find_first_integer(size_t column_ndx, int64_t value) const
return size_t(-1);
}

size_t TableViewBase::find_first_string(size_t column_ndx, StringData value) const
{
TIGHTDB_ASSERT_COLUMN_AND_TYPE(column_ndx, type_String);

for (size_t i = 0; i < m_refs.size(); i++)
if (get_string(column_ndx, i) == value) return i;
return size_t(-1);
}

size_t TableViewBase::find_first_float(size_t column_ndx, float value) const
{
for (size_t i = 0; i < m_refs.size(); i++)
Expand All @@ -43,6 +34,24 @@ size_t TableViewBase::find_first_double(size_t column_ndx, double value) const
return size_t(-1);
}

size_t TableViewBase::find_first_string(size_t column_ndx, StringData value) const
{
TIGHTDB_ASSERT_COLUMN_AND_TYPE(column_ndx, type_String);

for (size_t i = 0; i < m_refs.size(); i++)
if (get_string(column_ndx, i) == value) return i;
return size_t(-1);
}

size_t TableViewBase::find_first_binary(size_t column_ndx, BinaryData value) const
{
TIGHTDB_ASSERT_COLUMN_AND_TYPE(column_ndx, type_Binary);

for (size_t i = 0; i < m_refs.size(); i++)
if (get_binary(column_ndx, i) == value) return i;
return size_t(-1);
}


// Aggregates ----------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/tightdb/table_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TableViewBase {
size_t find_first_float(size_t column_ndx, float value) const;
size_t find_first_double(size_t column_ndx, double value) const;
size_t find_first_string(size_t column_ndx, StringData value) const;
// FIXME: Need: size_t find_first_binary(size_t column_ndx, BinaryData value) const;
size_t find_first_binary(size_t column_ndx, BinaryData value) const;

// Aggregate functions
template <int function, typename T, typename R, class ColType>
Expand Down

0 comments on commit ce60f6c

Please sign in to comment.