Solved

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

Posted on 2004-07-31
7
289 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 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…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now