Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-07-31
7
Medium Priority
?
314 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

963 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