{"action":"created","issue":{"url":"https://api.github.com/repos/dg/dibi/issues/234","repository_url":"https://api.github.com/repos/dg/dibi","labels_url":"https://api.github.com/repos/dg/dibi/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/dg/dibi/issues/234/comments","events_url":"https://api.github.com/repos/dg/dibi/issues/234/events","html_url":"https://github.com/dg/dibi/issues/234","id":170310236,"number":234,"title":"Datetime BETWEEN wrong fetch","user":{"login":"Dreiser","id":1800427,"avatar_url":"https://avatars.githubusercontent.com/u/1800427?v=3","gravatar_id":"","url":"https://api.github.com/users/Dreiser","html_url":"https://github.com/Dreiser","followers_url":"https://api.github.com/users/Dreiser/followers","following_url":"https://api.github.com/users/Dreiser/following{/other_user}","gists_url":"https://api.github.com/users/Dreiser/gists{/gist_id}","starred_url":"https://api.github.com/users/Dreiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dreiser/subscriptions","organizations_url":"https://api.github.com/users/Dreiser/orgs","repos_url":"https://api.github.com/users/Dreiser/repos","events_url":"https://api.github.com/users/Dreiser/events{/privacy}","received_events_url":"https://api.github.com/users/Dreiser/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-10T01:47:53Z","updated_at":"2016-08-10T12:23:26Z","closed_at":null,"body":"I possibly found bug when using BETWEEN (or timestamp >= %t AND `timestamp` <= %t) on timestamp column.\r\n\r\nIf I run same fluent with test() and then execute directly in database, it return rows. Hovewer if I change test() to fetchAll() result count is 0. If I remove one of sides (>=, <=) it works fine. I am 100% sure that between condition is met. \r\n\r\nBILL::RECEIVED is timestamp, $receivedFrom and $receivedTo are instances of DibiDateTime. Casting in SQL to same type do not help either.\r\n\r\n// array(0) {}\r\nvar_dump($this->getTable()\r\n    ->where([\r\n        ['%n BETWEEN %t AND %t', Bill::RECEIVED, $receivedFrom, $receivedTo],\r\n        ['%n = %i', Bill::BRANCH_ID, $branchId],\r\n        ['%n = %f', Bill::AMOUNT, $amount]\r\n     ])\r\n     ->fetchAll());\r\n// After manual execution rows are returned\r\n$this->getTable()\r\n        ->where([\r\n            ['%n BETWEEN %t AND %t', Bill::RECEIVED, $receivedFrom, $receivedTo],\r\n            ['%n = %i', Bill::BRANCH_ID, $branchId],\r\n            ['%n = %f', Bill::AMOUNT, $amount]\r\n        ])\r\n        ->test();\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dg/dibi/issues/comments/238850482","html_url":"https://github.com/dg/dibi/issues/234#issuecomment-238850482","issue_url":"https://api.github.com/repos/dg/dibi/issues/234","id":238850482,"user":{"login":"alesculek","id":3257430,"avatar_url":"https://avatars.githubusercontent.com/u/3257430?v=3","gravatar_id":"","url":"https://api.github.com/users/alesculek","html_url":"https://github.com/alesculek","followers_url":"https://api.github.com/users/alesculek/followers","following_url":"https://api.github.com/users/alesculek/following{/other_user}","gists_url":"https://api.github.com/users/alesculek/gists{/gist_id}","starred_url":"https://api.github.com/users/alesculek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alesculek/subscriptions","organizations_url":"https://api.github.com/users/alesculek/orgs","repos_url":"https://api.github.com/users/alesculek/repos","events_url":"https://api.github.com/users/alesculek/events{/privacy}","received_events_url":"https://api.github.com/users/alesculek/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T12:23:26Z","updated_at":"2016-08-10T12:23:26Z","body":"Which driver? And can you paste generated sql (string)$fluent?"}}
{"actor":{"display_login":"alesculek"}}