未验证 提交 d26bd988 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

fix: typos in jdbcdemo example (#21646)

上级 6088b5bb
...@@ -51,27 +51,27 @@ public class JdbcDemo { ...@@ -51,27 +51,27 @@ public class JdbcDemo {
private void createDatabase() { private void createDatabase() {
String sql = "create database if not exists " + dbName; String sql = "create database if not exists " + dbName;
exuete(sql); execute(sql);
} }
private void useDatabase() { private void useDatabase() {
String sql = "use " + dbName; String sql = "use " + dbName;
exuete(sql); execute(sql);
} }
private void dropTable() { private void dropTable() {
final String sql = "drop table if exists " + dbName + "." + tbName + ""; final String sql = "drop table if exists " + dbName + "." + tbName + "";
exuete(sql); execute(sql);
} }
private void createTable() { private void createTable() {
final String sql = "create table if not exists " + dbName + "." + tbName + " (ts timestamp, temperature float, humidity int)"; final String sql = "create table if not exists " + dbName + "." + tbName + " (ts timestamp, temperature float, humidity int)";
exuete(sql); execute(sql);
} }
private void insert() { private void insert() {
final String sql = "insert into " + dbName + "." + tbName + " (ts, temperature, humidity) values(now, 20.5, 34)"; final String sql = "insert into " + dbName + "." + tbName + " (ts, temperature, humidity) values(now, 20.5, 34)";
exuete(sql); execute(sql);
} }
private void select() { private void select() {
...@@ -120,7 +120,7 @@ public class JdbcDemo { ...@@ -120,7 +120,7 @@ public class JdbcDemo {
System.out.println("[ " + (succeed ? "OK" : "ERROR!") + " ] time cost: " + cost + " ms, execute statement ====> " + sql); System.out.println("[ " + (succeed ? "OK" : "ERROR!") + " ] time cost: " + cost + " ms, execute statement ====> " + sql);
} }
private void exuete(String sql) { private void execute(String sql) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
boolean execute = statement.execute(sql); boolean execute = statement.execute(sql);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册