Il giorno mar, 17/04/2007 alle 00.05 -0400, Jim Patterson ha scritto: > Over on the cx_Oracle list we have been discussing adding support > for returning native Unicode strings and decimal objects. We have > so far been talking about using a settable attribute on the connection > and the cursor with the cursor inheriting the value from the > connection > by default. The is very similar to the existing technique used > by cx_Oracle for the "numbersAsString" and the technique used > by mxODBC for the "stringFormat" and "datetimeFormat". > > Anyone have any thoughts/feelings/opinions about moving towards > standardizing how we do this kind of thing across the different > database modules?
psycopg's type system is one of its best features (and one loved by users I was told). At any time you can create a new "type" as nt = psycopg2.new_type((oid1, oid2, ...), "name", typecast_func) and then register it using "psycopg2.register_type(nt)". This has 2 effects: 1. data described by listed oids (this is PostgreSQL-specific, I know) is converted using the function "typecast_func"; and 2. you can use "nt" as a type object in comparaisons, just like other type object in the dbapi (STRING, NUMERIC, etc...) federico -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer [EMAIL PROTECTED] INIT.D Developer [EMAIL PROTECTED] Se consideri l'uso del software libero una concessione tu stesso, come potrai proporla agli altri? -- Nick Name
signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig