Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUTO: Docs repo sync - ScalarDB #948

Merged
merged 1 commit into from
Feb 12, 2025
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
56 changes: 28 additions & 28 deletions docs/scalardb-sql/jdbc-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,39 +84,39 @@ The data type mapping between ScalarDB and JDBC is as follows:

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

How to get the data from a `java.sql.ResultSet` object for each data type is as follows:

```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 @@ How to set the data as a parameter for each data type for a `java.sql.PreparedSt

```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
16 changes: 8 additions & 8 deletions docs/scalardb-sql/sql-api-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,35 +151,35 @@ As mentioned, a `ResultSet` object returns `Record` objects that represent recor
You can get a column value of a result with `getXXX("<column name>")` or `getXXX(<column index>)` methods (XXX is a type name) as follows:

```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