Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with CursorAdapters cursor schema
Message
From
04/10/2003 13:57:19
 
 
To
04/10/2003 04:00:16
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00833764
Message ID:
00835134
Views:
23
Aleksey

>If you run my code, it automatically puts the schema into clipboard, the only thing that is left to do is paste it into right place and modify data types.

I saw, yes it is prefferable to use your code, thanks.

>
>>
>But the problem with the builders is that by using :
>>
>>SQLEXEC(con,"select * from customers","res")
>>AFIELDS(aflds)
>>
>>they assume that the data type conversion that is made (or what the back end gives) is allways correct, which is not the case. I am telling you this because for instanse some drivers (Oracle) can return a Number Datatype which VFP interprets as N(20,0) but the value returned may have decimals (for instanse 1.235), as you understand we have to convert by hand the N(20,0) to N(20, 4).
>>
>
>Do you mean "manually convert data" or "manually change data type in CursorSchema"?
>

Manually change the data type in CursorSchema. The data are what they suppose to be, meaning the data corresponding to , say, field1 always come with no decimals and data corresponding to field2 always come with decimals (i saw this in the odbc trace), but both they are created (if i dont define otherwise in cursorschema) as N(20, 0) in the cursor. Now I saw that the data are saved in VFP cursor with decimals even if the data type is N(20, 0), but in order to see and use field2 correctly, I have to convert the data type of field2 to N(20,4) and the datatype of field1 leave it as it is.
Now to complicate the scenario to make it more real actually, the data type conversion should be done dynamicaly, because the remote table is a temporary one for which i dont know the fields in design time but only at runtime, and its name is passed to the program as parameter, thats why i wouldnt like to reffer to fields explicitly :

SQLEXEC(con,"select * from " + lcTable,"res")

for i = 1 to afields("res")

dosomething for field(i) < --- how do i suppose to know here if the original value of the, field has decimals or not i cannot know because if vfp has make it N(20, 0) then the decimals are trancated ...

endfor

Hoping that i didnot mixed things up, but reality is many times more complicated than scenarios.

Thanks
Dimitris
Previous
Reply
Map
View

Click here to load this message in the networking platform