hbase support

This commit is contained in:
温少
2012-05-19 15:08:09 +08:00
parent 35f1e3483c
commit cd94ed6634
7 changed files with 68 additions and 12 deletions
@@ -1,6 +1,7 @@
package com.alibaba.druid.hbase;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
@@ -76,11 +77,40 @@ public class HBaseResultSet extends ResultSetBase {
if ("@ROW".equals(columnName)) {
return result.getRow();
}
if ("id".equals(columnName)) { // TODO
return result.getRow();
}
byte[] qualifier = Bytes.toBytes(columnName);
byte[] value = result.getValue(family, qualifier);
this.wasNull = value == null;
return value;
}
@Override
public int getInt(String columnName) throws SQLException {
byte[] bytes = getBytes(columnName);
if (bytes == null) {
return 0;
}
return Bytes.toInt(bytes);
}
@Override
public BigDecimal getBigDecimal(String columnName) throws SQLException {
byte[] bytes = getBytes(columnName);
if (bytes == null) {
return null;
}
return Bytes.toBigDecimal(bytes);
}
@Override
public void close() throws SQLException {