1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.hadoop.hbase.hbql.statement;
22
23 import org.apache.hadoop.hbase.hbql.client.ExecutionResults;
24 import org.apache.hadoop.hbase.hbql.client.HBqlException;
25 import org.apache.hadoop.hbase.hbql.impl.HConnectionImpl;
26
27 import java.io.IOException;
28
29 public class DisableTableStatement extends TableStatement {
30
31 public DisableTableStatement(final StatementPredicate predicate, final String tableName) {
32 super(predicate, tableName);
33 }
34
35 protected ExecutionResults execute(final HConnectionImpl conn) throws HBqlException {
36 try {
37 conn.getHBaseAdmin().disableTable(this.getTableName());
38 }
39 catch (IOException e) {
40 throw new HBqlException(e);
41 }
42
43 return new ExecutionResults("Table " + this.getTableName() + " disabled.");
44 }
45
46 public static String usage() {
47 return "DISABLE TABLE table_name [IF bool_expr]";
48 }
49 }