Forum > Databases

New float fields contain 6E-154

<< < (2/7) > >>

wp:

--- Quote from: SymbolicFrank on October 21, 2021, 10:08:56 am ---I was wondering if this should be the value used for a NULL.

--- End quote ---
No, NULL is not stored as an encoded data value but in a special location in the dataset data buffer outside the data value bytes.

SymbolicFrank:
I'll dig into it tomorrow. Perhaps it's a textfield at some point.

SymbolicFrank:
Yup, it's a string of spaces:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TDbfFile.InitDefaultBuffer; ..    // binary (non-text) field? (foxpro memo fields are binary, but dbase not)    if (TempFieldDef.NativeFieldType in ['I', 'O', '@', '+', '0', 'W', 'Y'])        or ((TempFieldDef.NativeFieldType = 'M') and (TempFieldDef.Size = 4) {Visual FoxPro?}) then      FillChar(PChar(FDefaultBuffer+TempFieldDef.Offset)^, TempFieldDef.Size, 0); 
Which is defined as:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TDbfFieldDef.VCLToNative;begin  FNativeFieldType := #0;  // to do: look into ftBytes support; e.g. Visual FoxPro varbytes?  case FFieldType of..    ftFloat, ftSmallInt, ftWord{$ifdef SUPPORT_INT64}      , ftLargeInt{$endif}{$ifdef SUPPORT_LONGWORD}      , ftLongWord, ftShortInt, ftByte{$endif}               :      FNativeFieldType := 'N'; //numerical..    ftBlob     :      case DBFVersion of        xFoxPro:          FNativeFieldType := 'P'; //picture; best we can do        xVisualFoxPro:          FNativeFieldType := 'W'; //blob        xBaseIII,xBaseIV:          FNativeFieldType := 'M'; //memo; best we can do        xBaseV,xBaseVII:          FNativeFieldType := 'B'; //binary 
It thinks it is a 'B' field, while it should be an 'F' (Float) field, "new" to FoxPro...

Is there a better DataSet component / library for manipulating FoxPro databases?

korba812:
Could you please attach a sample dbf file?

SymbolicFrank:
It's the default TDbf component, it should be part of any Lazarus install. The files are in: fpcsrc\packages\fcl-db\src\dbase .

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version