Merge branch '2.2' into 2.3

This commit is contained in:
Markus Mäkelä
2018-11-06 21:12:20 +02:00
16 changed files with 232 additions and 138 deletions

View File

@ -23,6 +23,7 @@
#include <vector>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <jansson.h>
@ -199,6 +200,31 @@ public:
return m_values.at(it - m_keys->begin());
}
/**
* Check if a field has a NULL value
*
* @param i The field index
*
* @return True if the field has a NULL value
*/
bool is_null(size_t i) const
{
return m_nulls.count(i);
}
/**
* Check if a field has a NULL value
*
* @param str The field name
*
* @return True if the field has a NULL value
*/
bool is_null(const std::string& str) const
{
ValueVector::const_iterator it = std::find(m_keys->begin(), m_keys->end(), str);
return m_nulls.count(it - m_keys->begin());
}
/**
* Get the GTID of this row
*
@ -242,16 +268,19 @@ public:
private:
SValueVector m_keys;
SValueVector m_types;
ValueVector m_values;
ValueVector m_values;
std::set<size_t> m_nulls;
// Only a Connection should construct an InternalRow
friend class Connection;
Row(SValueVector& keys,
SValueVector& types,
ValueVector& values)
: m_keys(keys)
, m_types(types)
ValueVector& values,
std::set<size_t>& nulls):
m_keys(keys),
m_types(types),
m_nulls(nulls)
{
m_values.swap(values);
}