Hi again. Oleg, Thank you for your prompt answer. reg. the StringCol(customSQLType='VARCHAR (255) COLLATE debian') I think I want sqlType instead as customSQLType is not a parameter of the class StringCol.
The other problem is a bit more complicated. The idea, if I understand correctly, is to modify the TableClass with a new connection factory. I don't kind of understand why I've to do this for one SQLObject in particular... Should this collation be registered to a db connection ? Below my attempt to modify the function that you pointed out. Then I call the function sqlite_collate(MyDBClass) before creating the table with MyDBClass.createTable(). It doesn't work and I'm stuck ... Can you give me a little more help ? thanks again :) pp ---------- def setSQLiteConnectionFactory(TableClass, factory): from sqlobject.sqlite.sqliteconnection import SQLiteConnection conn = TableClass._connection print dir(conn) TableClass._connection = SQLiteConnection( filename=conn.filename, name=conn.name, debug=conn.debug, debugOutput=conn.debugOutput, cache=conn.cache, style=conn.style, autoCommit=conn.autoCommit, debugThreading=conn.debugThreading, registry=conn.registry, factory=factory ) def sqlite_collate(obj): if obj._connection.dbName == "sqlite": from sqlobject.sqlite import sqliteconnection if not sqliteconnection.using_sqlite2: return def SQLiteConnectionFactory(sqlite): class MyConnection(sqlite.Connection): def __init__(self, *args, **kwargs): super(MyConnection, self).__init__(*args, **kwargs) self.create_collation("debian", self.collate_debian) def collate_debian(string1, string2): return apt_pkg.VersionCompare(string1, string2) return MyConnection setSQLiteConnectionFactory(obj,SQLiteConnectionFactory) On Wed, Jun 25, 2008 at 04:33:55PM +0400, Oleg Broytmann wrote: > On Wed, Jun 25, 2008 at 02:19:13PM +0200, Pietro Abate wrote: > > if conn.dbName == 'sqlite': > > conn.getConnection().create_collation("debian", mycollate) > > > > where mycollate is a simple comparison function. I'm still not sure if this > > is possible or not... > > I think it's possible but in the hard way. See how custom aggregate > functions are implemented in the test suite: > http://svn.colorstudy.com/SQLObject/trunk/sqlobject/tests/test_sqlite_factory.py > > > - How can I add the COLLATE contrains to one of my column while I'm > > creating the > > table ? I haven't found anything like StringCol(collate='debian') or > > similar... > > Is this possible, or I've to create the table 'manually' ? > > You can use customSQLType: > StringCol(customSQLType='VARCHAR (255) COLLATE debian') > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > sqlobject-discuss mailing list > sqlobject-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss