Applied to docs and committed in the revision 2207. Thank you!
On Mon, Jan 15, 2007 at 09:03:03AM +0100, Felix Schwarz wrote:
> import MySQLdb.converters
> import sqlobject
> import time
>
> def _mysql_timestamp_converter(raw):
> """Convert a MySQL TIMESTAMP to a floating point number representing
> the seconds since the Un*x Epoch. It uses custom code the input
> seems
> to be the new (MySQL 4.1+) timestamp format, otherwise code from the
> MySQLdb module is used."""
> if raw[4] == '-':
> return time.mktime(time.strptime(raw, '%Y-%m-%d %H:%M:%S'))
> else:
> return MySQLdb.converters.mysql_timestamp_converter(raw)
>
> conversions = MySQLdb.converters.conversions.copy()
> conversions[MySQLdb.constants.FIELD_TYPE.TIMESTAMP] =
> _mysql_timestamp_converter
>
> MySQLConnection = sqlobject.mysql.builder()
> connection = MySQLConnection(user='foo', db='somedb', conv=conversions)
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss