crystal-mysql icon indicating copy to clipboard operation
crystal-mysql copied to clipboard

Make MYSQL_TYPE_DATETIME packet length to 11

Open metacortex opened this issue 7 years ago • 3 comments

According to doc, valid length values are 0, 4, 7, 11. https://dev.mysql.com/doc/internals/en/binary-protocol-value.html

Sometimes DateTime type param is truncated to '' by the following param.

(Before)
170310  4:15:46	 1899 Connect	root@localhost on jericho
		 1899 Prepare	SELECT posts.* FROM posts WHERE posted_at BETWEEN ? AND ? LIMIT 5
		 1899 Execute	SELECT posts.* FROM posts WHERE posted_at BETWEEN '' AND '2017-03-03 15:59:59' LIMIT 5

(After)
170310  4:15:56	 1900 Connect	root@localhost on jericho
		 1900 Prepare	SELECT posts.* FROM posts WHERE posted_at BETWEEN ? AND ? LIMIT 5
		 1900 Execute	SELECT posts.* FROM posts WHERE posted_at BETWEEN '2017-03-02 16:00:00' AND '2017-03-03 15:59:59' LIMIT 5

mysql Ver 14.14 Distrib 5.6.34, for osx10.12 (x86_64) using EditLine wrapper

Crystal 0.21.1 (2017-03-07) LLVM 3.9.1

metacortex avatar Mar 09 '17 19:03 metacortex

In my MacBook, running spec in the docker image MySQL:5.7 has passed successfully.

metacortex avatar Mar 09 '17 22:03 metacortex

@metacortex the PR has twice v.millisecond*1000/65536, may you clean the history of this and a spec that would fail before the change but passes after it?

bcardiff avatar Mar 30 '17 20:03 bcardiff

@bcardiff Fixed it. Thanks

metacortex avatar Mar 31 '17 16:03 metacortex