diff --git a/easysql-demo/src/main/java/EasySQLDemo.java b/easysql-demo/src/main/java/EasySQLDemo.java index d3463e4..be57653 100644 --- a/easysql-demo/src/main/java/EasySQLDemo.java +++ b/easysql-demo/src/main/java/EasySQLDemo.java @@ -92,9 +92,22 @@ public class EasySQLDemo { .setKeyIndex(1) // 设定自增主键的index,将会在后续返回自增主键 .execute((exception, action) -> { // 处理异常 - System.out.println(action); - + System.out.println("#" + action.getShortID() + " -> " + action.getSQLContent()); + exception.printStackTrace(); }); + + try { + Integer userID = sqlManager.createInsert("users") + .setColumnNames("username", "phone", "email", "registerTime") + .setParams("CarmJos", "18888888888", "carm@carm.cc", TimeDateUtils.getCurrentTime()) + .setKeyIndex(1) // 设定自增主键的index,将会在后续返回自增主键 + .execute(); + + System.out.println("新用户的ID为 " + userID); + + } catch (SQLException exception) { + exception.printStackTrace(); + } } } \ No newline at end of file