On 2006-0731 13:26:19, Christoph Zwerschke wrote:
> Mario Frasca wrote:
> 
> > what about passing the whole module as a parameter?
> 
> I think a constant is better because it allows also other modes such as
> returning dates as tuples.

I'm not sure I see your point.  mine was this:

import datetime, mx.DateTime, pgdb
ddb = pgdb.connect(user = ..., ..., datestyle = datetime)
xdb = pgdb.connect(user = ..., ..., datestyle = mx.DateTime)
sdb = pgdb.connect(user = ..., ..., datestyle = 'ISO')

what do you mean, 'dates as tuples'?  as long as that is not a subtype
of datetime nor mx.DateTime, I don't see the problem.  is there any?

> > [...] reject
> > all subsequent user 'set datestyle' commands, as they would break
> > the conversion [...]
> 
> I already thought about that, but do we really want the interface to
> intercept such commands and interfere with them? It somehow does not
> feel right. By the way, the user would still see the effect of changing
> the datestyle when he casts dates to strings via SQL.

oeps.  this last sentence states a possible concrete need of the user
to change the datestyle in the connection...  I had not considered this.

otherwise (without this example) I would say that it does not feel
right to change the datestyle on which the library counts...  all right,
maybe not intercept the commands to reject them, but possibly to keep
track of the current datestyle without the need to poll for it each time
a date|datetime|timedelta value is retrieved.

> As I suggested we could make it a settable attribute of the connection,
> as it is realized in mx.ODBC.

if we intercept 'set datestyle' commands to keep track of the current
datestyle, this function would be unnecessary.

you know what?  I think we have spoken enough and that it might be time
to start coding something...  I'm going further from the released 3.8
version, or let me know where I can find a most recent cvs image...  

I will post my patches here, but you can also follow me on
http://ibo.cvs.sourceforge.net/ibo/ibo3/python/PyGreSQL/?pathrev=latest_3_8

ciao,
Mario

-- 
on computer's day, give your pc a real operating system.
http://www.knoppix.org/
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql

Reply via email to