Wednesday, April 29, 2009

Tool for Viewing Table Properties

Last week I wrote a post about Memo Block Size which discussed using the AdsGetMemoBlockSize API. Since this is not reported directly in Advantage Data Architect I thought it might be useful to create a simple tool which will display this property.

I also thought that this small project might be a good way for me to further dust off my C coding skills. As it turns out this wasn't the best idea since I spent a lot more time on this project than I would have in C# or Delphi. However, I am hoping to become a more Pragmatic Programmer so I am spending some time in different languages. After a few false starts and a little help from my friends I was able to get my simple command line utility working.

The tool connects to Advantage and opens the specified table. It then runs several API calls to get information about the table. In the first iteration I returned the following information: Field Count (AdsGetNumFields), Index Count (AdsGetNumIndexes), FTS Index Count (AdsGetNumFTSIndexes), Memo Block Size (AdsGetMemoBlockSize) and Record Count (AdsGetRecordCount). So here is iteration one:

TableInfo Iteration One

Of course, this did not seem like enough information to return. So for iteration two I added code to get all of the field names, types and sizes. I also added code to retrieve the index tag names and expressions. Of course this meant that I had to add some switches to show these options. So iteration two looked like this:

TableInfo Iteration Two

I am currently on iteration 3 which includes support for dictionary tables along with a verbose mode which displays additional index information. I'll have the tool posted on the DevZone by the end of the week.

No comments: