hbase support

This commit is contained in:
温少
2012-05-19 09:40:42 +08:00
parent ea6750dade
commit 72a65b0082
3 changed files with 19 additions and 7 deletions
@@ -9,5 +9,5 @@ public interface ExecutePlan {
HBaseResultSet executeQuery(HBasePreparedStatement statement) throws SQLException;
void execute(HBasePreparedStatement statement);
void execute(HBasePreparedStatement statement) throws SQLException;
}
@@ -13,7 +13,7 @@ public class ExecutePlanAdapter implements ExecutePlan {
}
@Override
public void execute(HBasePreparedStatement statement) {
public void execute(HBasePreparedStatement statement) throws SQLException {
throw new UnsupportedOperationException();
}
@@ -1,14 +1,26 @@
package com.alibaba.druid.hbase.exec;
import java.sql.SQLException;
import org.apache.hadoop.hbase.client.HTableInterface;
import com.alibaba.druid.hbase.HBaseConnection;
import com.alibaba.druid.hbase.HBasePreparedStatement;
public class InsertExecutePlan extends SingleTableExecutePlan {
@Override
public void execute(HBasePreparedStatement statement) {
throw new UnsupportedOperationException();
public void execute(HBasePreparedStatement statement) throws SQLException {
try {
HBaseConnection connection = statement.getConnection();
HTableInterface htable = connection.getHTable(getTableName());
throw new UnsupportedOperationException();
} catch (SQLException e) {
throw e;
} catch (Exception e) {
throw new SQLException("executeQuery error", e);
}
}
}