简体   繁体   English

不从MySQL获取所有数据(java)

[英]Not Fetching All Data From MySQL (java)

So I was writing a method that retrieves information on my updates in a game and so far it retrieved all the information needed for revision 1.0. 因此,我正在编写一种方法,用于检索游戏中有关更新的信息,到目前为止,它已检索到修订版1.0所需的所有信息。 I proceeded to input 1.1 and it came back with an empty string. 我继续输入1.1,然后返回一个空字符串。

public String getRevision(float revision, String revisionName) {
    try {
        String txt = "\t\t\t\t\t\t\t#e---===Revision Log "+revision+"===---#n\r\n\r\n";
        Connection con = DatabaseConnection.getConnection();
        PreparedStatement ps = con.prepareStatement("SELECT information FROM revisions_log WHERE revisionName = ? AND revision = ?");
        ps.setString(1,  revisionName);
        ps.setFloat(2, revision);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            txt += rs.getString("information") + "\r\n";
        }
        ps.close();
        rs.close();
        return txt;
    } catch (Exception e) {

    }
    return "No logs were found!";
}

The db in the database is set with a string for its revisionName and a float for its revisions. 在数据库中的db设置有一个字符串,作为它的versionName,并为它的修订添加了一个浮点数。 I also definitely updated the DB with the correct revision number as well. 我当然也用正确的修订版号更新了数据库。

Here: 这里:

DB的图像

Query: 查询:

SELECT information FROM maplesolaxia.revisions_log WHERE revisionName = "prealpha" AND revision = 1.1;

Running the SAME query but with 1.0 instead works. 运行SAME查询但使用1.0代替。

Here's how my table is set up. 这是我的桌子的设置方式。 图片

这是一个奇怪的解决方案,但是我将“修订”的数据值从FLOAT更改为DECIMAL(3,1),并且似乎可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM