|
18 | 18 | package org.apache.phoenix.end2end;
|
19 | 19 |
|
20 | 20 | import org.apache.phoenix.util.SchemaUtil;
|
21 |
| -import org.junit.Ignore; |
22 | 21 | import org.junit.Test;
|
23 | 22 | import org.junit.experimental.categories.Category;
|
24 | 23 |
|
25 | 24 | import java.sql.Connection;
|
26 | 25 | import java.sql.DriverManager;
|
27 | 26 | import java.sql.ResultSet;
|
| 27 | +import java.sql.Statement; |
28 | 28 | import java.util.Properties;
|
29 | 29 |
|
30 | 30 | import static org.apache.phoenix.query.QueryConstants.DEFAULT_COLUMN_FAMILY;
|
@@ -350,4 +350,24 @@ public void testShowCreateTableIndex() throws Exception {
|
350 | 350 | assertTrue("Expected: " + createIndex + "\nResult: " + rs.getString(1),
|
351 | 351 | rs.getString(1).contains(createIndex));
|
352 | 352 | }
|
| 353 | + |
| 354 | + @Test |
| 355 | + public void testShowCreateTableUsingGetResultSet() throws Exception { |
| 356 | + Properties props = new Properties(); |
| 357 | + Connection conn = DriverManager.getConnection(getUrl(), props); |
| 358 | + String tableName = generateUniqueName(); |
| 359 | + String schemaName = generateUniqueName(); |
| 360 | + String tableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName); |
| 361 | + String ddl = "CREATE TABLE " + tableFullName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)"; |
| 362 | + conn.createStatement().execute(ddl); |
| 363 | + try (Statement statement = conn.createStatement()) { |
| 364 | + boolean execute = statement.execute("SHOW CREATE TABLE " + tableFullName); |
| 365 | + if (execute) { |
| 366 | + try (ResultSet rs = statement.getResultSet()) { |
| 367 | + assertTrue(rs.next()); |
| 368 | + assertTrue(rs.getString(1).contains(tableFullName)); |
| 369 | + } |
| 370 | + } |
| 371 | + } |
| 372 | + } |
353 | 373 | }
|
0 commit comments