Thank you for your reply, Karen. Your interpretations are correct. The searching works fine using sqlite3 on my windows development machine. The searching works fine on the Linux machine (Apache 2) using MySQL as the DB engine, but blows up when I try to use the sqlite3 engine there. I can use the Django shell on the Linux machine with sqlite3 to do the same searching as I perform in the view and then there are no problems.
I will try your suggestion to set up some very simple regexp filters and see if I can get something to work through Apache, then go from there step-by-step. The problem does seem to reside with the user- defined regex function, because when I substituted "icontains" for "iregex" the altered filter worked fine. There is some mysterious interaction here. I'll report any break-throughs on my part. On May 17, 6:01 pm, Karen Tracey <[email protected]> wrote: > On Sun, May 17, 2009 at 5:20 PM, Ned <[email protected]> wrote: > > > I would greatly appreciate any explanations or suggested > > courses of action to get to the bottom of the problem described below. > > If more information would be helpful I'd be glad to supply it. I'm > > using Django 1.0. > > > I have a search application, in prototype stage, that makes use of > > regular expressions entered by the user to search text values in a > > table. The application is being developed using sqlite3 on a windows > > machine. I transfer the files and load MySQL records > > to a linux machine set up as a server. The application runs as > > expected using MySQL and successfully searches the text values with > > regular expressions, including those with special characters. > > > I wanted to compare performance on the linux machine if instead it > > used sqlite3. For reasons I don't understand, the attempt to search, > > with any regular expression, produces an exception: > > > --- begin exception traceback --- > > [snip gory details] > > 19. return self.cursor.execute(sql, params) > > File "/var/lib/python-support/python2.5/django/db/backends/sqlite3/ > > base.py" in execute > > 167. return Database.Cursor.execute(self, query, params) > > > Exception Type: OperationalError at /mrdocs-search/results/ > > Exception Value: user-defined function raised exception > > > --- end exception traceback --- > > > An excerpt of the code in my view that leads to this problem is the > > ff: > > [snip code details] > > I can duplicate the essence of the code above and run it manually > > in the django shell: it works without problems using sqlite3. > > I'm a little fuzzy on what works and doesn't work here. Sounds like you > have a Windows development machine where you use sqlite3 and all works OK? > Also all is OK on your production Linux machine (running the server under > Apache...something else?) so long as the Linux machine is set up to use > MySQL? But if you change settings on the production machine to use sqlite3 > you get the error? > > You say you can duplicate the essence of the code and run it in the shell OK > -- you mean on the same machine where you are seeing the error? > > How about some absolutely trivial regex filter in the environment where you > see the failure? Never mind duplicating the complexity of your real code -- > can you get a trivial regex filter to work there? If yes, then you can > modify it step by step and figure out where the error crops up, which might > give a clue. > > > > > I thought that the query or the params in the final traceback > > statement: > > > return Database.Cursor.execute(self, query, params) > > > might be mangled somehow. I enclosed that statment in base.py > > with a try - except clause and raised my own Exception, to view > > the SQL and the param: they were as expected (from looking at > > connection.queries[-1]['sql'] while running the code manually in the > > django shell). > > > I'm mystified at this point. Thanks for looking into this. > > Unfortunately the sqlite error message is not very informative. You can see > the user-defined function involved in regex handling here: > > http://code.djangoproject.com/browser/django/tags/releases/1.0/django... > > It's got a try/except around everything (all 1line) except 'import re', so > I'm puzzled how that could be raising an exception. But you could add some > logging to it, and perhaps the other user-defined functions registered for > the connection, you can see them all here: > > http://code.djangoproject.com/browser/django/tags/releases/1.0/django... > > and see if that sheds any light. > > Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

