- postgis resultset cosmetics
This commit is contained in:
parent
14bc344898
commit
4a7966498c
1 changed files with 54 additions and 41 deletions
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue