make -simpleExecute: easier to use.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@40495 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2017-04-28 08:37:59 +00:00
parent f372c3a542
commit 8aa31fe8d4
2 changed files with 18 additions and 3 deletions

View file

@ -1016,9 +1016,11 @@ SQLCLIENT_PRIVATE
* Calls -backendExecute: in a safe manner.<br /> * Calls -backendExecute: in a safe manner.<br />
* Handles locking.<br /> * Handles locking.<br />
* Maintains -lastOperation date.<br /> * Maintains -lastOperation date.<br />
* Returns the result of -backendExecute: * Returns the result of the -backendExecute: method call.<br />
* Accepts a mutable array argument (as produced by the prepare methods)
* or a simple SQL statement (a string), otherwise raises an exception.
*/ */
- (NSInteger) simpleExecute: (NSArray*)info; - (NSInteger) simpleExecute: (id)info;
/** /**
* Calls -simpleQuery:recordType:listType: with the default record class * Calls -simpleQuery:recordType:listType: with the default record class

View file

@ -2441,11 +2441,24 @@ static int poolConnections = 0;
[lock unlock]; [lock unlock];
} }
- (NSInteger) simpleExecute: (NSArray*)info - (NSInteger) simpleExecute: (id)info
{ {
NSInteger result; NSInteger result;
NSString *debug = nil; NSString *debug = nil;
if ([info isKindOfClass: NSArrayClass] == NO)
{
if ([info isKindOfClass: NSStringClass] == NO)
{
[NSException raise: NSInvalidArgumentException
format: @"[%@ -simpleExecute: %@ (class %@)]",
NSStringFromClass([self class]),
info,
NSStringFromClass([info class])];
}
info = [NSMutableArray arrayWithObject: info];
}
[lock lock]; [lock lock];
NS_DURING NS_DURING
{ {