版本更新至:3.827

修复:MySQLConnection 排序失效问题
This commit is contained in:
坏黑 2018-03-27 21:28:19 +08:00
parent 6d5205a3bd
commit 890601bacb
2 changed files with 7 additions and 9 deletions

View File

@ -6,7 +6,7 @@ website: http://www.15imc.com/index.html
main: me.skymc.taboolib.Main
version: 3.826
version: 3.827
commands:
taboolib:

View File

@ -49,8 +49,8 @@ public class MySQLConnection {
}
// 设置信息
this.plugin = plugin;
this.recheck = recheck;
// this.plugin = plugin;
// this.recheck = recheck;
// 设置数据
this.url = url == null ? "localhost" : url;
@ -581,11 +581,10 @@ public class MySQLConnection {
ResultSet resultSet = null;
try {
if (desc) {
pstmt = connection.prepareStatement("select * from `" + name + "` order by ? desc " + (size < 0 ? "" : " limit " + size));
pstmt = connection.prepareStatement("select * from `" + name + "` order by `" + column + "` desc " + (size < 0 ? "" : " limit " + size));
} else {
pstmt = connection.prepareStatement("select * from `" + name + "` order by ? " + (size < 0 ? "" : " limit " + size));
pstmt = connection.prepareStatement("select * from `" + name + "` order by `" + column + "` " + (size < 0 ? "" : " limit " + size));
}
pstmt.setString(1, column);
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
list.add(resultSet.getObject(column));
@ -632,11 +631,10 @@ public class MySQLConnection {
ResultSet resultSet = null;
try {
if (desc) {
pstmt = connection.prepareStatement("select * from `" + name + "` order by ? desc " + (size < 0 ? "" : " limit " + size));
pstmt = connection.prepareStatement("select * from `" + name + "` order by `" + sortColumn + "` desc" + (size < 0 ? "" : " limit " + size));
} else {
pstmt = connection.prepareStatement("select * from `" + name + "` order by ? " + (size < 0 ? "" : " limit " + size));
pstmt = connection.prepareStatement("select * from `" + name + "` order by `" + sortColumn + "`" + (size < 0 ? "" : " limit " + size));
}
pstmt.setString(1, sortColumn);
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
HashMap<String, Object> map = new HashMap<>();