[ADK-V4CC 0004885]: VField value returns not an object when the field is boolean

Ernesto Giannotta ernestogiannotta at tiscalinet.it
Sun Apr 25 06:13:37 CDT 2010


Hi Ruslan,

thanks always for your kind attention.

> !!! VField.value renamed to  VField.valueAsObject  !!!

Let me just make some observations about namings in V4CC

We have in the VString header:

	-(NSString*)stringValue;
	-(void)setStringValue:(NSString*)inNewValue;

and in the VLong header:

	-(int) value;
	-(void) setValue:(int) inNewValue;

What about having subclasses return always appropriately named values VString style, i.e.

	-(BOOL)booleanValue for VBoolean
	-(NSInteger)integerValue for VLong and all signed numeric values
	-(NSUInteger)unsignedIntegerValue for VUlong and all unsigned numeric values
	(btw how can you currently fit an unsigned long into an int if it's too big?)
	-(NSString *)stringValue for VString and all test fields
	-(NSData *)dataValue for VBlob

etc... and just leave value to super VField class like this

	-(id)value  returning always an object representation of the field's contents


BTW

mmm... I really don't understand how picts are handled here :-(
why can't we have some

	-(NSImage)imageValue for VPicture?



Well, I talked too much as usual... :-)
thank you all for your patience.



Cool Runnings,
Erne.


On Apr 22, 2010, at 22:42, Mantis Bug Tracker wrote:

> 
> The following issue has been RESOLVED. 
> ====================================================================== 
> http://www.valentina-db.com/bt/view.php?id=4885 
> ====================================================================== 
> Reported By:                Ernesto Giannotta
> Assigned To:                Ruslan Zasukhin
> ====================================================================== 
> Project:                    ADK-V4CC
> Issue ID:                   4885
> Category:                   Fields
> Reproducibility:            always
> Severity:                   crash
> Priority:                   normal
> Status:                     resolved
> Target Version:             4.6
> Resolution:                 fixed
> Fixed in Version:           4.6
> ====================================================================== 
> Date Submitted:             2010-04-19 13:23 CEST
> Last Modified:              2010-04-22 22:42 CEST
> ====================================================================== 
> Summary:                    VField value returns not an object when the field is
> boolean
> Description: 
> I've found that when asking for the value of a Vfield object it doesn't return a
> valid object if the field is boolean.
> 
> 
> Steps to Reproduce: 
> 	VCursor *testCursor = [mDB sqlSelect:@"Select * From Persons Order by
> FieldName"];
> 	NSLog(@"Name: %@", [[testCursor fieldAtIndex:1] value]);
> 	NSLog(@"Number: %@", [[testCursor fieldAtIndex:3] value]);
> 
> 	// workaround casting the field to a VBool
> 	NSLog(@"Bool: %d", [[testCursor booleanFieldAtIndex:2] value]);
> 
> 	// this will crash since the returned value of Bool field is not a proper
> object ref (it is a bool indeed, 0 or 1)
> 	NSLog(@"Bool: %@", [[testCursor fieldAtIndex:2] value]);	
> 	////////////////////////////////////////////////////////////////////////////////
> 
> 
> Additional Information: 
> Just run the attached project (never mind the name, I found it's a real pain to
> change the name of an XCode project ;-)
> ====================================================================== 
> 
> ---------------------------------------------------------------------- 
> (0005204) Ruslan Zasukhin (administrator) - 2010-04-22 18:35
> http://www.valentina-db.com/bt/view.php?id=4885#c5204 
> ---------------------------------------------------------------------- 
> Yes, I see problem.
> 
> Sources of issue here is that 
> VField class has methods 
>   - (id) value
>   - setValue: (id) inValue
> 
> and many subclasses of VField has methods with the same name, but different type
> for value.
> 
> And ObjC obviously consider them as overridden "virtual" methods.
> So when you have
> 
> VField* fld = [cursor fieldAtIndex: i];
> 
> and then call
>  [fld value]
> 
> we in fact get into sub-class methods, instead of VField class. 
> 
> I see the only way to fix this -- RENAME  VField methods to something as
>  - (id) valueAsObject
>  - setValueAsObject: (id) inValue
> 
> 
> We have check other ADKs as VNET, VCOM and they do not have such issue, just
> because they do not override value methods.
> 
> in V4RB this works fine, because for REALbasic VField.value and e.g. VLong.value
> are PROPERTIES, but not virtual methods.
> 
> 
> ---------------------------------------------------------------------- 
> (0005205) Ruslan Zasukhin (administrator) - 2010-04-22 22:42
> http://www.valentina-db.com/bt/view.php?id=4885#c5205 
> ---------------------------------------------------------------------- 
> !!! VField.value renamed to  VField.valueAsObject  !!!
> 
> You may need correct existed V4CC apps. 
> 
> Issue History 
> Date Modified    Username       Field                    Change               
> ====================================================================== 
> 2010-04-19 13:23 Ernesto GiannottaNew Issue                                    
> 2010-04-19 13:23 Ernesto GiannottaFile Added: OrderbyTest.zip                   
> 
> 2010-04-22 18:35 Ruslan ZasukhinNote Added: 0005204                          
> 2010-04-22 18:35 Ruslan ZasukhinAssigned To               => Ruslan Zasukhin 
> 2010-04-22 18:35 Ruslan ZasukhinStatus                   new => confirmed    
> 2010-04-22 20:35 Ruslan ZasukhinTarget Version            => 4.6             
> 2010-04-22 22:42 Ruslan ZasukhinNote Added: 0005205                          
> 2010-04-22 22:42 Ruslan ZasukhinStatus                   confirmed => resolved
> 2010-04-22 22:42 Ruslan ZasukhinFixed in Version          => 4.6             
> 2010-04-22 22:42 Ruslan ZasukhinResolution               open => fixed       
> ======================================================================
> 



More information about the Valentina mailing list