Forum > Databases

The current value of AutoInc fields in a TDbf table

<< < (5/6) > >>

Another question: when looking at the wiki to see what has to be changed, I noticed that it states that Visual dBase VII, Foxpto and Visual FoxPro all support AutoInc fields. Yes to dBase VII, but I couldn't find if FoxPro supports them as well. And only Visual Foxpro supports a StepSize. I found this file format specification. but it doesn't cover dBase VII.

It is in the code:

--- 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";}};} ---// OH 2000-11-15 dBase7 support. Header Update (add fields like Next AutoInc Value)
But I'm not sure if it would work for the other two. I expect only partially, but it is not easy to test, as XBase++ doesn't support all those formats. I found the following table:

--- Code: ---Mapping of FoxPro field types in the Xbase++ DDL

  Description           Field type  Length   Field type  Valtype()

  FoxPro                                     Xbase++

  Double                B           8        F           N
  Character (text)  *)  C           1-254    C           C
  Character (binary)    C           1-254    X           C
  Date                  D           8        D           D

  Float                 F           1-20     N           N
  Generic               G           4        O           M
  Long signed integer   I           4        I           N
  Logical               L           1        L           L
  Memo (text)       *)  M           4 or 10  M           M
  Memo (binary)         M           4 or 10  V           M
  Numeric               N           1-20     N           N

  Time stamp            T           8        T           C
  Currency              Y           8        Y           N
  VarChar *)            V           1-254    R           C     Don't use !
  VarBinary             Q           1-254    Z           C     Don't use !
  Integer (autoinc)     I           4        S           N

 *) Data is converted according to SET CHARSET
--- End code ---

And there are some other things I'll have fix on the wiki, like how to use the table levels and the "field length limit" (which is actually the "field name length limit").

I couldn't find any information about autoinc fields on FoxPro. All information available is for VisualFoxPro so I guess FoxPro doesn't support autoinc fields.
Moreover, TDbf component with TableLevel = 25 and autoinc fields produces invalid dbf file - header version is $30 (VFP without autoinc) and autoinc field is '+' instead of 'I'. Interestingly, such a file cannot be opened in TDbf. So TDbf definitely doesn't support AutoInc at TableLevel = 25.

Have you thought about doing it "sqlite-style"?
IIRC, the moment you declare a field in a sqlite-table to be autoincrement, sqlite creates (or appends to) a table called "sqlite_sequence", keeping track of the highest value of each AutoInc-Field of each Table (remember: a table can have more than one AutoInc-Field).

Interesting approach, Zvoni. I'll keep it in mind if I need something like that.

But we're mostly trying to make the TDbf component more compatible with the existing DBF formats.



[0] Message Index

[#] Next page

[*] Previous page

Go to full version