PDO::TIME_ZONE and or Initializing Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux