Solved

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

Posted on 2004-07-31
7
284 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
Comment Utility
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
Comment Utility
above example from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21078109.zip
0
 

Author Comment

by:roosiedb
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Expert Comment

by:esoftbg
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

744 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

16 Experts available now in Live!

Get 1:1 Help Now