libs-gdl2/EOAdaptors/Postgres95/Postgres95Private.h
David Ayers 7c80ffaf65 * EOAdaptors/Postgres95/Postgres95Private.m/h: New files
based on EOControl/EOPriv.m/h.
        * EOAdaptors/Postgres95/GNUmakefile.in: Build
        Postgres95Private.m.
        * EOAdaptors/Postgres95/Postgres95Adaptor.m: Do not depend on
        EOControl/EOPriv.m/h but on own private files.
        (+assignExternalInfoForEntity): Use objectAtIndex: instead of
        enumerator for speed.
        * EOAdaptors/Postgres95/Postgres95Channel.m: (+initialize)
        (-lowLevelResultFieldNames:, -fetchRowWithZone:)
        (-insertRow:forEntity:, -_describeResults, -describeTableNames)
        (-updateValues:inRowsDescribedByQualifier:entity:)
        (-_describeBasicEntityWithName:forModel:)
        (-_describeForeignKeysForEntity:forModel:)
        (-primaryKeyForNewRowWithEntity:): Do not depend on
        EOControl/EOPriv.m/h but on own private files.  Improve
        optimizations.
        (pgResultDictionary): Simplify unused static local be
        reverting optimizations.
        * EOAdaptors/Postgres95/Postgres95SQLExpression.m:
        (+initialize, +formatValue:forAttribute:)
        (+sqlPatternFromShellPattern:)
        (+sqlPatternFromShellPattern:withEscapeCharacter:): Do not
        depend on EOControl/EOPriv.m/h but on own private files.  Improve
        optimizations.
        * EOAdaptors/Postgres95/Postgres95Values.h/m
        (Postgres95CalendarFormat, Postgres95ValuesClass)
        (Postgres95Values_newValueForBytesLengthAttributeSEL)
        (Postgres95Values_newValueForBytesLengthAttributeIMP)
        (Postgres95Values_newValueForBytesLengthAttribute): Remove.
        ([NSCalendarDate+setPostgres95Format:]): Remove.
        ([NSCalendarDate+postgres95Format]): Deprecate.
        (LPSQLA_StringDefaultCStringEncoding): New local static.
        (+initialize, +newValueForNumberType:length:attribute:)
        (+newValueForCharactersType:length:attribute:)
        (+newValueForDateType:length:attribute:):  Do not depend on
        EOControl/EOPriv.m/h but on own private files.  Improve
        optimizations.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@20750 72102866-910b-0410-8b05-ffd578937521
2005-02-19 12:13:22 +00:00

163 lines
4.5 KiB
Objective-C

/* -*-objc-*-
Postgres95Private.h
Copyright (C) 2005 Free Software Foundation, Inc.
Author: Manuel Guesdon <mguesdon@orange-concept.com>
Date: Jan 2005
This file is part of the GNUstep Database Library.
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 2 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,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __Postgres95Private_h__
#define __Postgres95Private_h__
@class NSNumber;
@class EONull;
// ==== Classes ====
extern Class PSQLA_NSStringClass;
extern Class PSQLA_NSNumberClass;
extern Class PSQLA_NSDecimalNumberClass;
extern Class PSQLA_NSCalendarDateClass;
extern Class PSQLA_NSDateClass;
extern Class PSQLA_NSMutableArrayClass;
extern Class PSQLA_EOAttributeClass;
extern Class PSQLA_Postgres95ValuesClass;
// ==== IMPs ====
extern IMP PSQLA_NSNumber_allocWithZoneIMP;
extern IMP PSQLA_NSDecimalNumber_allocWithZoneIMP;
extern IMP PSQLA_NSString_allocWithZoneIMP;
extern IMP PSQLA_NSCalendarDate_allocWithZoneIMP;
extern IMP PSQLA_NSMutableArray_allocWithZoneIMP;
extern IMP PSQLA_EOAttribute_allocWithZoneIMP;
extern IMP PSQLA_Postgres95Values_newValueForBytesLengthAttributeIMP;
// ==== Constants ====
extern NSNumber *PSQLA_NSNumberBool_Yes;
extern NSNumber *PSQLA_NSNumberBool_No;
extern EONull *PSQLA_EONull;
extern NSArray *PSQLA_NSArray;
extern NSString *PSQLA_postgresCalendarFormat;
// ==== Init Method ====
extern void PSQLA_PrivInit(void);
// ==== IMP Helpers ====
static inline BOOL
_isNilOrEONull(id obj) __attribute__ ((unused));
static inline BOOL
_isNilOrEONull(id obj)
{
if (PSQLA_EONull == nil) PSQLA_PrivInit();
return (obj == nil || obj == PSQLA_EONull) ? YES : NO;
}
// ---- Postgres95Values newValueForBytes:length:attribute ----
#define PSQLA_Postgres95Values_newValueForBytesLengthAttribute(bytes, \
length, \
attribute) \
(*PSQLA_Postgres95Values_newValueForBytesLengthAttributeIMP) \
(PSQLA_Postgres95ValuesClass, \
@selector(newValueForBytes:length:attribute:), \
(bytes), (length), (attribute))
// ---- NSEnumerator nextObject ----
static inline id
PSQLA_NextObjectWithImpPtr(id object,IMP* impPtr)
{
if (object)
{
if (!*impPtr)
*impPtr=[object methodForSelector:@selector(nextObject)];
return (**impPtr)(object,@selector(nextObject));
}
else
return nil;
};
// ---- NSMutableString appendString: ----
#define PSQLA_AppendStringWithImp(string,methodIMP,aString) \
(*(methodIMP))((string),@selector(appendString:),(aString))
// ---- NSMutableArray addObject: ----
static inline void
PSQLA_AddObjectWithImpPtr(id object,IMP* impPtr,id objectToAdd)
{
if (object)
{
if (!*impPtr)
*impPtr=[object methodForSelector:@selector(addObject:)];
(**impPtr)(object,@selector(addObject:),objectToAdd);
};
};
// ---- NSArray objectAtIndex: ----
static inline id
PSQLA_ObjectAtIndexWithImpPtr(id object,IMP* impPtr,unsigned index)
{
if (object)
{
if (!*impPtr)
*impPtr=[object methodForSelector:@selector(objectAtIndex:)];
return (**impPtr)(object,@selector(objectAtIndex:),index);
}
else
return nil;
};
// ---- Dictionary objectForKey: ----
static inline id
PSQLA_ObjectForKeyWithImpPtr(id object,IMP* impPtr,id key)
{
if (object)
{
if (!*impPtr)
*impPtr=[object methodForSelector:@selector(objectForKey:)];
return (**impPtr)(object,@selector(objectForKey:),key);
}
else
return nil;
};
// ---- Dictionary setObject:forKey: ----
static inline void
PSQLA_SetObjectForKeyWithImpPtr(id object,IMP* impPtr,id value, id key)
{
if (object)
{
if (!*impPtr)
*impPtr=[object methodForSelector:@selector(setObject:forKey:)];
(**impPtr)(object,@selector(setObject:forKey:),value,key);
}
};
// ---- +alloc/+allocWithZone: ----
#define PSQLA_alloc(CLASS_NAME) \
(*PSQLA_##CLASS_NAME##_allocWithZoneIMP) \
(PSQLA_##CLASS_NAME##Class,@selector(allocWithZone:),NULL)
#endif /* __Postgres95Private_h__ */