Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Xbase Codebase > Re: Dynamic cre...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 239 of 310
Post > Topic >>

Re: Dynamic create of foxpro files

by "Tjipke A. van der Plaats" <info@[EMAIL PROTECTED] > Mar 2, 2006 at 08:45 PM

>I have a program for converting tab-delimited text to codebase foxpro
> databases.  One problem at the moment is that d4create doesn't work
> with dynamic arrays of field or tag infos.  This means I have to keep a
> static array that is large enough to contain any potential database.
> This leads to ugly code and bad dependencies.  Is there any way to make
> a dynamic datastructure that can be passed to d4create successfully
> which is more scientific than just manually packing it into a block of
> memory.

Hello,

Here some snippets of a piece of code I use in CB4 Tables (see 
www.tiriss.com/cb4tables)

var
  FieldDescs: array of FIELD4INFO;
begin
    SetLength(FieldDescs, FieldDefs.Count+1);
    for I := 0 to FieldDefs.Count-1 do
    begin
      with FieldDescs[I] do
      begin
        Len := FieldDefs[I].Size;
//        etc...
      end;
    end;
    FieldDescs[FieldDefs.Count].Name := nil;
// ... lost of other stuff like initializing the tags just like the fields
    FCBDATA4 := d4create(Database.CBCODE4, PChar(TablePath),
@[EMAIL PROTECTED]
 
@[EMAIL PROTECTED]
);


So basically just declare it as a dynamic array, and after that use 
setlength to set the length.
I have tested this in D5 - D2006, so I guess it should work for you too.

Regards,

    Tjipke van der Plaats
    (Author of CB4 tables: the easiest way to use Codebase in Delphi!)

--
 




 4 Posts in Topic:
Dynamic create of foxpro files
"hellokarl" <  2006-02-26 21:02:57 
Re: Dynamic create of foxpro files
Andrew Clay <Andrew_Cl  2006-02-27 17:20:02 
Re: Dynamic create of foxpro files
"hellokarl" <  2006-02-28 20:03:49 
Re: Dynamic create of foxpro files
"Tjipke A. van der P  2006-03-02 20:45:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 0:29:11 CST 2008.