Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Pgadmin Hackers > pgSet MoveNext ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 4360 of 4873
Post > Topic >>

pgSet MoveNext bug ?

by tharakan@[EMAIL PROTECTED] ("Robins Tharakan") Mar 4, 2008 at 06:54 AM

------=_Part_33668_25393407.1204593893981
Content-Type: multipart/alternative; 
	boundary="----=_Part_33669_10899980.1204593893981"


------=_Part_33669_10899980.1204593893981
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

While reading the code, the PGSet->MoveNext() definition seems to have a
small bug.

Since the PGSet->EOF() is defined as
bool Eof() const { return (!nRows || pos > nRows); }

I think it doesn't make sense to define PGSet->MoveNext() as
void MoveNext() { if (pos <= nRows) pos++; }

It should rather be
void MoveNext() { if (pos < nRows) pos++; }

The attached patch does the same.

Regards,
*Robins Tharakan*

------=_Part_33669_10899980.1204593893981
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<span style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);">Hi,</span><br style="font-family: verdana,sans-serif; color: rgb(0,
0, 0);"><br style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);"><span style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);">While reading the code, the PGSet-&gt;MoveNext() definition seems to
have a small bug.</span><br style="font-family: verdana,sans-serif; color:
rgb(0, 0, 0);">
<br style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);"><span
style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">Since the
PGSet-&gt;EOF() is defined as </span><br style="font-family:
verdana,sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">bool
Eof() const { return (!nRows || pos &gt; nRows); }</span><br
style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);"><br
style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">I
think it doesn&#39;t make sense to define PGSet-&gt;MoveNext()
as</span><br style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);"><span style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);">void MoveNext() { if (pos &lt;= nRows) pos++; }</span><br
style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">
<br style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);"><span
style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">It should
rather be </span><br style="font-family: verdana,sans-serif; color: rgb(0,
0, 0);">
<span style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">void
MoveNext() { if (pos &lt; nRows) pos++; }</span><br style="font-family:
verdana,sans-serif; color: rgb(0, 0, 0);"><br style="font-family:
verdana,sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: verdana,sans-serif; color: rgb(0, 0, 0);">The
attached patch does the same.</span><br style="font-family:
verdana,sans-serif; color: rgb(0, 0, 0);"><br style="font-family:
verdana,sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);">Regards,</span><br style="font-family: verdana,sans-serif; color:
rgb(0, 0, 0);"><b style="font-family: verdana,sans-serif; color: rgb(0, 0,
0);">Robins Tharakan</b><br style="font-family: verdana,sans-serif; color:
rgb(0, 0, 0);">

------=_Part_33669_10899980.1204593893981--

------=_Part_33668_25393407.1204593893981
Content-Type: text/x-patch; name=pgset_movenext_bug.patch
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fddrmxsf0
Content-Disposition: attachment; filename=pgset_movenext_bug.patch

SW5kZXg6IHBnYWRtaW4vaW5jbHVkZS9kYi9wZ1NldC5oCj09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT0KLS0tIHBnYWRtaW4vaW5jbHVkZS9kYi9wZ1NldC5oCShy
ZXZpc2lvbiA3MTA4KQorKysgcGdhZG1pbi9pbmNsdWRlL2RiL3BnU2V0LmgJ
KHdvcmtpbmcgY29weSkKQEAgLTQxLDcgKzQxLDcgQEAKICAgICBsb25nIE51
bVJvd3MoKSBjb25zdCB7IHJldHVybiBuUm93czsgfQogICAgIGxvbmcgTnVt
Q29scygpIGNvbnN0IHsgcmV0dXJuIG5Db2xzOyB9CiAKLSAgICB2b2lkIE1v
dmVOZXh0KCkgeyBpZiAocG9zIDw9IG5Sb3dzKSBwb3MrKzsgfQorICAgIHZv
aWQgTW92ZU5leHQoKSB7IGlmIChwb3MgPCBuUm93cykgcG9zKys7IH0KICAg
ICB2b2lkIE1vdmVQcmV2aW91cygpIHsgaWYgKHBvcyA+IDApIHBvcy0tOyB9
CiAgICAgdm9pZCBNb3ZlRmlyc3QoKSB7IGlmIChuUm93cykgcG9zPTE7IGVs
c2UgcG9zPTA7IH0KICAgICB2b2lkIE1vdmVMYXN0KCkgeyBwb3M9blJvd3M7
IH0K

------=_Part_33668_25393407.1204593893981
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@[EMAIL PROTECTED]
)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgadmin-hackers

------=_Part_33668_25393407.1204593893981--
 




 2 Posts in Topic:
pgSet MoveNext bug ?
tharakan@[EMAIL PROTECTED  2008-03-04 06:54:53 
Re: pgSet MoveNext bug ?
dpage@[EMAIL PROTECTED]   2008-03-05 12:18:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 15:28:57 CST 2008.