|
15 | 15 | */
|
16 | 16 | package com.github.shyiko.mysql.binlog.event.deserialization;
|
17 | 17 |
|
18 |
| -import com.github.shyiko.mysql.binlog.event.EventData; |
19 |
| -import com.github.shyiko.mysql.binlog.event.TableMapEventData; |
20 |
| -import com.github.shyiko.mysql.binlog.io.ByteArrayInputStream; |
21 |
| - |
22 | 18 | import java.io.IOException;
|
23 | 19 | import java.io.Serializable;
|
24 | 20 | import java.math.BigDecimal;
|
|
27 | 23 | import java.util.Map;
|
28 | 24 | import java.util.TimeZone;
|
29 | 25 |
|
| 26 | +import com.github.shyiko.mysql.binlog.event.EventData; |
| 27 | +import com.github.shyiko.mysql.binlog.event.TableMapEventData; |
| 28 | +import com.github.shyiko.mysql.binlog.io.ByteArrayInputStream; |
| 29 | + |
30 | 30 | /**
|
31 | 31 | * Whole class is basically a mix of <a href="https://code.google.com/p/open-replicator">open-replicator</a>'s
|
32 | 32 | * AbstractRowEventParser and MySQLUtils. Main purpose here is to ease rows deserialization.<p>
|
@@ -170,6 +170,8 @@ protected Serializable deserializeCell(ColumnType type, int meta, int length, By
|
170 | 170 | return deserializeSet(length, inputStream);
|
171 | 171 | case GEOMETRY:
|
172 | 172 | return deserializeGeometry(meta, inputStream);
|
| 173 | + case JSON: |
| 174 | + return deserializeJson(meta, inputStream); |
173 | 175 | default:
|
174 | 176 | throw new IOException("Unsupported type " + type);
|
175 | 177 | }
|
@@ -329,6 +331,11 @@ protected byte[] deserializeGeometry(int meta, ByteArrayInputStream inputStream)
|
329 | 331 | return inputStream.read(dataLength);
|
330 | 332 | }
|
331 | 333 |
|
| 334 | + protected byte[] deserializeJson(int meta, ByteArrayInputStream inputStream) throws IOException { |
| 335 | + int blobLength = inputStream.readInteger(meta); |
| 336 | + return inputStream.read(blobLength); |
| 337 | + } |
| 338 | + |
332 | 339 | // checkstyle, please ignore ParameterNumber for the next line
|
333 | 340 | private static Long asUnixTime(int year, int month, int day, int hour, int minute, int second, int millis) {
|
334 | 341 | // https://dev.mysql.com/doc/refman/5.0/en/datetime.html
|
|
0 commit comments