mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
LibSQL: Don't copy strings when searching for a column's index
Also don't cast the return value to an int.
This commit is contained in:
parent
c3a6fad080
commit
47dd1b9f8b
2 changed files with 4 additions and 5 deletions
|
@ -79,13 +79,12 @@ Tuple& Tuple::operator=(Tuple const& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
Optional<size_t> Tuple::index_of(String name) const
|
||||
Optional<size_t> Tuple::index_of(StringView name) const
|
||||
{
|
||||
auto n = move(name);
|
||||
for (auto ix = 0u; ix < m_descriptor->size(); ix++) {
|
||||
auto& part = (*m_descriptor)[ix];
|
||||
if (part.name == n) {
|
||||
return (int)ix;
|
||||
if (part.name == name) {
|
||||
return ix;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue