View Issue Details

IDProjectCategoryView StatusLast Update
0004885ADK-V4CCFieldspublic2010-04-22 20:42
ReporterErnesto GiannottaAssigned ToRuslan Zasukhin 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
PlatformApple Mac OSOS XOS Version10.6.3
Product Version4.5.1 
Target Version4.6Fixed in Version4.6 
Summary0004885: VField value returns not an object when the field is boolean
DescriptionI'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 InformationJust run the attached project (never mind the name, I found it's a real pain to change the name of an XCode project ;-)
TagsNo tags attached.

Activities

Ernesto Giannotta

Ernesto Giannotta

2010-04-19 11:23

reporter  

OrderbyTest.zip (34,547 bytes)
Ruslan Zasukhin

Ruslan Zasukhin

2010-04-22 16:35

administrator   ~0005204

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.
Ruslan Zasukhin

Ruslan Zasukhin

2010-04-22 20:42

administrator   ~0005205

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

You may need correct existed V4CC apps.

Issue History

Date Modified Username Field Change
2010-04-19 11:23 Ernesto Giannotta New Issue
2010-04-19 11:23 Ernesto Giannotta File Added: OrderbyTest.zip
2010-04-22 16:35 Ruslan Zasukhin Note Added: 0005204
2010-04-22 16:35 Ruslan Zasukhin Assigned To => Ruslan Zasukhin
2010-04-22 16:35 Ruslan Zasukhin Status new => confirmed
2010-04-22 18:35 Ruslan Zasukhin Target Version => 4.6
2010-04-22 20:42 Ruslan Zasukhin Note Added: 0005205
2010-04-22 20:42 Ruslan Zasukhin Status confirmed => resolved
2010-04-22 20:42 Ruslan Zasukhin Fixed in Version => 4.6
2010-04-22 20:42 Ruslan Zasukhin Resolution open => fixed