buggins / ddbc

DDBC is DB Connector for D language (similar to JDBC)
78 stars 45 forks source link

SQLException when using mysql and vibe-d 0.8.0 #52

Closed SingingBush closed 6 years ago

SingingBush commented 7 years ago

I'm not yet sure of the cause but there seems to be a problem with the mysql driver.

ddbc.core.SQLException@../../../.dub/packages/ddbc-0.3.7/ddbc/source/ddbc/drivers/mysqlddbc.d(543): null this
----------------
../../../.dub/packages/ddbc-0.3.7/ddbc/source/ddbc/drivers/mysqlddbc.d:543 ddbc.core.ResultSet ddbc.drivers.mysqlddbc.MySQLPreparedStatement.executeQuery() [0xd68bb8]
../../../.dub/packages/hibernated-0.3.2/hibernated/source/hibernated/session.d:1068 Object[] hibernated.session.QueryImpl.listObjects(Object, hibernated.session.PropertyLoadMap) [0xd4d541]
../../../.dub/packages/hibernated-0.3.2/hibernated/source/hibernated/session.d:1050 Object[] hibernated.session.QueryImpl.listObjects(Object) [0xd4d3b7]
../../../.dub/packages/hibernated-0.3.2/hibernated/source/hibernated/session.d:964 Object[] hibernated.session.QueryImpl.listObjects() [0xd4c7ee]
../../../.dub/packages/hibernated-0.3.2/hibernated/source/hibernated/session.d:151 eloquent.model.blogpost.BlogPost[] hibernated.session.Query.list!(eloquent.model.blogpost.BlogPost).list() [0xcecc6c]
source/services/blogservice.d:35 eloquent.model.blogpost.BlogPost[] eloquent.services.blogservice.BlogServiceImpl.allBlogPosts() [0xd25f32]
source/controllers/webappcontroller.d:27 void eloquent.controllers.web.WebappController.index() [0xd20fb5]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/web/vibe/web/web.d:825 void vibe.web.web.handleRequest!("index", void eloquent.controllers.web.WebappController.index(), eloquent.controllers.web.WebappController).handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse, eloquent.controllers.web.WebappController, vibe.web.web.WebInterfaceSettings) [0xd19b6a]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/web/vibe/web/web.d:186 @trusted void vibe.web.web.__T20registerWebInterfaceHTC8eloquent11controllers3web16WebappControllerVE4vibe3web6common11MethodStylei5Z.registerWebInterface(vibe.http.router.URLRouter, eloquent.controllers.web.WebappController, vibe.web.web.WebInterfaceSettings).__lambda4(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) [0xd195b8]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/router.d:212 _D4vibe4http6router9URLRouter13handleRequestMFNfC4vibe4http6server17HTTPServerRequestC4vibe4http6server18HTTPServerResponseZ21__T9__lambda4TmTAAyaZ9__lambda4MFNfmMAAyaZb [0xdec597]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/router.d:620 const(@safe bool function(immutable(char)[], scope @safe bool delegate(ulong, scope immutable(char)[][]))) vibe.http.router.MatchTree!(vibe.http.router.Route).MatchTree.doMatch [0xded3be]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/router.d:553 @safe bool vibe.http.router.MatchTree!(vibe.http.router.Route).MatchTree.match(immutable(char)[], scope @safe bool delegate(ulong, scope immutable(char)[][])) [0xdecbfb]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/router.d:205 @safe void vibe.http.router.URLRouter.handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) [0xdec24d]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/server.d:2043 @safe bool vibe.http.server.handleRequest(vibe.internal.interfaceproxy.InterfaceProxy!(vibe.core.stream.Stream).InterfaceProxy, vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo, ref vibe.http.server.HTTPServerSettings, ref bool, scope std.experimental.allocator.IAllocator) [0xe415aa]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/server.d:1791 @trusted void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo).__lambda4() [0xe3f905]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/server.d:1783 @safe void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo) [0xe3f69a]
../../../.dub/packages/vibe-d-0.8.0-rc.6/vibe-d/http/vibe/http/server.d:1657 nothrow @safe void vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings, vibe.http.server.HTTPServerContext).doListen(vibe.http.server.HTTPListenInfo, vibe.http.server.HTTPServerContext, bool, bool).__lambda6(vibe.core.net.TCPConnection) [0xe3ee87]
../../../.dub/packages/vibe-core-1.0.0-rc.4/vibe-core/source/vibe/core/task.d:532 _D4vibe4core4task12TaskFuncInfo76__T3setTDFNfS4vibe4core3net13TCPConnectionZvTS4vibe4core3net13TCPConnectionZ3setMFKDFNfS4vibe4core3net13TCPConnectionZvKS4vibe4core3net13TCPConnectionZ12callDelegateFKS4vibe4core4task12TaskFuncInfoZv [0xefc8f2]
../../../.dub/packages/vibe-core-1.0.0-rc.4/vibe-core/source/vibe/core/task.d:557 void vibe.core.task.TaskFuncInfo.call() [0xedef3d]
../../../.dub/packages/vibe-core-1.0.0-rc.4/vibe-core/source/vibe/core/task.d:375 nothrow void vibe.core.task.TaskFiber.run() [0xede390]
??:? void core.thread.Fiber.run() [0xfa3923]
??:? fiber_entryPoint [0xfa3802]
??:? [0xffffffff]

the error occured in this try/catch block:

    override ddbc.core.ResultSet executeQuery() {
        checkClosed();
        lock();
        scope(exit) unlock();
        try {
            Prepared p = prepare(conn.getConnection(), to!string(cmd.sql));
            rs = p.querySet();
            resultSet = new MySQLResultSet(this, rs, getMetaData());
            return resultSet;
        } catch (Throwable e) {
            throw new SQLException(e);
        }
    }
SingingBush commented 7 years ago

I've replicated this in testddbc.d by adding an extra test for prepared statements (it doesn't make a differnece if using vibe-d 0.7.31 or 0.8.0).

I'll look into it further after kids go to bed.