Changed operator << for Value to explicitly call the conversion operators.

The static_cast route caused it to compile streaming into a vector but actually
generated code that would fail at runtime. This new version won't compile when the left hand
is a vector.
This commit is contained in:
eelke 2017-12-20 22:07:20 +01:00
parent 1727b0d645
commit a76686acfd

View file

@ -5,6 +5,7 @@
#include "Pgsql_oids.h" #include "Pgsql_oids.h"
#include "ArrayParser.h" #include "ArrayParser.h"
#include <sstream> #include <sstream>
#include <vector>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
@ -132,6 +133,8 @@ namespace Pgsql {
start = ++pos; // skip space and set new start to match start = ++pos; // skip space and set new start to match
} }
} }
inline Oid getOid() const { return m_typ; }
private: private:
const char *m_val; const char *m_val;
Oid m_typ; Oid m_typ;
@ -140,7 +143,8 @@ namespace Pgsql {
template <typename T> template <typename T>
void operator<<(T &s, const Value &v) void operator<<(T &s, const Value &v)
{ {
s = static_cast<T>(v); //s = static_cast<T>(v);
s = v.operator T();
} }