Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw query with empty result set throws MySQLError.lengthEncodedData error #196

Closed
tierracero opened this issue Jul 2, 2018 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@tierracero
Copy link

tierracero commented Jul 2, 2018

im using
mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper CENTOS
.package(url: "https://github.com/vapor/fluent-mysql.git", from: "3.0.0-rc"),
Vapor Toolbox: 3.1.6

When. I do a query and get ZERO ROWS I get this error:
MySQLError.lengthEncodedData: Could not parse length encoded data

`
router.post("test") { req -> HTTPResponse in
let _ = req.requestPooledConnection(to: .mysql).flatMap { conn -> EventLoopFuture in

        return  conn.simpleQuery ("SELECT * FROM control WHERE type = 'custAppLogIn' AND id = '1234' AND user = 'fakeUser'").flatMap({ (conn) -> EventLoopFuture<String> in
            let resp   =  " I have  \(String(conn.count))rows"
            return req.eventLoop.newSucceededFuture(result: resp)
        })
    }

    let f = "/Users/myuser/Desktop/sample.txt"
    let data = try req.fileio().chunkedStream(file:f)
    var res = HTTPResponse(status: .ok, body: data)
    
    res.contentType = .plainText
    return res

}
`

@tanner0101 tanner0101 added the bug Something isn't working label Jul 17, 2018
@tanner0101 tanner0101 added this to the 3.0.0 milestone Jul 17, 2018
@tanner0101
Copy link
Member

Fixed in #201, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants