diff options
author | stuconnolly <stuart02@gmail.com> | 2012-09-09 10:30:45 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-09-09 10:30:45 +0000 |
commit | d45b89f6a308e9ef1aa3ef239c492b9c8513f156 (patch) | |
tree | 05e2037192606d2714d6056a7bdb48262b49da41 | |
parent | e816b8ae1ffca491a67b1e12f75954ae2ccdbe95 (diff) | |
download | sequelpro-d45b89f6a308e9ef1aa3ef239c492b9c8513f156.tar.gz sequelpro-d45b89f6a308e9ef1aa3ef239c492b9c8513f156.tar.bz2 sequelpro-d45b89f6a308e9ef1aa3ef239c492b9c8513f156.zip |
The connect_timeout parameter is useless when polling the connection, we need to manage it ourselves.
-rw-r--r-- | Frameworks/PostgresKit/Source/FLXPostgresConnection.m | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Frameworks/PostgresKit/Source/FLXPostgresConnection.m b/Frameworks/PostgresKit/Source/FLXPostgresConnection.m index ed23c050..cba07dae 100644 --- a/Frameworks/PostgresKit/Source/FLXPostgresConnection.m +++ b/Frameworks/PostgresKit/Source/FLXPostgresConnection.m @@ -46,7 +46,6 @@ static const char *FLXPostgresHostParam = "host"; static const char *FLXPostgresPasswordParam = "password"; static const char *FLXPostgresPortParam = "port"; static const char *FLXPostgresDatabaseParam = "dbname"; -static const char *FLXPostgresConnectionTimeoutParam = "connect_timeout"; static const char *FLXPostgresClientEncodingParam = "client_encoding"; static const char *FLXPostgresKeepAliveParam = "keepalives"; static const char *FLXPostgresKeepAliveIntervalParam = "keepalives_interval"; @@ -196,6 +195,10 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message _connectionError = [[NSString alloc] initWithUTF8String:PQerrorMessage(_connection)]; + PQfinish(_connection); + + _connection = nil; + return NO; } @@ -314,7 +317,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message { case PGRES_POLLING_READING: case PGRES_POLLING_WRITING: - case PGRES_POLLING_ACTIVE: // Obsolete so we don't really care about it + case PGRES_POLLING_ACTIVE: break; case PGRES_POLLING_OK: connected = YES; @@ -393,7 +396,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message if (_connectionParamNames) free(_connectionParamNames); if (_connectionParamValues) free(_connectionParamValues); - int paramCount = 6; + int paramCount = 5; if (_user && [_user length]) paramCount++, hasUser = YES; if (_host && [_host length]) paramCount++, hasHost = YES; @@ -409,19 +412,16 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message _connectionParamNames[1] = FLXPostgresPortParam; _connectionParamValues[1] = [[[NSNumber numberWithUnsignedInteger:_port] stringValue] UTF8String]; - _connectionParamNames[2] = FLXPostgresConnectionTimeoutParam; - _connectionParamValues[2] = [[[NSNumber numberWithUnsignedInteger:_timeout] stringValue] UTF8String]; - - _connectionParamNames[3] = FLXPostgresClientEncodingParam; - _connectionParamValues[3] = [_encoding UTF8String]; + _connectionParamNames[2] = FLXPostgresClientEncodingParam; + _connectionParamValues[2] = [_encoding UTF8String]; - _connectionParamNames[4] = FLXPostgresKeepAliveParam; + _connectionParamNames[3] = FLXPostgresKeepAliveParam; _connectionParamValues[4] = _useKeepAlive ? "1" : "0"; - _connectionParamNames[5] = FLXPostgresKeepAliveIntervalParam; - _connectionParamValues[5] = [[[NSNumber numberWithUnsignedInteger:_keepAliveInterval] stringValue] UTF8String]; + _connectionParamNames[4] = FLXPostgresKeepAliveIntervalParam; + _connectionParamValues[4] = [[[NSNumber numberWithUnsignedInteger:_keepAliveInterval] stringValue] UTF8String]; - NSUInteger i = 6; + NSUInteger i = 5; if (hasUser) { _connectionParamNames[i] = FLXPostgresUserParam; |