Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL - different datetime and timestamp value in dibi and mysql console #322

Open
integer opened this issue Nov 1, 2018 · 1 comment
Open

Comments

@integer
Copy link
Contributor

integer commented Nov 1, 2018

Version: 3.2.2

Bug Description

For historic reason I have table with two columns for date with different type - first is datetime, second is timestamp. In both columns were stored same values: 2018-07-27 10:35:13.

From Mysql console I can call this query with same result in both columns.

SELECT o.a AS dt, o.b AS ts FROM table_name o WHERE o.xxx = '123' ;
+---------------------+---------------------+
| dt                  | ts                  |
+---------------------+---------------------+
| 2018-07-27 10:35:13 | 2018-07-27 10:35:13 |
+---------------------+---------------------+
1 row in set (0.00 sec)

Same query called with dibi (fluent) results this:

object(Dibi\Row)#116 (2) {
  ["dt"]=>
  object(Dibi\DateTime)#110 (3) {
    ["date"]=>
    string(26) "2018-07-27 10:35:13.000000"
    ["timezone_type"]=>
    int(3)
    ["timezone"]=>
    string(13) "Europe/Prague"
  }
  ["ts"]=>
  object(Dibi\DateTime)#115 (3) {
    ["date"]=>
    string(26) "2018-07-27 09:35:13.000000"
    ["timezone_type"]=>
    int(3)
    ["timezone"]=>
    string(13) "Europe/Prague"
  }
}

You can see that ts has diffrent value. This issue starts after end of summer time.

Steps To Reproduce

Described in Bug Description

Expected Behavior

Same result as in Mysql console.

Possible Solution

I don't know. Code in Result::normalize() looks ok.

@integer
Copy link
Contributor Author

integer commented Nov 1, 2018

I found that every connection from Dibi gets timezone configuration in connect() method: https://github.com/dg/dibi/blob/master/src/Dibi/Drivers/MySqliDriver.php#L67 Why? And is it safe to disable this default configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant