Skip to content

Commit 76205a0

Browse files
committed
spotless
1 parent 748712f commit 76205a0

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/example/UuidSupportDemo.java

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
*/
9292
public class UuidSupportDemo {
9393

94-
private static final String JDBC_URL = "jdbc:arrow-flight-sql://<flight_sql_server_host>:<flight_sql_server_port>";
94+
private static final String JDBC_URL =
95+
"jdbc:arrow-flight-sql://<flight_sql_server_host>:<flight_sql_server_port>";
9596
private static final String USERNAME = "";
9697
private static final String PASSWORD = "";
9798

@@ -310,10 +311,10 @@ private static void demonstrateUpdateWithStatement(Connection connection) throws
310311
System.out.println(" Updated ID 1000 to UUID: " + UUID_4);
311312

312313
// Update UUID to NULL
313-
String sql2 = String.format("UPDATE %s SET uuid = NULL WHERE id = 1002", TABLE_NAME);
314-
int rows2 = stmt.executeUpdate(sql2);
315-
System.out.println("Update UUID to NULL: " + rows2 + " row(s) affected");
316-
System.out.println(" Updated ID 1002 to UUID: NULL");
314+
String sql2 = String.format("UPDATE %s SET uuid = NULL WHERE id = 1002", TABLE_NAME);
315+
int rows2 = stmt.executeUpdate(sql2);
316+
System.out.println("Update UUID to NULL: " + rows2 + " row(s) affected");
317+
System.out.println(" Updated ID 1002 to UUID: NULL");
317318

318319
// Update based on UUID condition
319320
String sql3 =
@@ -332,41 +333,41 @@ private static void demonstrateUpdateWithPreparedStatement(Connection connection
332333

333334
// Update UUID using setObject()
334335
String sql1 = String.format("UPDATE %s SET uuid = ? WHERE id = 2001", TABLE_NAME);
335-
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
336-
pstmt.setObject(1, UUID_2);
337-
pstmt.setInt(2, 2000);
338-
int rows1 = pstmt.executeUpdate();
339-
System.out.println("Update with setObject(UUID): " + rows1 + " row(s) affected");
340-
System.out.println(" Updated ID 2000 to UUID: " + UUID_2);
341-
}
336+
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
337+
pstmt.setObject(1, UUID_2);
338+
pstmt.setInt(2, 2000);
339+
int rows1 = pstmt.executeUpdate();
340+
System.out.println("Update with setObject(UUID): " + rows1 + " row(s) affected");
341+
System.out.println(" Updated ID 2000 to UUID: " + UUID_2);
342+
}
342343

343-
// Update UUID using setString()
344-
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
345-
pstmt.setString(1, UUID_3.toString());
346-
pstmt.setInt(2, 2001);
347-
int rows2 = pstmt.executeUpdate();
348-
System.out.println("Update with setString(UUID.toString()): " + rows2 + " row(s) affected");
349-
System.out.println(" Updated ID 2001 to UUID: " + UUID_3);
350-
}
344+
// Update UUID using setString()
345+
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
346+
pstmt.setString(1, UUID_3.toString());
347+
pstmt.setInt(2, 2001);
348+
int rows2 = pstmt.executeUpdate();
349+
System.out.println("Update with setString(UUID.toString()): " + rows2 + " row(s) affected");
350+
System.out.println(" Updated ID 2001 to UUID: " + UUID_3);
351+
}
351352

352-
// Update UUID to NULL using setNull()
353-
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
354-
pstmt.setNull(1, Types.OTHER);
355-
pstmt.setInt(2, 2004);
356-
int rows3 = pstmt.executeUpdate();
357-
System.out.println("Update with setNull(): " + rows3 + " row(s) affected");
358-
System.out.println(" Updated ID 2004 to UUID: NULL");
359-
}
353+
// Update UUID to NULL using setNull()
354+
try (PreparedStatement pstmt = connection.prepareStatement(sql1)) {
355+
pstmt.setNull(1, Types.OTHER);
356+
pstmt.setInt(2, 2004);
357+
int rows3 = pstmt.executeUpdate();
358+
System.out.println("Update with setNull(): " + rows3 + " row(s) affected");
359+
System.out.println(" Updated ID 2004 to UUID: NULL");
360+
}
360361

361362
// Update based on UUID parameter condition
362363
String sql2 = String.format("UPDATE %s SET uuid = ? WHERE uuid = ?", TABLE_NAME);
363-
try (PreparedStatement pstmt = connection.prepareStatement(sql2)) {
364-
pstmt.setObject(1, UUID_5);
365-
pstmt.setObject(2, UUID_2);
366-
int rows4 = pstmt.executeUpdate();
367-
System.out.println("Update UUID based on UUID condition: " + rows4 + " row(s) affected");
368-
System.out.println(" Changed UUID " + UUID_2 + " to " + UUID_5);
369-
}
364+
try (PreparedStatement pstmt = connection.prepareStatement(sql2)) {
365+
pstmt.setObject(1, UUID_5);
366+
pstmt.setObject(2, UUID_2);
367+
int rows4 = pstmt.executeUpdate();
368+
System.out.println("Update UUID based on UUID condition: " + rows4 + " row(s) affected");
369+
System.out.println(" Changed UUID " + UUID_2 + " to " + UUID_5);
370+
}
370371
System.out.println();
371372
}
372373

0 commit comments

Comments
 (0)