diff --git a/pom.xml b/pom.xml
index 995be96..1ecd919 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.skymc
TabooLib
- 4.22
+ 4.23
UTF-8
diff --git a/src/main/java/me/skymc/taboolib/mysql/builder/SQLColumn.java b/src/main/java/me/skymc/taboolib/mysql/builder/SQLColumn.java
index cf7ce3f..dd6463f 100644
--- a/src/main/java/me/skymc/taboolib/mysql/builder/SQLColumn.java
+++ b/src/main/java/me/skymc/taboolib/mysql/builder/SQLColumn.java
@@ -22,7 +22,7 @@ public class SQLColumn {
private SQLColumnOption[] columnOptions;
/**
- * 文本类型常用构造器
+ * 文本 类型常用构造器
* new SQLColumn(SQLColumnType.TEXT, "username");
*/
public SQLColumn(SQLColumnType columnType, String columnName) {
@@ -30,7 +30,17 @@ public class SQLColumn {
}
/**
- * 主键类型常用构造器
+ * CHAR 类型常用构造器
+ *
+ * @param columnType
+ * @param columnName
+ */
+ public SQLColumn(SQLColumnType columnType, int m, String columnName) {
+ this(columnType, m, 0, columnName, null);
+ }
+
+ /**
+ * 主键 类型常用构造器
* new SQLColumn(SQLColumnType.TEXT, "username", SQLColumnOption.PRIMARY_KEY, SQLColumnOption.AUTO_INCREMENT);
*/
public SQLColumn(SQLColumnType columnType, String columnName, SQLColumnOption... columnOptions) {
@@ -38,7 +48,7 @@ public class SQLColumn {
}
/**
- * 数据类型常用构造器
+ * 数据 类型常用构造器
* new SQLColumn(SQLColumnType.TEXT, "player_group", "PLAYER");
*/
public SQLColumn(SQLColumnType columnType, String columnName, Object defaultValue) {
@@ -99,25 +109,25 @@ public class SQLColumn {
for (SQLColumnOption options : columnOptions) {
switch (options) {
case NOTNULL:
- builder.append(" not null");
+ builder.append(" NOT NULL");
break;
case PRIMARY_KEY:
- builder.append(" primary key");
+ builder.append(" PRIMARY KEY");
break;
case AUTO_INCREMENT:
- builder.append(" auto_increment");
+ builder.append(" AUTO_INCREMENT");
break;
case UNIQUE_KEY:
- builder.append(" unique key");
+ builder.append(" UNIQUE KEY");
break;
default:
}
}
if (defaultValue != null) {
if (defaultValue instanceof String) {
- builder.append(" default '").append(defaultValue).append("'");
+ builder.append(" DEFAULT '").append(defaultValue).append("'");
} else {
- builder.append(" default ").append(defaultValue);
+ builder.append(" DEFAULT ").append(defaultValue);
}
}
return builder.toString();
diff --git a/src/main/java/me/skymc/taboolib/mysql/builder/SQLTable.java b/src/main/java/me/skymc/taboolib/mysql/builder/SQLTable.java
index 601195d..5cdb888 100644
--- a/src/main/java/me/skymc/taboolib/mysql/builder/SQLTable.java
+++ b/src/main/java/me/skymc/taboolib/mysql/builder/SQLTable.java
@@ -60,7 +60,11 @@ public class SQLTable {
return executeQuery("select * from " + tableName + " where " + where);
}
- public RunnableUpdate executeUpdate(String where, String update) {
+ public RunnableQuery executeSelect() {
+ return executeQuery("select * from " + tableName);
+ }
+
+ public RunnableUpdate executeUpdate(String update, String where) {
return executeUpdate("update " + tableName + " set " + update + " where " + where);
}
diff --git a/src/main/java/me/skymc/taboolib/other/NumberUtils.java b/src/main/java/me/skymc/taboolib/other/NumberUtils.java
index 988dd4c..f811baa 100644
--- a/src/main/java/me/skymc/taboolib/other/NumberUtils.java
+++ b/src/main/java/me/skymc/taboolib/other/NumberUtils.java
@@ -3,6 +3,9 @@ package me.skymc.taboolib.other;
import java.text.DecimalFormat;
import java.util.Random;
+/**
+ * @author sky
+ */
public class NumberUtils {
private static Random random = new Random();
@@ -52,6 +55,22 @@ public class NumberUtils {
}
}
+ public static Boolean getBooleanAbbreviation(String str) {
+ if (str == null || str.isEmpty()) {
+ return false;
+ }
+ if (str.length() < 4) {
+ char var = str.charAt(0);
+ if (var == 'y' || var == 'Y' || var == 't' || var == 'T' || var == '1') {
+ return true;
+ }
+ if (var == 'n' || var == 'N' || var == 'f' || var == 'F' || var == '0') {
+ return false;
+ }
+ }
+ return getBoolean(str);
+ }
+
@Deprecated
public static Random getRand() {
return random;