mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
hbase support
This commit is contained in:
@@ -44,6 +44,12 @@ public class InsertExecutePlan extends SingleTableExecutePlan {
|
||||
} else if (value instanceof Integer) {
|
||||
int intValue = ((Integer) value).intValue();
|
||||
bytes = Bytes.toBytes(intValue);
|
||||
} else if (value instanceof Long) {
|
||||
long longValue = ((Long) value).longValue();
|
||||
bytes = Bytes.toBytes(longValue);
|
||||
} else if (value instanceof Boolean) {
|
||||
boolean booleanValue = ((Boolean) value).booleanValue();
|
||||
bytes = Bytes.toBytes(booleanValue);
|
||||
} else {
|
||||
throw new SQLException("TODO"); // TODO
|
||||
}
|
||||
|
||||
@@ -12,9 +12,11 @@ public class HBaseDriverInsertTest extends TestCase {
|
||||
HBaseDriver driver = new HBaseDriver();
|
||||
Connection conn = driver.connect("jdbc:druid-hbase:10.20.153.63", new Properties());
|
||||
|
||||
PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_user (id, name) VALUES (?, ?)");
|
||||
PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_user (id, name, gender) VALUES (?, ?, ?)");
|
||||
stmt.setInt(1, 33);
|
||||
stmt.setString(2, "ljw");
|
||||
stmt.setString(3, "M");
|
||||
|
||||
|
||||
stmt.execute();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user