- postgis resultset cosmetics

This commit is contained in:
kunitoki 2012-03-31 22:24:32 +02:00
parent 14bc344898
commit 4a7966498c

View file

@ -47,12 +47,6 @@ public:
class ResultSet : public IResultSet
{
private:
PGresult* res_;
int pos_;
int numTuples_;
int *refCount_;
public:
ResultSet(PGresult *res)
: res_(res),
@ -73,12 +67,19 @@ public:
ResultSet& operator=(const ResultSet& rhs)
{
if (this==&rhs) return *this;
if (this == &rhs)
{
return *this;
}
if (--(refCount_) == 0)
{
close();
delete refCount_,refCount_=0;
delete refCount_;
refCount_ = 0;
}
res_ = rhs.res_;
pos_ = rhs.pos_;
numTuples_ = rhs.numTuples_;
@ -89,7 +90,8 @@ public:
virtual void close()
{
PQclear(res_),res_=0;
PQclear(res_);
res_ = 0;
}
virtual ~ResultSet()
@ -97,7 +99,9 @@ public:
if (--(*refCount_) == 0)
{
PQclear(res_);
delete refCount_,refCount_=0;
delete refCount_;
refCount_ = 0;
}
}
@ -135,7 +139,9 @@ public:
{
int col = PQfnumber(res_, name);
if (col >= 0)
{
return PQgetlength(res_, pos_, col);
}
return 0;
}
@ -148,7 +154,9 @@ public:
{
int col = PQfnumber(res_, name);
if (col >= 0)
{
return PQftype(res_, col);
}
return 0;
}
@ -166,12 +174,17 @@ public:
{
int col = PQfnumber(res_, name);
if (col >= 0)
{
return getValue(col);
}
return 0;
}
private:
PGresult* res_;
int pos_;
int numTuples_;
int *refCount_;
};
#endif //RESULTSET_HPP