Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display all details of Paradox table (fields, indexes, attributes, defaults, etc.)

Posted on 2004-07-31
7
Medium Priority
?
306 Views
Last Modified: 2010-08-05
Hi there,

I am working on a project for which I need to develop a tool to display a table with all details of the table structure.
Including: field names, indexes, defaults, requiredYN, min/max values, etc.
Does someone know how I can realise this?

I'm using Delphi 7 and Paradox tables.

Thank you all in advance!

With Best Regards,
Stefan van Roosmalen
0
Comment
Question by:roosiedb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 11686065
procedure TForm1.SpeedButtonFieldsClick(Sender: TObject);
var
  I:      Integer;
  S:      string;
begin
  ListBoxFields.Clear;
  ListBoxFields.Items.Add('F i e l d        D a t a - t y p e s :');
  for I := 0 to tblEMPLOEE.FieldCount-1 do
  begin
    case tblEMPLOEE.Fields[I].DataType of
      ftUnknown:                  S := 'Unknown or undetermined';
      ftString:                    S := 'Character or string field';
      ftSmallint:                  S := '16-bit integer field';
      ftInteger:                  S := '32-bit integer field';
      ftWord:                      S := '16-bit unsigned integer field';
      ftBoolean:                  S := 'Boolean field';
      ftFloat:                    S := 'Floating-point numeric field';
      ftCurrency:                  S := 'Money field';
      ftBCD:                      S := 'Binary-Coded Decimal field that can be converted to Currency type without a loss of precision';
      ftDate:                      S := 'Date field';
      ftTime:                      S := 'Time field';
      ftDateTime:                  S := 'Date and time field';
      ftBytes:                    S := 'Fixed number of bytes (binary storage)';
      ftVarBytes:                  S := 'Variable number of bytes (binary storage)';
      ftAutoInc:                  S := 'Auto-incrementing 32-bit integer counter field';
      ftBlob:                      S := 'Binary Large OBject field';
      ftMemo:                      S := 'Text memo field';
      ftGraphic:                  S := 'Bitmap field';
      ftFmtMemo:                  S := 'Formatted text memo field';
      ftParadoxOle:                S := 'Paradox OLE field';
      ftDBaseOle:                  S := 'dBASE OLE field';
      ftTypedBinary:              S := 'Typed binary field';
      ftCursor:                    S := 'Output cursor from an Oracle stored procedure (TParam only)';
      ftFixedChar:                S := 'Fixed character field';
      ftWideString:                S := 'Wide string field';
      ftLargeint:                  S := 'Large integer field';
      ftADT:                      S := 'Abstract Data Type field';
      ftArray:                    S := 'Array field';
      ftReference:                S := 'REF field';
      ftDataSet:                  S := 'DataSet field';
      ftOraBlob:                  S := 'BLOB fields in Oracle 8 tables';
      ftOraClob:                  S := 'CLOB fields in Oracle 8 tables';
      ftVariant:                  S := 'Data of unknown or undetermined type';
      ftInterface:                S := 'References to interfaces (IUnknown)';
      ftIDispatch:                S := 'References to IDispatch interfaces';
      ftGuid:                      S := 'globally unique identifier (GUID) values';
      ftTimeStamp:                S := 'Date and time field accessed through dbExpress';
      ftFMTBcd:                    S := 'Binary-Coded Decimal field that is too large for ftBCD';
      else                    S := 'Unknown type of Field';
    end;
    ListBoxFields.Items.Add('''' + tblEMPLOEE.Fields[I].FullName + '''' + ', ' + S);
  end;
  ListBoxFields.Items.Add('');
  ListBoxFields.Items.Add('I n d e x e s :');
  for I := 0 to tblEMPLOEE.IndexDefs.Count-1 do
  begin
    S := tblEMPLOEE.IndexDefs[I].Fields;
    ListBoxFields.Items.Add('''' + S + '''' + ' is a defined index as ' + tblEMPLOEE.IndexDefs[I].Name);
  end;
end;

emil
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11686108
above example from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21078109.zip
0
 

Author Comment

by:roosiedb
ID: 11687002
Hi esoftbg,

Your solution is helping me for a start, but I still don't have all the required information (see my initial question).
For example:

- Default values
- Minimum/maximum values
- Required field Y/N
- Field size
- If memo, num of chars stored in .db
- Picture/mask
- Table lookup's
- Constraints

I really need to have all these details to be able to report the table's structure completely.
To have an idea of these fields, look at the program Database Desktop, which is shipped with Delphi7/Paradox.

Thank you in advance.

Regards,
Stefan.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 12

Expert Comment

by:esoftbg
ID: 11687121
Hi roosiedb,
I'll try to get more info about the Paradox table, but I don't believe it is possible about all the info you describe :-((
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 750 total points
ID: 11687366
procedure TForm1.SpeedButtonFieldsClick(Sender: TObject);
var
  I:             Integer;
  ListColumn:    TListColumn;
  ListItem:      TListItem;
  S:             string;
  T:             string;
begin
  ListBoxFields.Clear;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Field Name';
  ListColumn.Width := 72;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Data Type';
  ListColumn.Width := 224;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Default';
  ListColumn.Width := 48;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Required';
  ListColumn.Width := 56;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Size';
  ListColumn.Width := 32;
  ListColumn := ListView.Columns.Add;
  ListColumn.Caption := 'Lookup';
  ListColumn.Width := 48;
  for I := 0 to tblEMPLOEE.FieldCount-1 do
  begin
    case tblEMPLOEE.Fields[I].DataType of
      ftUnknown:                  S := 'Unknown or undetermined';
      ftString:                    S := 'Character or string field';
      ftSmallint:                  S := '16-bit integer field';
      ftInteger:                  S := '32-bit integer field';
      ftWord:                      S := '16-bit unsigned integer field';
      ftBoolean:                  S := 'Boolean field';
      ftFloat:                    S := 'Floating-point numeric field';
      ftCurrency:                  S := 'Money field';
      ftBCD:                      S := 'Binary-Coded Decimal field that can be converted to Currency type without a loss of precision';
      ftDate:                      S := 'Date field';
      ftTime:                      S := 'Time field';
      ftDateTime:                  S := 'Date and time field';
      ftBytes:                    S := 'Fixed number of bytes (binary storage)';
      ftVarBytes:                  S := 'Variable number of bytes (binary storage)';
      ftAutoInc:                  S := 'Auto-incrementing 32-bit integer counter field';
      ftBlob:                      S := 'Binary Large OBject field';
      ftMemo:                      S := 'Text memo field';
      ftGraphic:                  S := 'Bitmap field';
      ftFmtMemo:                  S := 'Formatted text memo field';
      ftParadoxOle:                S := 'Paradox OLE field';
      ftDBaseOle:                  S := 'dBASE OLE field';
      ftTypedBinary:              S := 'Typed binary field';
      ftCursor:                    S := 'Output cursor from an Oracle stored procedure (TParam only)';
      ftFixedChar:                S := 'Fixed character field';
      ftWideString:                S := 'Wide string field';
      ftLargeint:                  S := 'Large integer field';
      ftADT:                      S := 'Abstract Data Type field';
      ftArray:                    S := 'Array field';
      ftReference:                S := 'REF field';
      ftDataSet:                  S := 'DataSet field';
      ftOraBlob:                  S := 'BLOB fields in Oracle 8 tables';
      ftOraClob:                  S := 'CLOB fields in Oracle 8 tables';
      ftVariant:                  S := 'Data of unknown or undetermined type';
      ftInterface:                S := 'References to interfaces (IUnknown)';
      ftIDispatch:                S := 'References to IDispatch interfaces';
      ftGuid:                      S := 'globally unique identifier (GUID) values';
      ftTimeStamp:                S := 'Date and time field accessed through dbExpress';
      ftFMTBcd:                    S := 'Binary-Coded Decimal field that is too large for ftBCD';
      else                    S := 'Unknown type of Field';
    end;

    ListItem := ListView.Items.Add;
    ListItem.Caption := tblEMPLOEE.Fields[I].FullName;

    ListItem.SubItems.Add(S);
    ListItem.SubItems.Add(tblEMPLOEE.Fields[I].DefaultExpression);
    case tblEMPLOEE.Fields[I].Required of
      True:  T := 'True';
      else   T := 'False';
    end;
    ListItem.SubItems.Add(T);
    ListItem.SubItems.Add(IntToStr(tblEMPLOEE.Fields[I].Size));
    case tblEMPLOEE.Fields[I].FieldKind of
      fkLookUp: T := tblEMPLOEE.Fields[I].LookupDataSet.Name;
      else      T := 'none';
    end;
    ListItem.SubItems.Add(T);
  end;
  ListBoxFields.Items.Add('I n d e x e s :');
  for I := 0 to tblEMPLOEE.IndexDefs.Count-1 do
  begin
    S := tblEMPLOEE.IndexDefs[I].Fields;
    T := tblEMPLOEE.IndexDefs[I].Name;
    if (T<>'') then
      T := ' is a defined index as ' + T;
    ListBoxFields.Items.Add('''' + S + '''' + T);
  end;
end;
0
 

Author Comment

by:roosiedb
ID: 11687541
Hi esoftbg/emil,

The "default value" is not being showed yet, but all other information is on my screen now!
So, I can work with it...

Thank you!

Regards,
Stefan.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 11687722
Hi  roosiedb,
You are welcome !
I'll try to improve the programm about "default value", but I'm not sure in success ....
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question