1
//////////////////////////////////////////////////////////////////////////
3
// pgScript - PostgreSQL Tools
4
// RCS-ID: $Id: pgsNegate.cpp 7758 2009-03-26 20:49:59Z dpage $
5
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
6
// This software is released under the BSD Licence
8
//////////////////////////////////////////////////////////////////////////
12
#include "pgscript/expressions/pgsNegate.h"
14
#include "pgscript/objects/pgsNumber.h"
16
pgsNegate::pgsNegate(const pgsExpression * left) :
22
pgsNegate::~pgsNegate()
27
pgsExpression * pgsNegate::clone() const
29
return pnew pgsNegate(*this);
32
pgsNegate::pgsNegate(const pgsNegate & that) :
38
pgsNegate & pgsNegate::operator =(const pgsNegate & that)
42
pgsOperation::operator=(that);
47
wxString pgsNegate::value() const
49
return wxString() << wxT("-") << m_left->value();
52
pgsOperand pgsNegate::eval(pgsVarMap & vars) const
55
pgsOperand left(pnew pgsNumber(wxT("0"), pgsInt));
56
pgsOperand right(m_left->eval(vars));
59
return (*left - *right);