Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Oracle Number and Afields..
Message
 
 
To
05/09/2003 04:43:34
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00826308
Message ID:
00826549
Views:
15
I have worked around this for quite some time now. What I do, is issued the following SPT:

select table_name, column_name, data_type, data_length,
data_precision, data_scale from cols order by 1, 2

I SCAN the cursor looking for DATE data types and redefine them as Date in VFP instead of DateTime. Then for NUMBER columns, I use the Data_Precision and Data_Scale for the width and column values when "redefining" the view in a DBC or a CursorAdapter. Depending on the width of the column and if the precision value is zero, I may define the data type in VFP as integer.

My code for resetting the NUMBER fields in the view looks like:
case crsFields.Data_Type = 'NUMBER'
   lnLength = alltrim(str(nvl(crsFields.Data_Precision, 8)))
   lnScale  = alltrim(str(nvl(crsFields.Data_Scale, 0)))
   if lnLength = 8 and val(lnScale) = 0   && lcField = "KEYID"
      DBSetProp(lcTable + '.' + lcField, 'Field', 'DataType', 'I')
   else
      if val(lnScale) = 0
         DBSetProp(lcTable + '.' + lcField, 'Field', 'DataType', 'N(&lnLength)')
      else
         DBSetProp(lcTable + '.' + lcField, 'Field', 'DataType', 'N(&lnLength, &lnScale)')
      endif
   endif
>I have noticed something odd..
>
>When I create a table on Oracle for example:
>create table testx (x number(2,1),y number(1),xx number(19),z number(20))
>
>
>If I got to foxpro and open the table with:
>
>SQLEXEC(h,'select * from testx')
>AFIELDS(laFlds)
>
>Then look at the array laFlds I notice the sizes are funny..
>
>x->N(4,1)
>y->N(3)
>xx->N(20)
>z->N(20)
>
>Has anybody seen this? Of course I can code around this in the application
>but I'm afraid what will happen if someone every fixes this bug.
>
>This happens with both the micorsoft odbc for oracle driver and the oracle odbc driver.
>
>BR
>Tim
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform