Edgewall Software

Ticket #6429 (closed defect: worksforme)

Opened 13 months ago

Last modified 11 months ago

sqlite backend should accept valid sqlite strings

Reported by: dalius@… Owned by: jonas
Priority: normal Milestone:
Component: general Version:
Severity: minor Keywords: sqlite
Cc:

Description

I'm maintainer of AuthOpenIdPluging? for Trac (http://trac-hacks.org/wiki/AuthOpenIdPlugin).

Recently one user of my plugin found problem (http://trac-hacks.org/ticket/2242) that must be fixed in trac side in my opinion.

If we supply following SQL string:

'SELECT handle, secret, issued, lifetime, assoc_type FROM oid_associations WHERE server_url = ?;'

to sqlite backend it fails at line:

sql = sql % (('?',) * len(args))

File "/home/user/server/lib/python2.5/Trac-0.11dev_r6254-py2.5.egg/trac/db/sqlite_backend.py", line 56, in execute

with exception:

TypeError: not all arguments converted during string formatting

SQL string is completely valid sqlite string. I'm not sure yet how fix should look like however.

Attachments

Change History

Changed 13 months ago by nkantrowitz

  • status changed from new to closed
  • resolution set to worksforme

Trac's database layer enforces the %s paramstyle in all backends to allow for mutli-DB support. Just look at any use cursors in the Trac codebase itself.

Changed 13 months ago by dalius@…

Yes, I understand that but that makes new problem. Python OpenId? library has different backends based on database type (instead of trying to be univeral like trac it is specific for each database type). As result it already has correct sqlite SQL strings. Because trac tries to be universal (multi-DB) it is not possible to skip that params enforcement and use python openid library directly. I'm pretty sure that if there are more database type oriented libraries (at least for sqlite) they are almost impossible to use with trac.

Changed 11 months ago by nkantrowitz

Sure, just pass it the underlying DB connection object, not the Trac one, self.env.get_db_cnx().cnx.

Add/Change #6429 (sqlite backend should accept valid sqlite strings)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from jonas. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.