mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
added support for stored procedures
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b69c88f62
commit
fb061e0a13
2 changed files with 55 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
|||
2010-05-26 David Wetzel <dave@turbocat.de>
|
||||
* EOAccess/EOEntity.m
|
||||
added support for stored procedures
|
||||
|
||||
2010-05-19 David Wetzel <dave@turbocat.de>
|
||||
* EOAccess/EOStoredProcedure.m
|
||||
setName: added loadAllModelObjects and checks
|
||||
|
|
|
@ -125,6 +125,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
if ((self = [self init]) != nil)
|
||||
{
|
||||
NSArray *array = nil;
|
||||
NSDictionary * aDict = nil;
|
||||
NSString *tmpString = nil;
|
||||
id tmpObject = nil;
|
||||
|
||||
|
@ -258,16 +259,24 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
_flags.relationshipsIsLazy = YES;
|
||||
}
|
||||
|
||||
array = [propertyList objectForKey: @"storedProcedureNames"];
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity",@"relationships: %@",array);
|
||||
if ([array count] > 0)
|
||||
{
|
||||
NSEmitTODO(); //TODO
|
||||
if ((aDict == [propertyList objectForKey: @"storedProcedureNames"]))
|
||||
{
|
||||
NSEnumerator * keyEnumerator = [aDict keyEnumerator];
|
||||
NSString * curentKey;
|
||||
ASSIGN(_storedProcedures, [NSMutableDictionary dictionary]);
|
||||
|
||||
while ((curentKey = [keyEnumerator nextObject])) {
|
||||
EOStoredProcedure * storedproc;
|
||||
if ((storedproc = [_model storedProcedureNamed:[aDict objectForKey:curentKey]]))
|
||||
{
|
||||
[_storedProcedures setObject:storedproc
|
||||
forKey:curentKey];
|
||||
}
|
||||
}
|
||||
|
||||
tmpString
|
||||
= [propertyList objectForKey: @"maxNumberOfInstancesToBatchFetch"];
|
||||
|
||||
}
|
||||
|
||||
tmpString = [propertyList objectForKey: @"maxNumberOfInstancesToBatchFetch"];
|
||||
|
||||
EOFLOGObjectLevelArgs(@"EOEntity",
|
||||
@"maxNumberOfInstancesToBatchFetch=%@ [%@]",
|
||||
|
@ -524,6 +533,27 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
forKey: @"relationships"];
|
||||
}
|
||||
}
|
||||
// stored procedures
|
||||
//
|
||||
// storedProcedureNames = {EOInsertProcedure = fooproc; };
|
||||
|
||||
if ((_storedProcedures != nil) && ([_storedProcedures count]))
|
||||
{
|
||||
NSString *currentKey = nil;
|
||||
NSEnumerator *keyEnumerator = [[[_storedProcedures allKeys]
|
||||
sortedArrayUsingSelector:@selector(compare:)] objectEnumerator];
|
||||
NSMutableDictionary * newDict = [NSMutableDictionary dictionary];
|
||||
|
||||
while ((currentKey = [keyEnumerator nextObject])) {
|
||||
[newDict setObject:[[_storedProcedures objectForKey:currentKey] name]
|
||||
forKey:currentKey];
|
||||
}
|
||||
|
||||
[propertyList setObject: newDict
|
||||
forKey: @"storedProcedureNames"];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -2072,8 +2102,18 @@ createInstanceWithEditingContext:globalID:zone:
|
|||
forOperation: (NSString *)operation
|
||||
{
|
||||
[self willChange];
|
||||
[_storedProcedures setObject: storedProcedure
|
||||
forKey: operation];
|
||||
|
||||
if (!_storedProcedures)
|
||||
{
|
||||
ASSIGN(_storedProcedures, [NSMutableDictionary dictionary]);
|
||||
}
|
||||
|
||||
if (storedProcedure != nil) {
|
||||
[_storedProcedures setObject:storedProcedure
|
||||
forKey:operation];
|
||||
} else {
|
||||
[_storedProcedures removeObjectForKey:operation];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue