Hello!
I want to create a user-defined function for SQLite. PySQLite2 allows it
but only on the (low-level) connection. With SQLObject I have a high-level
DBConnecion that calls self.getConnection() (and .makeConnection) to get
the low-level connection. I didn't found a way to use that low-level
connection so I implemented a dirty hack by substituting .getConnection
method:
if TestTable._connection.dbName == "sqlite":
import re
def regexp(regexp, test):
return bool(re.search(regexp, test))
_get_connection = TestTable._connection.getConnection
def new_get_connection(*args, **kw):
_connection = _get_connection(*args, **kw)
_connection.create_function("regexp", 2, regexp)
return _connection
TestTable._connection.getConnection = new_get_connection
It works but it's an ugly and dirty hack. Any idea how can I access and
customize the low-level connection?
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss