Tweak for improved logging

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@28629 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-09-08 08:17:09 +00:00
parent 9e070b97c9
commit 93b0273a55
2 changed files with 15 additions and 7 deletions

View file

@ -1325,8 +1325,9 @@ extern unsigned SQLClientTimeTick();
*/
- (void) execute;
/** Convenience method which calls -executeBatchReturningFailures: with
* a nil argument.
/** Convenience method which calls
* -executeBatchReturningFailures:logExceptions: with
* a nil failures argument and exception logging off.
*/
- (unsigned) executeBatch;
@ -1354,9 +1355,14 @@ extern unsigned SQLClientTimeTick();
* batch is set to stop on the first failure) are <em>also</em> added to
* the failures transaction.
* </p>
* <p>If the log argument is YES, then any exceptions encountered when
* executing the batch are logged using the [SQLClient-debug:,...] method,
* even if debug logging is not enabled with [SQLClient-setDebugging:].
* </p>
* The method returns the number of statements which actually succeeded.
*/
- (unsigned) executeBatchReturningFailures: (SQLTransaction*)failures;
- (unsigned) executeBatchReturningFailures: (SQLTransaction*)failures
logExceptions: (BOOL)log;
/**
* Insert trn at the index'th position in the receiver.<br />

View file

@ -2927,10 +2927,11 @@ static unsigned int maxConnections = 8;
- (unsigned) executeBatch
{
return [self executeBatchReturningFailures: nil];
return [self executeBatchReturningFailures: nil logExceptions: NO];
}
- (unsigned) executeBatchReturningFailures: (SQLTransaction*)failures
logExceptions: (BOOL)log
{
unsigned executed = 0;
@ -2943,7 +2944,7 @@ static unsigned int maxConnections = 8;
}
NS_HANDLER
{
if ([_db debugging] > 0)
if (log == YES || [_db debugging] > 0)
{
[_db debug: @"Initial failure executing batch %@: %@",
self, localException];
@ -2973,7 +2974,7 @@ static unsigned int maxConnections = 8;
[failures->_info addObject: o];
failures->_count++;
}
if ([_db debugging] > 0)
if (log == YES || [_db debugging] > 0)
{
[_db debug:
@"Failure of %d executing batch %@: %@",
@ -2988,7 +2989,8 @@ static unsigned int maxConnections = 8;
unsigned result;
result = [(SQLTransaction*)o
executeBatchReturningFailures: failures];
executeBatchReturningFailures: failures
logExceptions: log];
executed += result;
if (result == [(SQLTransaction*)o totalCount])
{