git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@35723 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-10-19 18:51:51 +00:00
parent bb290f0415
commit 828973acbc
2 changed files with 6 additions and 2 deletions

View file

@ -11,7 +11,7 @@
* testPostgres.m: * testPostgres.m:
Change execute methods to return a count of the rows to which the Change execute methods to return a count of the rows to which the
executed operation applies, or -1 if not supported. executed operation applies, or -1 if not supported.
Implement for postgresql. Implement for postgresql and mysql.
2012-06-17 Richard Frith-Macdonald <rfm@gnu.org> 2012-06-17 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -176,6 +176,7 @@ static NSNull *null = nil;
- (NSInteger) backendExecute: (NSArray*)info - (NSInteger) backendExecute: (NSArray*)info
{ {
NSString *stmt; NSString *stmt;
NSInteger rowCount = 0;
NSAutoreleasePool *arp = [NSAutoreleasePool new]; NSAutoreleasePool *arp = [NSAutoreleasePool new];
stmt = [info objectAtIndex: 0]; stmt = [info objectAtIndex: 0];
@ -225,6 +226,9 @@ static NSNull *null = nil;
[NSException raise: SQLConnectionException format: @"%@", s]; [NSException raise: SQLConnectionException format: @"%@", s];
} }
} }
/* See how many rows were modified.
*/
rowCount = mysql_affected_rows(connection);
/* discard any results. /* discard any results.
*/ */
result = mysql_store_result(connection); result = mysql_store_result(connection);
@ -258,7 +262,7 @@ static NSNull *null = nil;
} }
NS_ENDHANDLER NS_ENDHANDLER
[arp release]; [arp release];
return -1; return rowCount;
} }
static unsigned int trim(char *str) static unsigned int trim(char *str)