Issue 72 in django-jython: Oracle Pagination in Admin interface

25 views
Skip to first unread message

django...@googlecode.com

unread,
Feb 29, 2012, 10:50:55 AM2/29/12
to django-j...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 72 by jpwhite3: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

What steps will reproduce the problem?
-----------------------------------------
1. Create model use oracle driver, and enable admin interface.
2. Enable "list_per_page" option in AdminManager for the above model.
3. Visit admin interface and view table with large dataset (larger than
limit set in above step).


What is the expected output? What do you see instead?
-----------------------------------------
Expect functional pagination based on the "list_per_page" set in the model.
Instead, the pagination elements appear on the bottom of the list page with
the correct number of pages yet every paginated link loads the entire data
set.


What version of the product are you using? On what operating system?
-----------------------------------------
Jython 2.7, Django-Jython 1.2.0, Django 1.2.7
Windows 2008 Server, Redhat 5.5


Please provide any additional information below.
-----------------------------------------
Removing doj and doj-database backends from settings file and running
development server with cPython fixes the issue. Only happens when doj is
enabled.

django...@googlecode.com

unread,
Feb 29, 2012, 12:39:11 PM2/29/12
to django-j...@googlegroups.com

Comment #1 on issue 72 by jpwhite3: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

As another test I migrated db schema to MySQL from Oracle and swapped out
doj drivers... pagination worked out of the box. Leads me to believe that
this limited to the doj implementation of Oracle query.py

django...@googlecode.com

unread,
Feb 29, 2012, 12:51:16 PM2/29/12
to django-j...@googlegroups.com
Updates:
Owner: juneau001

Comment #2 on issue 72 by juneau001: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

Thanks for the testing and feedback. Will put this in the queue.

django...@googlecode.com

unread,
Apr 13, 2012, 10:25:06 AM4/13/12
to django-j...@googlegroups.com

Comment #3 on issue 72 by jpwhite3: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

Just tested with the lastest 1.3 beta release against Jython 2.5.2, same
result... pagination with oracle doesn't work. And as before, removing doj

and doj-database backends from settings file and running development server

with Python and cx_Oracle fixes the issue.

django...@googlecode.com

unread,
Jul 2, 2012, 7:31:22 PM7/2/12
to django-j...@googlegroups.com

Comment #4 on issue 72 by jpwhite3: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

Testing against the full release of doj 1.3 with Jython 2.5.2, no change.
Is anyone else experiencing this?

django...@googlecode.com

unread,
Jul 3, 2012, 7:21:59 AM7/3/12
to django-j...@googlegroups.com
Updates:
Status: Accepted

Comment #5 on issue 72 by juneau001: Oracle Pagination in Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

This issue has not yet been addressed. It is certainly in the queue and I
hope to address it soon.

django...@googlecode.com

unread,
Jun 19, 2013, 11:23:23 AM6/19/13
to django-j...@googlegroups.com

Comment #6 on issue 72 by dvine...@ce.bdigital.org: Oracle Pagination in
Admin interface
http://code.google.com/p/django-jython/issues/detail?id=72

Is caused by this code in zxJDBCCursorWrapperOracle.py :

# Patch LIMIT clause for Oracle to implement ROWNUM
if sql.count(' LIMIT'):
limit_idx = sql.find(' LIMIT')
limit_rows = sql[limit_idx:]
# Replace LIMIT clause with blank
sql = sql.replace(sql[limit_idx:],'')
# If WHERE clause then make ROWNUM evaluation first
if sql.count(' WHERE'):
sql.replace(' WHERE', ' WHERE ROWNUM <= %s AND' %
limit_rows)
else:
if sql.count(' ORDER BY'):
sql.replace(' ORDER BY', ' WHERE ROWNUM <= %s ORDER
BY' % limit_rows)
else:
if sql.count(' ASC'):
sql.replace(' ASC', ' WHERE ROWNUM <= %s ASC' %
limit_rows)
elif sql.count(' DESC'):
sql.replace(' DESC', ' WHERE ROWNUM <= %s DESC' %
limit_rows)
# Strip any OFFSET references. Not the best implementation,
certainly
# needs some work. However, this does the trick for now.
if sql.find('OFFSET') > 0:
offset_int = int(sql[sql.find('OFFSET') + 7:])
sql = sql.replace(' OFFSET %d' % offset_int,'')
self.cursor.execute(sql, params)

Django ORM uses this:

# Wrap the base query in an outer SELECT * with boundaries on
# the "_RN" column. This is the canonical way to emulate LIMIT
# and OFFSET on Oracle.
high_where = ''
if self.query.high_mark is not None:
high_where = 'WHERE ROWNUM <= %d' % (self.query.high_mark,)
sql = 'SELECT * FROM (SELECT ROWNUM AS "_RN", "_SUB".* FROM
(%s) "_SUB" %s) WHERE "_RN" > %d' % (sql, high_where, self.query.low_mark)




--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

django...@googlecode.com

unread,
Aug 10, 2014, 4:31:30 AM8/10/14
to django-j...@googlegroups.com
Updates:
Status: Invalid

Comment #7 on issue 72 by andr...@st0cker.at: Oracle Pagination in Admin
interface
http://code.google.com/p/django-jython/issues/detail?id=72

Oracle is currently unsupported.
Reply all
Reply to author
Forward
0 new messages