V4CC - VVarchar constructors faulty

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Mon Jan 4 11:30:29 CST 2010


On 1/3/10 10:42 PM, "Ernesto Giannotta" <ernestogiannotta at tiscalinet.it>
wrote:

Hi Erne,
 
> from the V4CC_VarChar.h:
> 
> @interface VVarChar : VString
> {
> }
> 
> -(id) initWithName:(NSString*)inName maxLength:(int)inLen flags:(int) inFlags
> method:(NSString*)inMethod;
> -(id) initWithName:(NSString*)inName length:(int)inLen flags:(int)inFlags;
> -(id) initWithName:(NSString*)inName length:(int)inLen;
> -(id) initWithName:(NSString*)inName;
> 
> but only first constructor returns a valid Varchar field, the others generate
> a Vstring object with unpredictable results (banged my head on it all day
> long!)
> 
> So better remove them from header or make them work as expected ;-)
> 
> I'll Mantis this right away.

This is sources of VarChar class in V4CC

By idea, second, third, forth constructors should call the first one.

But you say they create VStrng class ...
may be in fact is called PARENT ctor ... But why


/***************************************************************************
*******************/
@interface VVarChar : VString
{
}

-(id) initWithName:(NSString*)inName maxLength:(int)inLen flags:(int)
inFlags method:(NSString*)inMethod;
-(id) initWithName:(NSString*)inName length:(int)inLen flags:(int)inFlags;
-(id) initWithName:(NSString*)inName length:(int)inLen;
-(id) initWithName:(NSString*)inName;


/***************************************************************************
*******************/
@end // @interface VVarChar


/***************************************************************************
*******************/
@implementation VVarChar

/***************************************************************************
*******************/
-(id) initWithName:(NSString*)inName maxLength:(int)inLen flags:(int)
inFlags method:(NSString*)inMethod
{
    self = [super init];
    if( self )
    {
        START( "VarChar_Ctor" );
        LOG_PARAM( self );
        LOG_PARAM( inName );
        LOG_PARAM( inLen );
        LOG_PARAM( inFlags );
        LOG_PARAM( inMethod );
        
        try
        {
            if( gTable )
            {
                // fucking RB have create BLOB class already, so
                data->mpField = NULL;
                
                Str_Unicode u_name( inName );
                Str_Unicode u_method( inMethod );
                
                I_Field_Ptr pField = CreateVarCharField(
                    gTable, u_name.c_str(), inLen, ushort(inFlags),
u_method.c_str() );
                
                Field_SetInstance( self, data, pField );
            }
            
        }MY_END_TRY
    }
    
    RETURN( self );
}


/***************************************************************************
*******************/
-(id)initWithName:(NSString*)inName length:(int)inLen flags:(int)inFlags
{
    return [self initWithName:inName length:inLen flags:inFlags method:nil];
}

/***************************************************************************
*******************/
-(id)initWithName:(NSString*)inName length:(int)inLen
{
    return [self initWithName:inName length:inLen flags:fNone method:nil];
}

/***************************************************************************
*******************/
-(id)initWithName:(NSString*)inName
{
    return [self initWithName:inName length:20 flags:fNone method:nil];
}

/***************************************************************************
*******************/
@end // @implementation VVarChar



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macserve.net/pipermail/valentina/attachments/20100104/bf3f1e50/attachment-0001.html 


More information about the Valentina mailing list