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 YEAR类型binlog输出使用short替换Date #31

Closed
agapple opened this issue Apr 10, 2013 · 0 comments
Closed

mysql YEAR类型binlog输出使用short替换Date #31

agapple opened this issue Apr 10, 2013 · 0 comments
Assignees
Milestone

Comments

@agapple
Copy link
Member

agapple commented Apr 10, 2013

问题: mysql YEAR类型在canal1.0.3版本中使用了java.sql.Date对象来标示,无法准确的表示一个年份信息,原本一个年份2013,输出结果会是:2013-01-01

if (cal == null)
cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.YEAR, i32 + 1900);
value = new java.sql.Date(cal.getTimeInMillis());

解决:

  1. 直接使用数字存储表示,protobuf输出结果为2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant