Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,40 +83,40 @@ ScalarDB は JDBC で定義されているすべてのデータ型をサポー
ScalarDB と JDBC 間のデータ型マッピングは次のとおりです。

| ScalarDB タイプ | JDBC (Java) タイプ |
|----------------|-----------------------|
| Boolean | boolean または Boolean |
| Int | int または Integer |
| BigInt | long または Long |
| Float | float または Float |
| Double | double または Double |
| Text | String |
| Blob | byte[] |
|--------------|-----------------------|
| BOOLEAN | boolean または Boolean |
| INT | int または Integer |
| BIGINT | long または Long |
| FLOAT | float または Float |
| DOUBLE | double または Double |
| TEXT | String |
| BLOB | byte[] |

各データ型の `java.sql.ResultSet` オブジェクトからデータを取得する方法は次のとおりです。

```java
try (ResultSet resultSet = ...) {
resultSet.next();

// Get a Boolean value of a column
// Get a BOOLEAN value of a column
boolean booleanValue = resultSet.getBoolean("<column name>");

// Get an Int value of a column
// Get an INT value of a column
int intValue = resultSet.getInt("<column name>");

// Get a BigInt value of a column
// Get a BIGINT value of a column
long bigIntValue = resultSet.getLong("<column name>");

// Get a Float value of a column
// Get a FLOAT value of a column
float floatValue = resultSet.getFloat("<column name>");

// Get a Double value of a column
// Get a DOUBLE value of a column
double doubleValue = resultSet.getDouble("<column name>");

// Get a Text value of a column
// Get a TEXT value of a column
String textValue = resultSet.getString("<column name>");

// Get a Blob value of a column
// Get a BLOB value of a column
byte[] blobValue = resultSet.getBytes("<column name>");
}
```
Expand All @@ -125,26 +125,26 @@ try (ResultSet resultSet = ...) {

```java
try (PreparedStatement preparedStatement = ...) {
// Set a Boolean value as parameter
preparedStatement.setBoolean(1, <Boolean value>);
// Set a BOOLEAN value as parameter
preparedStatement.setBoolean(1, <BOOLEAN value>);

// Set an Int value as parameter
preparedStatement.setInt(2, <Int value>);
// Set an INT value as parameter
preparedStatement.setInt(2, <INT value>);

// Set a BigInt value as parameter
preparedStatement.setLong(3, <BigInt value>);
// Set a BIGINT value as parameter
preparedStatement.setLong(3, <BIGINT value>);

// Set a Float value as parameter
preparedStatement.setFloat(4, <Float value>);
// Set a FLOAT value as parameter
preparedStatement.setFloat(4, <FLOAT value>);

// Set a Double value as parameter
preparedStatement.setDouble(5, <Double value>);
// Set a DOUBLE value as parameter
preparedStatement.setDouble(5, <DOUBLE value>);

// Set a Text value as parameter
preparedStatement.setString(7, "<Text value>");
// Set a TEXT value as parameter
preparedStatement.setString(7, "<TEXT value>");

// Set a Blob value as parameter
preparedStatement.setBytes(8, <Blob value>);
// Set a BLOB value as parameter
preparedStatement.setBytes(8, <BLOB value>);

preparedStatement.execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,35 +154,35 @@ ColumnDefinitions columnDefinitions = resultSet.getColumnDefinitions();
次のように、`getXXX("<column name>")` メソッドまたは `getXXX(<column index>)` メソッド (XXX は型名) を使用して結果の列値を取得できます。

```java
// Get a Boolean value of a column
// Get a BOOLEAN value of a column
boolean booleanValueGottenByName = record.getBoolean("<column name>");
boolean booleanValueGottenByIndex = record.getBoolean(<column index>);

// Get an Int value of a column
// Get an INT value of a column
int intValueGottenByName = record.getInt("<column name>");
int intValueGottenByIndex = record.getInt(<column index>);

// Get a BigInt value of a column
// Get a BIGINT value of a column
long bigIntValueGottenByName = record.getBigInt("<column name>");
long bigIntValueGottenByIndex = record.getBigInt(<column index>);

// Get a Float value of a column
// Get a FLOAT value of a column
float floatValueGottenByName = record.getFloat("<column name>");
float floatValueGottenByIndex = record.getFloat(<column index>);

// Get a Double value of a column
// Get a DOUBLE value of a column
double doubleValueGottenByName = record.getDouble("<column name>");
double doubleValueGottenByIndex = record.getDouble(<column index>);

// Get a Text value of a column
// Get a TEXT value of a column
String textValueGottenByName = record.getText("<column name>");
String textValueGottenByIndex = record.getText(<column index>);

// Get a Blob value of a column (as a ByteBuffer)
// Get a BLOB value of a column (as a ByteBuffer)
ByteBuffer blobValueGottenByName = record.getBlob("<column name>");
ByteBuffer blobValueGottenByIndex = record.getBlob(<column index>);

// Get a Blob value of a column as a byte array
// Get a BLOB value of a column as a byte array
byte[] blobValueAsBytesGottenByName = record.getBlobAsBytes("<column name>");
byte[] blobValueAsBytesGottenByIndex = record.getBlobAsBytes(<column index>);
```
Expand Down