com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection Java Examples
The following examples show how to use
com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableMetaCacheTest.java From canal-1.1.3 with Apache License 2.0 | 6 votes |
@Test public void testSimple() throws IOException { MysqlConnection connection = new MysqlConnection(new InetSocketAddress("127.0.0.1", 3306), "root", "hello"); try { connection.connect(); } catch (IOException e) { Assert.fail(e.getMessage()); } List<ResultSetPacket> packets = connection.queryMulti("show create table test.ljh_test"); String createDDL = null; if (packets.get(0).getFieldValues().size() > 0) { createDDL = packets.get(0).getFieldValues().get(1); } System.out.println(createDDL); // TableMetaCache cache = new TableMetaCache(connection); // TableMeta meta = cache.getTableMeta("otter1", "otter_stability1"); // Assert.assertNotNull(meta); // for (FieldMeta field : meta.getFields()) { // System.out.println("filed :" + field.getColumnName() + " , isKey : " // + field.isKey() + " , isNull : " // + field.isNullable()); // } }
Example #2
Source File: TableMetaCacheTest.java From canal with Apache License 2.0 | 6 votes |
@Test public void testSimple() throws IOException { MysqlConnection connection = new MysqlConnection(new InetSocketAddress("127.0.0.1", 3306), "root", "hello"); try { connection.connect(); } catch (IOException e) { Assert.fail(e.getMessage()); } List<ResultSetPacket> packets = connection.queryMulti("show create table test.ljh_test"); String createDDL = null; if (packets.get(0).getFieldValues().size() > 0) { createDDL = packets.get(0).getFieldValues().get(1); } System.out.println(createDDL); // TableMetaCache cache = new TableMetaCache(connection); // TableMeta meta = cache.getTableMeta("otter1", "otter_stability1"); // Assert.assertNotNull(meta); // for (FieldMeta field : meta.getFields()) { // System.out.println("filed :" + field.getColumnName() + " , isKey : " // + field.isKey() + " , isNull : " // + field.isNullable()); // } }
Example #3
Source File: DatabaseTableMeta.java From canal-1.1.3 with Apache License 2.0 | 4 votes |
public void setConnection(MysqlConnection connection) { this.connection = connection; }
Example #4
Source File: DatabaseTableMeta.java From canal-1.1.3 with Apache License 2.0 | 4 votes |
public MysqlConnection getConnection() { return connection; }
Example #5
Source File: DatabaseTableMeta.java From canal with Apache License 2.0 | 4 votes |
public void setConnection(MysqlConnection connection) { this.connection = connection; }
Example #6
Source File: DatabaseTableMeta.java From canal with Apache License 2.0 | 4 votes |
public MysqlConnection getConnection() { return connection; }