Added support for time zone config setting for PostgreSql adapter. #791

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@nealerickson

Added support for a timezone parameter in the connection config for the PostgreSql adapter. Allows you to control the time zone that is used for your database connection. Important to be able to enforce the connection time zone when dealing with time zone aware timestamps.

@nateabele nateabele commented on the diff Jan 20, 2013
data/source/database/adapter/PostgreSql.php
@@ -81,7 +81,12 @@ class PostgreSql extends \lithium\data\source\Database {
* list of active connections.
*/
public function __construct(array $config = array()) {
- $defaults = array('host' => 'localhost:5432', 'encoding' => null, 'schema' => 'public');
+ $defaults = array(
+ 'host' => 'localhost:5432',
+ 'encoding' => null,
+ 'schema' => 'public',
+ 'timezone' => null
@nateabele
nateabele Jan 20, 2013 Union of RAD member

Looking at the patch, I'm struggling to see how setting 'timezone' in the connection settings would have any effect. Did you mean to add a check/call to timezone() in PostgreSql::connect()?

@nealerickson

Oops. Looks like when I moved my changes into my branch I forgot the call to timezone(). Sorry, I'll close and re-submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment