@@ -370,6 +370,7 @@ public void testMultilineScriptWithH2Comments() {
370
370
final String script = "\n "
371
371
+ "\n "
372
372
+ "!set incremental true\n "
373
+ + "!set maxColumnWidth 10\n "
373
374
+ "\n "
374
375
+ "\n "
375
376
+ "select * from information_schema.tables// ';\n "
@@ -388,8 +389,8 @@ public void testMultilineScriptWithH2Comments() {
388
389
"--run=" + tmpHistoryFile .getAbsolutePath ());
389
390
assertThat (status , equalTo (SqlLine .Status .OK ));
390
391
String output = os .toString ("UTF8" );
391
- final String expected = "| TABLE_CATALOG | TABLE_SCHEMA |"
392
- + " TABLE_NAME | TABLE_TYPE | STORAGE_TYPE | SQL | " ;
392
+ final String expected = "| UNNAMED |"
393
+ + " INFORMATION_SCHEMA | ENUM_VALUES | BASE TABLE " ;
393
394
assertThat (output , containsString (expected ));
394
395
sqlLine .runCommands (new DispatchCallback (), "!quit" );
395
396
assertTrue (sqlLine .isExit ());
@@ -1593,14 +1594,15 @@ String readPassword(String url) {
1593
1594
DispatchCallback dc = new DispatchCallback ();
1594
1595
sqlLine .runCommands (dc ,
1595
1596
"!set maxwidth 80" ,
1597
+ "!set maxColumnWidth 10" ,
1596
1598
"!set incremental true" );
1597
1599
sqlLine .runCommands (dc , "!connect "
1598
1600
+ ConnectionSpec .H2 .url + " "
1599
1601
+ ConnectionSpec .H2 .username );
1600
1602
sqlLine .runCommands (dc , "!tables" );
1601
1603
String output = os .toString ("UTF8" );
1602
- final String expected = "| TABLE_CAT | TABLE_SCHEM | "
1603
- + "TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYP |" ;
1604
+ final String expected = "| TABLE_CAT | TABLE_SCHEM |"
1605
+ + " TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |" ;
1604
1606
assertThat (output , containsString (expected ));
1605
1607
sqlLine .runCommands (new DispatchCallback (), "!quit" );
1606
1608
assertTrue (sqlLine .isExit ());
@@ -1627,6 +1629,7 @@ public void testConnectWithDbPropertyAsParameter() {
1627
1629
DispatchCallback dc = new DispatchCallback ();
1628
1630
sqlLine .runCommands (dc ,
1629
1631
"!set maxwidth 80" ,
1632
+ "!set maxColumnWidth 10\n " ,
1630
1633
"!set incremental true" );
1631
1634
String fakeNonEmptyPassword = "nonEmptyPasswd" ;
1632
1635
final byte [] bytes =
@@ -1638,8 +1641,8 @@ public void testConnectWithDbPropertyAsParameter() {
1638
1641
+ StringUtils .convertBytesToHex (bytes ));
1639
1642
sqlLine .runCommands (dc , "!tables" );
1640
1643
String output = os .toString ("UTF8" );
1641
- final String expected = "| TABLE_CAT | TABLE_SCHEM | "
1642
- + "TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYP |" ;
1644
+ final String expected = "| TABLE_CAT | TABLE_SCHEM |"
1645
+ + " TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |" ;
1643
1646
assertThat (output , containsString (expected ));
1644
1647
sqlLine .runCommands (new DispatchCallback (), "!quit" );
1645
1648
assertTrue (sqlLine .isExit ());
@@ -1703,7 +1706,7 @@ public void testConnectWithDbProperty() {
1703
1706
DispatchCallback dc = new DispatchCallback ();
1704
1707
1705
1708
try {
1706
- sqlLine .runCommands (dc , "!set maxwidth 80" );
1709
+ sqlLine .runCommands (dc , "!set maxwidth 80" , "!set maxColumnWidth 10" );
1707
1710
1708
1711
// fail attempt
1709
1712
String fakeNonEmptyPassword = "nonEmptyPasswd" ;
@@ -1729,8 +1732,8 @@ public void testConnectWithDbProperty() {
1729
1732
sqlLine .runCommands (dc , "!set incremental true" );
1730
1733
sqlLine .runCommands (dc , "!tables" );
1731
1734
output = os .toString ("UTF8" );
1732
- final String expected1 = "| TABLE_CAT | TABLE_SCHEM | "
1733
- + "TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYP |" ;
1735
+ final String expected1 = "| TABLE_CAT | TABLE_SCHEM |"
1736
+ + " TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |" ;
1734
1737
assertThat (output , containsString (expected1 ));
1735
1738
1736
1739
sqlLine .runCommands (dc , "select 5;" );
@@ -1864,10 +1867,11 @@ public void testTablesH2() {
1864
1867
// Set width so we don't inherit from the current terminal.
1865
1868
final String script = "!set maxwidth 80\n "
1866
1869
+ "!set incremental true\n "
1870
+ + "!set maxColumnWidth 10\n "
1867
1871
+ "!tables\n " ;
1868
- final String line0 = "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |" ;
1872
+ final String line0 = "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |" ;
1869
1873
final String line1 =
1870
- "| UNNAMED | INFORMATION_SCHEMA | CATALOGS | SYSTEM TABLE" ;
1874
+ "| UNNAMED | INFORMATION_SCHEMA | CONSTANTS | BASE TABLE" ;
1871
1875
checkScriptFile (script , true , equalTo (SqlLine .Status .OK ),
1872
1876
allOf (containsString (line0 ), containsString (line1 )));
1873
1877
}
@@ -1878,11 +1882,12 @@ public void testTablesWithTablePattern() {
1878
1882
// Set width so we don't inherit from the current terminal.
1879
1883
final String script = "!set maxwidth 80\n "
1880
1884
+ "!set incremental true\n "
1881
- + "!tables CATALO%\n " ;
1885
+ + "!set maxColumnWidth 10\n "
1886
+ + "!tables INDEXES%\n " ;
1882
1887
final String line0 =
1883
- "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYP |\n " ;
1888
+ "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |\n " ;
1884
1889
final String line1 =
1885
- "| UNNAMED | INFORMATION_SCHEMA | CATALOGS | SYSTEM TABLE | | |\n " ;
1890
+ "| UNNAMED | INFORMATION_SCHEMA | INDEXES | BASE TABLE | | |\n " ;
1886
1891
checkScriptFile (script , true , equalTo (SqlLine .Status .OK ),
1887
1892
allOf (containsString (line0 ), containsString (line1 )));
1888
1893
}
@@ -1893,11 +1898,12 @@ public void testTablesWithSchemaTableType() {
1893
1898
// Set width so we don't inherit from the current terminal.
1894
1899
final String script = "!set maxwidth 80\n "
1895
1900
+ "!set incremental true\n "
1896
- + "!tables INFORMATION_% CAT% \" SYSTEM TABLE\" \n " ;
1901
+ + "!set maxColumnWidth 10\n "
1902
+ + "!tables INFORMATION_% \n " ;
1897
1903
final String line0 =
1898
- "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT | TYP |\n " ;
1904
+ "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |\n " ;
1899
1905
final String line1 =
1900
- "| UNNAMED | INFORMATION_SCHEMA | CATALOGS | SYSTEM TABLE | | |\n " ;
1906
+ "| UNNAMED | INFORMATION_SCHEMA | INFORMATION_SCHEMA_CATALOG_NAME | BASE TAB |\n " ;
1901
1907
checkScriptFile (script , true , equalTo (SqlLine .Status .OK ),
1902
1908
allOf (containsString (line0 ), containsString (line1 )));
1903
1909
}
@@ -1907,12 +1913,13 @@ public void testColumnsWithSchemaTableType() {
1907
1913
connectionSpec = ConnectionSpec .H2 ;
1908
1914
// Set width so we don't inherit from the current terminal.
1909
1915
final String script = "!set maxwidth 80\n "
1916
+ + "!set maxColumnWidth 10\n "
1910
1917
+ "!set incremental true\n "
1911
- + "!columns INFORMATION% CAT% CAT %\n " ;
1918
+ + "!columns INFORMATION_SCHEMA % %\n " ;
1912
1919
final String line0 =
1913
- "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME |\n " ;
1920
+ "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME |\n " ;
1914
1921
final String line1 =
1915
- "| UNNAMED | INFORMATION_SCHEMA | CATALOGS | CATALOG_NAME | 12 | V |\n " ;
1922
+ "| UNNAMED | INFORMATION_SCHEMA | CHECK_CONSTRAINTS | CONSTRAINT_CATALOG | 1 |\n " ;
1916
1923
checkScriptFile (script , true , equalTo (SqlLine .Status .OK ),
1917
1924
allOf (containsString (line0 ), containsString (line1 )));
1918
1925
}
@@ -1942,10 +1949,11 @@ public void testTablesH2WithErrorDriver() {
1942
1949
// Set width so we don't inherit from the current terminal.
1943
1950
final String script = "!set maxwidth 80\n "
1944
1951
+ "!set incremental true\n "
1952
+ + "!set maxColumnWidth 10\n "
1945
1953
+ "!tables\n " ;
1946
- final String line0 = "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |" ;
1954
+ final String line0 = "| TABLE_CAT | TABLE_SCHEM | TABLE_NAME |" ;
1947
1955
final String line1 =
1948
- "| UNNAMED | INFORMATION_SCHEMA | CATALOGS | SYSTEM TABLE" ;
1956
+ "| UNNAMED | INFORMATION_SCHEMA | CONSTANTS | BASE TABLE" ;
1949
1957
final String message = "Could not find driver "
1950
1958
+ connectionSpec .driver
1951
1959
+ "; using registered driver org.h2.Driver instead" ;
@@ -2338,7 +2346,7 @@ public List<String> allowedDrivers() {
2338
2346
+ " sqlline.extensions.CustomApplication\n "
2339
2347
+ "!scan" ;
2340
2348
checkScriptFile (script , true , equalTo (SqlLine .Status .OK ),
2341
- allOf (containsString ("yes 1.4 org.h2.Driver" ),
2349
+ allOf (containsString ("yes 2.1 org.h2.Driver" ),
2342
2350
not (containsString ("org.hsqldb.jdbc.JDBCDriver" ))));
2343
2351
}
2344
2352
0 commit comments