Messy commit. Testing suff and some improvements to how data is shown.
This commit is contained in:
parent
bebb3391c3
commit
3a13b7ffb4
59 changed files with 2045 additions and 716 deletions
|
|
@ -5,7 +5,8 @@
|
|||
using namespace Pgsql;
|
||||
|
||||
Value::Value(const char *val, Oid typ)
|
||||
: m_val(val), m_typ(typ)
|
||||
: m_val(val)
|
||||
, m_typ(typ)
|
||||
{}
|
||||
|
||||
QString Value::asQString() const
|
||||
|
|
@ -15,15 +16,30 @@ QString Value::asQString() const
|
|||
|
||||
Value::operator QString() const
|
||||
{
|
||||
return QString::fromUtf8(m_val);
|
||||
// if (isString())
|
||||
return QString::fromUtf8(m_val);
|
||||
// else
|
||||
// throw std::logic_error("Column type doesn't match requested type");
|
||||
}
|
||||
|
||||
Value::operator QDateTime() const
|
||||
{
|
||||
return QDateTime::fromString(asQString(),
|
||||
"yyyy-MM-dd hh:mm:ss");
|
||||
return QDateTime::fromString(asQString(), Qt::ISODateWithMs);
|
||||
// return QDateTime::fromString(asQString(),
|
||||
// "yyyy-MM-dd hh:mm:ss");
|
||||
}
|
||||
|
||||
Value::operator QDate() const
|
||||
{
|
||||
return QDate::fromString(asQString(), Qt::ISODate);
|
||||
}
|
||||
|
||||
Value::operator QTime() const
|
||||
{
|
||||
return QTime::fromString(asQString(), Qt::ISODateWithMs);
|
||||
}
|
||||
|
||||
|
||||
Value::operator std::string() const
|
||||
{
|
||||
return m_val;
|
||||
|
|
@ -54,6 +70,14 @@ Value::operator bool() const
|
|||
return std::strcmp(m_val, "t") == 0;
|
||||
}
|
||||
|
||||
bool Value::isString() const
|
||||
{
|
||||
return m_typ == CHAROID
|
||||
|| m_typ == VARCHAROID
|
||||
|| m_typ == TEXTOID
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void operator<<(QString &s, const Value &v)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue