[viewvc-dev] SQL query error + patch
Benjeman Meekhof <[email protected]> Tue, 6 Aug 2013 15:57:25 -0400
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <CAH-GEabo3aPmK7sQtZm2GzWAE+x5DMoepn-uL3xYMJSstW5iVQ@mail.gmail.com> |
------=_Part_1780_444070354.1375819675584
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
I'm running Viewvc v 1.1.20 on RHEL 5.9 with the revision database
enabled on top of Mysql 5.0.95. There seems to be some issue with how
dates are quoted when querying the database. If I attempt to "query
revision history" and limit the date to anything but "since the
beginning of time" I get an error as noted below. It seems to be
resolved by using ' instead of " to quote the date in the appropriate
where clauses in cvsdb.py. Since I didn't see this issue in the
tracker and the code seems the same in the nightly builds I thought
I'd send this and include a patch. Hopefully it's useful. Thanks for
your work in producing a very useful tool!
The traceback is below, patch attached.
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/viewvc/lib/viewvc.py", line
4827, in main
request.run_viewvc()
File "/usr/lib/python2.4/site-packages/viewvc/lib/viewvc.py", line
402, in run_viewvc
self.view_func(self)
File "/usr/lib/python2.4/site-packages/viewvc/lib/viewvc.py", line
4509, in view_query
db.RunQuery(query)
File "/usr/lib/python2.4/site-packages/viewvc/lib/cvsdb.py", line
473, in RunQuery
cursor.execute(sql)
File "/usr/lib64/python2.4/site-packages/MySQLdb/cursors.py", line
173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.4/site-packages/MySQLdb/connections.py",
line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column '2013-07-06 19:48:02' in
'where clause'")
regards,
Ben
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=3062155
To unsubscribe from this discussion, e-mail: [[email protected]].
------=_Part_1780_444070354.1375819675584
Content-Type: text/plain; charset=US-ASCII;
name=viewvc-cvsdb-quote-patch.txt
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hk1j1kus0
Content-Disposition: attachment; filename=viewvc-cvsdb-quote-patch.txt
LS0tIHZpZXd2Yy0xLjItZGV2LTIwMTMwODA2L2xpYi9jdnNkYi5weQkyMDEzLTAyLTI2IDExOjQz
OjEyLjAwMDAwMDAwMCAtMDUwMAorKysgdmlld3ZjLTEuMi1kZXYtMjAxMzA4MDYtcGF0Y2hlZC9s
aWIvY3ZzZGIucHkJMjAxMy0wOC0wNiAxNTo0MDoxNS4wMDAwMDAwMDAgLTA0MDAKQEAgLTQxNywx
MiArNDE3LDEyIEBACiAgICAgICAgICAgICBjb25kTGlzdC5hcHBlbmQodGVtcCkKICAgICAgICAg
ICAgIAogICAgICAgICBpZiBxdWVyeS5mcm9tX2RhdGU6Ci0gICAgICAgICAgICB0ZW1wID0gIigl
cy5jaV93aGVuPj1cIiVzXCIpIiBcCisgICAgICAgICAgICB0ZW1wID0gIiglcy5jaV93aGVuPj1c
JyVzXCcpIiBcCiAgICAgICAgICAgICAgICAgICAgJSAoY29tbWl0c190YWJsZSwgc3RyKHF1ZXJ5
LmZyb21fZGF0ZSkpCiAgICAgICAgICAgICBjb25kTGlzdC5hcHBlbmQodGVtcCkKIAogICAgICAg
ICBpZiBxdWVyeS50b19kYXRlOgotICAgICAgICAgICAgdGVtcCA9ICIoJXMuY2lfd2hlbjw9XCIl
c1wiKSIgXAorICAgICAgICAgICAgdGVtcCA9ICIoJXMuY2lfd2hlbjw9XCclc1wnKSIgXAogICAg
ICAgICAgICAgICAgICAgICUgKGNvbW1pdHNfdGFibGUsIHN0cihxdWVyeS50b19kYXRlKSkKICAg
ICAgICAgICAgIGNvbmRMaXN0LmFwcGVuZCh0ZW1wKQogCg==
------=_Part_1780_444070354.1375819675584--