martinrybak / SQLClient

Native Microsoft SQL Server client for iOS
http://objcsharp.wordpress.com/2013/10/15/an-open-source-sql-server-library-for-ios/
MIT License
124 stars 51 forks source link

Problem with disconnect #29

Closed huangy10 closed 7 years ago

huangy10 commented 8 years ago

I notice that you free the db connection at the end of execution:

- (void)executionFailure:(void (^)(NSArray* results))completion
{
    [self.callbackQueue addOperationWithBlock:^{
        if (completion)
            completion(nil);
    }];

    //Clean up
    dbfreebuf(connection);
}

//Invokes execution completion handler on callback queue with results array
- (void)executionSuccess:(void (^)(NSArray* results))completion results:(NSArray*)results
{
    [self.callbackQueue addOperationWithBlock:^{
        if (completion)
            completion(results);
    }];

    //Clean up
    dbfreebuf(connection);
}

Then should I still have to call the disconnect function in the callback closure like you did in the sample code?

martinrybak commented 7 years ago

dbfreebuf only clears the command buffer, it does not close the connection.