mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-16 00:21:39 +00:00
morte error handling fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@39067 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
14c31894a0
commit
3c0f8a4840
1 changed files with 13 additions and 8 deletions
21
Postgres.m
21
Postgres.m
|
@ -664,8 +664,12 @@ connectQuote(NSString *str)
|
|||
if (result != 0)
|
||||
{
|
||||
PQclear(result);
|
||||
result = 0;
|
||||
}
|
||||
if (PQstatus(connection) != CONNECTION_OK)
|
||||
{
|
||||
[self backendDisconnect];
|
||||
}
|
||||
[self backendDisconnect];
|
||||
[NSException raise: SQLException format: @"Error executing %@: %@",
|
||||
stmt, str];
|
||||
}
|
||||
|
@ -677,13 +681,11 @@ connectQuote(NSString *str)
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSString *n = [localException name];
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
PQclear(result);
|
||||
}
|
||||
if (YES == connected && [n isEqual: SQLConnectionException] == YES)
|
||||
if (YES == connected && PQstatus(connection) != CONNECTION_OK)
|
||||
{
|
||||
[self disconnect];
|
||||
}
|
||||
|
@ -1020,8 +1022,12 @@ static inline unsigned int trim(char *str, unsigned len)
|
|||
if (result != 0)
|
||||
{
|
||||
PQclear(result);
|
||||
result = 0;
|
||||
}
|
||||
if (PQstatus(connection) != CONNECTION_OK)
|
||||
{
|
||||
[self backendDisconnect];
|
||||
}
|
||||
[self backendDisconnect];
|
||||
[NSException raise: SQLException format: @"Error executing %@: %@",
|
||||
stmt, str];
|
||||
}
|
||||
|
@ -1142,13 +1148,12 @@ static inline unsigned int trim(char *str, unsigned len)
|
|||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSString *n = [localException name];
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
PQclear(result);
|
||||
result = 0;
|
||||
}
|
||||
if (YES == connected && [n isEqual: SQLConnectionException] == YES)
|
||||
if (YES == connected && PQstatus(connection) != CONNECTION_OK)
|
||||
{
|
||||
[self disconnect];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue