Solved

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

Posted on 2004-07-31
7
292 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 250 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10, DigitalPersona Fingerprint reader and MySQL 6 339
drawing animated level bar based on numbers 3 104
update joined tables 2 55
DBCtrlGrid, Delphi, Scroll 8 39
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

821 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