mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-05-08 09:59:23 -05:00
drivers added SqlRecord::fieldNames()
This commit is contained in:
@@ -41,6 +41,9 @@ namespace Orm::Drivers
|
||||
/*! Swap the SqlRecord. */
|
||||
inline void swap(SqlRecord &other) noexcept;
|
||||
|
||||
/*! Get all field names. */
|
||||
QStringList fieldNames() const;
|
||||
|
||||
/*! Get the field name at the given index. */
|
||||
QString fieldName(size_type index) const;
|
||||
/*! Get the index of the given field name (-1 if it can't be found). */
|
||||
|
||||
@@ -17,6 +17,17 @@ namespace Orm::Drivers
|
||||
|
||||
/* public */
|
||||
|
||||
QStringList SqlRecord::fieldNames() const
|
||||
{
|
||||
QStringList result;
|
||||
result.reserve(m_fields.size());
|
||||
|
||||
for (const auto &field : m_fields)
|
||||
result << field.name();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString SqlRecord::fieldName(const size_type index) const
|
||||
{
|
||||
return m_fields.value(index).name();
|
||||
|
||||
Reference in New Issue
Block a user