2020
2121import java .sql .Connection ;
2222import java .sql .SQLException ;
23- import java .util .List ;
23+ import java .util .Collection ;
2424
2525import static org .firebirdsql .gds .ISCConstants .*;
2626import static org .firebirdsql .gds .VaxEncoding .iscVaxInteger2 ;
2727import static org .firebirdsql .gds .VaxEncoding .iscVaxLong ;
2828
2929/**
30- * The < code> FBStatisticsManager</code> class is responsible for replicating the functionality of
31- * the < code> gstat</code> command-line tool.
30+ * The {@ code FBStatisticsManager} class is responsible for replicating the functionality of
31+ * the {@ code gstat} command-line tool.
3232 * <p>
3333 * This functionality includes:
3434 * <ul>
@@ -49,16 +49,13 @@ public class FBStatisticsManager extends FBServiceManager implements StatisticsM
4949 RECORD_VERSION_STATISTICS ;
5050
5151 /**
52- * Create a new instance of <code>FBMaintenanceManager</code> based on
53- * the default GDSType.
52+ * Create a new instance of {@code FBMaintenanceManager} based on the default GDSType.
5453 */
5554 public FBStatisticsManager () {
56- super ();
5755 }
5856
5957 /**
60- * Create a new instance of <code>FBMaintenanceManager</code> based on
61- * a given GDSType.
58+ * Create a new instance of {@code FBMaintenanceManager} based on a given GDSType.
6259 *
6360 * @param gdsType
6461 * type must be PURE_JAVA, EMBEDDED, or NATIVE
@@ -69,8 +66,7 @@ public FBStatisticsManager(String gdsType) {
6966 }
7067
7168 /**
72- * Create a new instance of <code>FBMaintenanceManager</code> based on
73- * a given GDSType.
69+ * Create a new instance of {@code FBMaintenanceManager} based on a given GDSType.
7470 *
7571 * @param gdsType
7672 * The GDS implementation type to use
@@ -107,19 +103,18 @@ public void getDatabaseStatistics(int options) throws SQLException {
107103 }
108104
109105 @ Override
110- public void getTableStatistics (List <String > schemas , List <String > tableNames ) throws SQLException {
106+ public void getTableStatistics (Collection <String > schemas , Collection <String > tableNames ) throws SQLException {
111107 try (FbService service = attachServiceManager ()) {
112108 ServiceRequestBuffer srb ;
113109 GDSServerVersion serverVersion = service .getServerVersion ();
114- if (serverVersion .isEqualOrAbove (3 )) {
115- srb = createStatsSRB (service , 0 );
110+ if (serverVersion .isEqualOrAbove (3 ) || tableNames . isEmpty () ) {
111+ srb = createDefaultStatsSRB (service );
116112 if (serverVersion .isEqualOrAbove (6 )) {
117113 schemas .forEach (schema -> srb .addArgument (isc_spb_sts_schema , schema ));
118114 }
119115 tableNames .forEach (tableName -> srb .addArgument (isc_spb_sts_table , tableName ));
120- } else if (tableNames .isEmpty ()) {
121- srb = createStatsSRB (service , 0 );
122116 } else {
117+ // Handling of table list is different on older (unsupported) Firebird versions
123118 srb = createStatsSRB (service , isc_spb_sts_table );
124119 srb .addArgument (SpbItems .isc_spb_command_line , String .join (" " , tableNames ));
125120 }
0 commit comments