mysql fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@31131 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-08-13 13:20:06 +00:00
parent e307f93142
commit 6fe56d2e1e
3 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2010-08-13 Richard Frith-Macdonald <rfm@gnu.org>
* MySQL.m: Try to recognise loss of connection.
Fix bug in timezone management.
2010-07-16 Richard Frith-Macdonald <rfm@gnu.org>
* MySQL.m: Add support for TEXT data and for MySQL's failure to support

26
MySQL.m
View file

@ -212,8 +212,17 @@ static NSNull *null = nil;
if (mysql_real_query(connection, statement, length) != 0)
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
/* discard any results.
*/
@ -435,8 +444,17 @@ static unsigned int trim(char *str)
}
else
{
[NSException raise: SQLException format: @"%s",
mysql_error(connection)];
NSString *s;
s = [NSString stringWithFormat: @"%s", mysql_error(connection)];
if (mysql_ping(connection) == 0)
{
[NSException raise: SQLException format: @"%@", s];
}
else
{
[NSException raise: SQLConnectionException format: @"%@", s];
}
}
}
NS_HANDLER

View file

@ -1161,7 +1161,7 @@ static unsigned int maxConnections = 8;
NSTimeInterval elapsed;
/* If we have repeated connection failures, we enforce a
* delay fo up to 30 seconds between connection attempts
* delay of up to 30 seconds between connection attempts
* to avoid overloading the system with too frequent
* connection attempts.
*/