libs-gdl2/EOAccess/EOAdaptorOperation.m
Manuel Guesdon 3425fb640b * EOAccess/EOAccessFault.m
remove empty init methods
  fix warnings
* EOAccess/EOAdaptor.[hm]
  add -expressionFactory
* EOAccess/EOAdaptorChannel.m
  clean -performAdaptorOperation:
* EOAccess/EOAdaptorOperation.m
  fix warnings
* EOAccess/EODatabase.[hm]
  add/handle _timestamp
* EOAccess/EODatabaseChannel.h
  remove delegate (moved to EODatabaseContext)
  add _currentEditingContextTimestamp
  add _refreshedGIDs
* EOAccess/EODatabaseChannel.m
  fix warnings
  remove delegate (moved to EODatabaseContext)
  add _currentEditingContextTimestamp
  add _refreshedGIDs
  rewrite -setEntity:
  rewrite -setCurrentEditingContext:
  rewrite -fetchObject
  rewrite -cancelFetch
  rewrite -_selectWithFetchSpecification:editingContext:
* EOAccess/EODatabaseContext.h
  add EODatabaseChannel delegate stuff
* EOAccess/EODatabaseContextPriv.h
  add EODatabaseChannel delegate stuff
* EOAccess/EODatabaseContext.m
  add EODatabaseChannel delegate stuff
  fix EOAdaptor..Operator / EODatabase..Operator mismatch
* EOAccess/EODatabaseOperation.m
  fix warnings
* EOAccess/EOEntity.[hm], EOAccess/EOEntityPriv.h
  fix warnings
  add singleTable... methods
* EOAccess/EOExpressionArray.m
  fix warnings
* EOAccess/EOSQLExpression.m
  rewrite -prepareInsertExpressionWithRow:
* EOAccess/EOSQLExpressionFactory.[hm]
  new class
* EOAccess/EOUtilities.[hm]
  remove duplicate methods
* EOAccess/GNUmakefile
  add EOSQLExpressionFactory.[hm]
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.h
  remove duplicate _adaptorContext
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m
  remove duplicate _adaptorContext
  remove unused pgResultDictionary()
* EOControl/EOEditingContext.h
  handle fetchTimestamp
* EOControl/EOEditingContext.m
  handle fetchTimestamp
  rewrite -deleteObject:
  fix warnings
* EOControl/EOGenericRecord.m
  fix warnings
* EOControl/EOMutableKnownKeyDictionary.m
  fix warnings
* EOControl/EONSAddOns.[hm]
  remove duplicate method
* EOControl/EONull.m
  fix warnings


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@37938 72102866-910b-0410-8b05-ffd578937521
2014-06-03 19:04:01 +00:00

226 lines
4.7 KiB
Objective-C

/**
EOAdaptorOperation.m <title>EOAdaptorOperation Class</title>
Copyright (C) 2000-2002,2003,2004,2005 Free Software Foundation, Inc.
Author: Mirko Viviani <mirko.viviani@gmail.com>
Date: February 2000
$Revision$
$Date$
<abstract></abstract>
This file is part of the GNUstep Database Library.
<license>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</license>
**/
#include "config.h"
#ifdef GNUSTEP
#include <Foundation/NSException.h>
#include <Foundation/NSDebug.h>
#else
#include <Foundation/Foundation.h>
#endif
#ifndef GNUSTEP
#include <GNUstepBase/GNUstep.h>
#include <GNUstepBase/GSObjCRuntime.h>
#include <GNUstepBase/NSDebug+GNUstepBase.h>
#endif
#include <EOAccess/EODatabaseOperation.h>
#include <EOAccess/EOAttribute.h>
#include <EOAccess/EOEntity.h>
#include <EOAccess/EOStoredProcedure.h>
#include <EOControl/EOSortOrdering.h>
#include <EOControl/EODebug.h>
#include <EOControl/EOQualifier.h>
@implementation EOAdaptorOperation
+ (EOAdaptorOperation *)adaptorOperationWithEntity: (EOEntity *)entity
{
return [[[self alloc] initWithEntity: entity] autorelease];
}
- (id) initWithEntity: (EOEntity *)entity
{
if ((self = [self init]))
{
ASSIGN(_entity, entity);
}
return self;
}
- (void)dealloc
{
DESTROY(_entity);
DESTROY(_qualifier);
DESTROY(_changedValues);
DESTROY(_attributes);
DESTROY(_storedProcedure);
DESTROY(_exception);
[super dealloc];
}
- (EOAdaptorOperator)adaptorOperator
{
return _adaptorOperator;
}
- (void)setAdaptorOperator: (EOAdaptorOperator)adaptorOperator
{
_adaptorOperator = adaptorOperator;
}
- (EOEntity *)entity
{
return _entity;
}
- (EOQualifier *)qualifier
{
return _qualifier;
}
- (void)setQualifier: (EOQualifier *)qualifier
{
ASSIGN(_qualifier, qualifier);
}
- (NSDictionary *)changedValues
{
return _changedValues;
}
- (void)setChangedValues: (NSDictionary *)changedValues
{
ASSIGN(_changedValues, changedValues);
}
- (NSArray *)attributes
{
return _attributes;
}
- (void)setAttributes: (NSArray *)attributes
{
ASSIGN(_attributes, attributes);
}
- (EOStoredProcedure *)storedProcedure
{
return _storedProcedure;
}
- (void)setStoredProcedure: (EOStoredProcedure *)storedProcedure
{
ASSIGN(_storedProcedure, storedProcedure);
}
- (NSException *)exception
{
return _exception;
}
- (void)setException: (NSException *)exception
{
ASSIGN(_exception, exception);
}
- (NSComparisonResult)compareAdaptorOperation: (EOAdaptorOperation *)adaptorOp
{
NSComparisonResult res;
EOAdaptorOperator otherOp = [adaptorOp adaptorOperator];
res = [[_entity name] compare: [[adaptorOp entity] name]];
if(res == NSOrderedSame)
{
if(_adaptorOperator == otherOp)
res = NSOrderedSame;
else if(_adaptorOperator < otherOp)
res = NSOrderedAscending;
else
res = NSOrderedDescending;
}
return res;
}
- (NSString *)description
{
//TODO revoir
NSString *operatorString = nil;
NSString *desc = nil;
switch(_adaptorOperator)
{
case EOAdaptorUndefinedOperator:
operatorString = @"EOAdaptorUndefinedOperator";
break;
case EOAdaptorLockOperator:
operatorString = @"EOAdaptorLockOperator";
break;
case EOAdaptorInsertOperator:
operatorString = @"EOAdaptorInsertOperator";
break;
case EOAdaptorUpdateOperator:
operatorString = @"EOAdaptorUpdateOperator";
break;
case EOAdaptorDeleteOperator:
operatorString = @"EOAdaptorDeleteOperator";
break;
case EOAdaptorStoredProcedureOperator:
operatorString = @"EOAdaptorStoredProcedureOperator";
break;
default:
operatorString = @"Unknwon";
break;
}
desc = [NSString stringWithFormat: @"<%s %p : operator: %@ entity: %@ qualifier:%@\nchangedValues: %@\nattributes:%@\nstoredProcedure: %@\nexception: %@>",
object_getClassName(self),
(void*)self,
operatorString,
[_entity name],
_qualifier,
_changedValues,
_attributes,
_storedProcedure,
_exception];
return desc;
}
@end