diff options
author | stuconnolly <stuart02@gmail.com> | 2012-09-06 09:35:29 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-09-06 09:35:29 +0000 |
commit | 669d45c54dc297d3a553f93f9ff62b4705f43427 (patch) | |
tree | 81ba2189d5db3baca86fcdc400dc940e7d87cbcb /Frameworks/PostgresKit/Source/FLXPostgresConnection.m | |
parent | eff50abf96c5a9f5cc887433b626d8d28f8ddde9 (diff) | |
download | sequelpro-669d45c54dc297d3a553f93f9ff62b4705f43427.tar.gz sequelpro-669d45c54dc297d3a553f93f9ff62b4705f43427.tar.bz2 sequelpro-669d45c54dc297d3a553f93f9ff62b4705f43427.zip |
Add a new connection error property.
Diffstat (limited to 'Frameworks/PostgresKit/Source/FLXPostgresConnection.m')
-rw-r--r-- | Frameworks/PostgresKit/Source/FLXPostgresConnection.m | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Frameworks/PostgresKit/Source/FLXPostgresConnection.m b/Frameworks/PostgresKit/Source/FLXPostgresConnection.m index 8e0fba79..d9060a5f 100644 --- a/Frameworks/PostgresKit/Source/FLXPostgresConnection.m +++ b/Frameworks/PostgresKit/Source/FLXPostgresConnection.m @@ -77,6 +77,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message @synthesize lastQueryWasCancelled = _lastQueryWasCancelled; @synthesize lastError = _lastError; @synthesize encoding = _encoding; +@synthesize connectionError = _connectionError; @synthesize stringEncoding = _stringEncoding; @synthesize parameters = _parameters; @@ -109,6 +110,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message _lastError = nil; _connection = nil; + _connectionError = nil; _lastQueryWasCancelled = NO; _stringEncoding = FLXPostgresConnectionDefaultStringEncoding; @@ -189,6 +191,10 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message if (!_connection || PQstatus(_connection) == CONNECTION_BAD) { + if (_connectionError) [_connectionError release]; + + _connectionError = [[NSString alloc] initWithUTF8String:PQerrorMessage(_connection)]; + // TODO: implement reconnection attempt return NO; } @@ -303,7 +309,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message BOOL connected = NO; while (!connected && !failed) - { + { switch (PQconnectPoll(_connection)) { case PGRES_POLLING_READING: @@ -455,6 +461,7 @@ static void _FLXPostgresConnectionNoticeProcessor(void *arg, const char *message if (_lastError) [_lastError release], _lastError = nil; if (_parameters) [_parameters release], _parameters = nil; + if (_connectionError) [_connectionError release], _connectionError = nil; [super dealloc]; } |