For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > December 2007 > Re: [PHP-DB] PDO::TIME_ZONE and or Initializing Query









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] PDO::TIME_ZONE and or Initializing Query
Chris

2007-12-20, 9:59 pm

Paul Rogers wrote:
> It would be helpful if the time zone of a session could be specified at
> the time of the connection. This would avoid the overhead of a separate
> database query and round-trip to the database server when a single,
> non-default time zone is needed for the duration of the connection.
>
> Naturally there is the option of using GMT and dealing with the time
> zone offsets entirely in PHP or at some other layer. However, many large
> databases systems support connection-specific time zones and I've found
> them to be quite useful.
>
> It may also be useful as a way to set the time zone after the connection
> is made using "setAttribute".
>
> Since several supported systems are not time-zone aware, such as Sqlite,
> the attribute would not always have an effect. Or it could be
> implemented as a server-specific attribute such as "MYSQL_TIME_ZONE" or
> "PGSQL_TIME_ZONE".
>
> If a TIME_ZONE attribute seems inappropriate then another idea is to
> provide an optional, initialization query when creating the PDO object.
> For example, a "SET TIME ZONE 'CST6CDT'" query could be issued to set
> the time zone immediately after the connection is made. Such a mechanism
> may have other uses for queries that do not require processing the
> response.


I think the problem here is that each database type handles it all
differently, hence why you have to do it yourself.

If you want to put it to the developers, join the -internals list and
discuss the idea there.

--
Postgresql & php tutorials
http://www.designmagick.com/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com