Skip to content

Commit 80c29dd

Browse files
authored
Merge pull request osheroff#114 from jpechane/year-metadata
Handle YEAR as numeric for metadata processing
2 parents 2dffbd0 + 8753050 commit 80c29dd

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/TableMapEventDataDeserializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ private int numericColumnCount(byte[] types) {
6666
case NEWDECIMAL:
6767
case FLOAT:
6868
case DOUBLE:
69+
case YEAR:
6970
count++;
7071
break;
7172
default:

src/test/java/com/github/shyiko/mysql/binlog/BinaryLogClientIntegrationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ public void testDeserializationOfYEAR() throws Exception {
275275
assertEquals(writeAndCaptureRow("year", "'69'"), new Serializable[]{2069});
276276
}
277277

278+
@Test
279+
public void testDeserializationOfYEARAndSignedness() throws Exception {
280+
assertEquals(writeAndCaptureRow(
281+
"int(20) NOT NULL AUTO_INCREMENT, `c2` year, `c3` int, `c4` int, `c5` int, `c6` int, `c7` int, `c8` int, `c9` int, c10 char(10), PRIMARY KEY (`column_`)",
282+
"1, 2, 3, 4, 5, 6, 7, 8, 9, ''"),
283+
new Serializable[]{1});
284+
}
285+
278286
@Test
279287
public void testDeserializationOfSTRING() throws Exception {
280288
assertEquals(writeAndCaptureRow("char", "'q'"), new Serializable[]{"q".getBytes("UTF-8")});

0 commit comments

Comments
 (0)