STRU - Lists and modifies the structure of the dbfs files

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs files

Post by Pablo César »

Hi amigo Esgici !

Your example is very interesting uses of DBINFO. Thank you for your contrib.

I was thinking before I was making adjustings to determine which can of DBF file is: Clipper or FoxPro format (DBT or FPT). And I found another good example of Mr. Grigory Filatov in C:\MiniGUI\SAMPLES\Advanced\dbfHeaderInfo\demo.prg

But I did not implemented, because I thought it is enough to know if dbf contains DBT or FPT extension file. But I also understand that is not the right way to know.

I make some little changes in your code and I adapted Grigory example for other option. The interesting, all of these bringing us a good chance to implement with very good ideas. Which I am very greatfully, Mr Esgici ! So I am attaching both exemples here for testing, one is using opening dbf to obtain results, other example is not necessary to open with command USE or DBUSEAREA which is also interesting (open file in low level, yes).

Thank you again Mr. Esgici for your special good attention.
Attachments
Memos.rar
(1.22 MiB) Downloaded 267 times
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by esgici »

Ola Amigo Pablo

Thanks to double demo and your nice words, I'm honoured :)

Once upon a time my teacher said me : "prefer high level whenever possible ! ..." ;)

Please don't compare me with gurus, I'm only a student :oops:

In other hand, the "identification code" code of table ( very first byte of every table ) has many more variations:
0x02 : 2 : FoxBASE
0x03 : 3 : FoxBASE+ or dBASE III+, no memo
0x30 : 48 : Visual FoxPro
0x31 : 49 : Visual FoxPro, autoincrement enabled
0x43 : 67 : dBASE IV SQL, no memo
0x54 : 84 : dBASE IV SQL table, with memo
0x63 : 99 : dBASE IV SQL system, no memo
0x83 : 131 : FoxBASE+ or dBASE III+, with memo
0x8B : 139 : dBASE IV with memo
0xA7 : 167 : FoxPro 2.x (or older), with memo
0xB9 : 185 : FoxBASE ( memo ? )
0xCB : 203 : dBASE IV SQL table files, with memo
0xE2 : 226 : FoxBASE+ or dBASE III+, with memo
0xEF : 239 : dBASE IV with memo
0xF5 : 245 : FoxPro 2.x (or earlier) with memo
0xFB : 251 : FoxBASE
As easily seen, there are more codes meaning "FPT" other than 0xF5.
Pablo César wrote: open file in low level ...
Did you meant something like this ?

Saludos
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs file

Post by Pablo César »

esgici wrote:Once upon a time my teacher said me : "prefer high level whenever possible ! ..."
Yeah ! I fully agree !
In other hand, the "identification code" code of table ( very first byte of every table ) has many more variations:

0x02 : 2 : FoxBASE
0x03 : 3 : FoxBASE+ or dBASE III+, no memo
0x30 : 48 : Visual FoxPro
0x31 : 49 : Visual FoxPro, autoincrement enabled
0x43 : 67 : dBASE IV SQL, no memo
0x54 : 84 : dBASE IV SQL table, with memo
0x63 : 99 : dBASE IV SQL system, no memo
0x83 : 131 : FoxBASE+ or dBASE III+, with memo
0x8B : 139 : dBASE IV with memo
0xA7 : 167 : FoxPro 2.x (or older), with memo
0xB9 : 185 : FoxBASE ( memo ? )
0xCB : 203 : dBASE IV SQL table files, with memo
0xE2 : 226 : FoxBASE+ or dBASE III+, with memo
0xEF : 239 : dBASE IV with memo
0xF5 : 245 : FoxPro 2.x (or earlier) with memo
0xFB : 251 : FoxBASE
I have seen this table before, thanks for mentioning.
As easily seen, there are more codes meaning "FPT" other than 0xF5.
Well seems it is longer matter than we think. In this case, I do not have inttentions to create a table types of rdds. I believe that only by it extension name, will be enough.
Pablo César wrote: open file in low level ...
Did you meant something like this ?
Wow Mr. Esgici, this is also very good job. I liked much "Record Data" tab. Very prolixed job, congrats !!
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by esgici »

Obrigado Pablo :)
Pablo César wrote: ... Very prolixed job, congrats !!
Sorry, what is meaning of prolixed :?

Saludos
Viva INTERNATIONAL HMG :D
User avatar
danielmaximiliano
Posts: 2625
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by danielmaximiliano »

esgici wrote:Obrigado Pablo :)
Pablo César wrote: ... Very prolixed job, congrats !!
Sorry, what is meaning of prolixed :?

Saludos
Hi Esgici :
Look : http://translate.google.com/#es/en/prolijo
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs files

Post by Pablo César »

esgici wrote:
Pablo César wrote: ... Very prolixed job, congrats !!
Sorry, what is meaning of prolixed :?
Sorry. I´ve tried to say with this meaning: A capricious notion, fancy, brillant.

Finally in English version ! Release version 3.5.
Two files .Lng have been attached (Portuguese and English). Translations must be done to local language according English.lng file and should be following the same sequence, line by line.
Whom wish to colaborate with attaching local language file already translated, would it be much appreciated your contribution.

<Attached file removed, see last message with now release>
Last edited by Pablo César on Thu Aug 30, 2012 8:48 pm, edited 1 time in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by esgici »

Ola Pablo
Pablo César wrote:prolixed, capricious, fancy, etc.
Please don't care; I know you don't use any bad word about me ;)
Pablo César wrote:Finally in English version ! Release version 3.5.
Thanks a lot :)

I hope that I will understand finally meaning of "processos" :)

Regarding translation; definitely I will translate it to my language and will post to you :arrow:

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs file

Post by Pablo César »

esgici wrote:
Pablo César wrote:prolixed, capricious, fancy, etc.
Please don't care; I know you don't use any bad word about me
Ohh no, never.
Regarding translation; definitely I will translate it to my language and will post to you
Ohhh yeah, it will be usefull for others. Thanks in advanced.

Made another small implementing but great in its sense ! My mention of "My thanks to: "+Contributors_friends() at Read me StatusBar item ;)

Thank all for tips !

<Attached file removed, see last message with now release>
Last edited by Pablo César on Fri Aug 31, 2012 1:41 am, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: STRU - Lists and modifies the structure of the dbfs file

Post by esgici »

Hi Pablo

Thank to your thanks to me on Read Me page; I'm honored :oops: :)

I understood why I don't understood :D

You are using too many functions that I don't heard yet :(

Such as :

Code: Select all

Hb_CompileFromBuf()
Hb_HrbDo()
Hb_HrbLoad()
and others ...

Please inform me the source of this unknown, undocumented, mysterious things and their usages :(

By the way, we have a little problem :

Error BASE/1003 Variable does not exist: HB_GTI_CLIPBOARDDATA
Called from SELESAIDA(338)

Probably, you have made a global find and replace for "HB_" -> "Hb_" ;)
sadly manifest constants are case sensitive :(

In other hand, IMHO we don't need tricky low level functions for hex <-> dec conversions;
NTOC( nX, 16 ) is usable to convert for any numeric to hex and CTON( cX, 16 ) any hex string to numeric.

TIA

Hi All

This is my 2000 nth post :o

Everything is for community;

Viva HMG !
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

STRU - Lists and modifies the structure of the dbfs file

Post by Pablo César »

esgici wrote:You are using too many functions that I don't heard yet :(

Such as :

Code: Select all

Hb_CompileFromBuf()
Hb_HrbDo()
Hb_HrbLoad()
and others ...

Please inform me the source of this unknown, undocumented, mysterious things and their usages :(
These internal functions of Harbour is not new, itg is from ChangeLog 9545 2008-10-04 19:23:36Z druzus. And these are documented (one of my recommended site for Harbour searching is: http://www.harbour.vouch.info/index.html) and it is from Virtual Memory API, please see in c:\harbour\source\vm and c:\harbour\source\compiler you will find files: runner.c and hbcmplib.c having following functions:

Code: Select all

HB_COMPILEFROMBUF(void)
HB_FUNC( HB_COMPILEFROMBUF )
{
   int iResult, argc;
   char ** argv, * szSource;
   BYTE * pBuffer;
   ULONG ulLen;

   szSource = hb_parc( 1 );
   if( szSource )
   {
      hb_compGenArgList( 2, hb_pcount(), &argc, &argv );
      iResult = hb_compMain( argc, argv, &pBuffer, &ulLen, szSource );
      hb_xfree( argv );
      if( iResult == EXIT_SUCCESS && pBuffer )
         hb_retclen_buffer( ( char * ) pBuffer, ulLen );
   }
}

Code: Select all

HB_HRBDO(void)
HB_FUNC( HB_HRBDO )
{
   PHRB_BODY pHrbBody = hb_hrbParam( 1 );

   if( pHrbBody )
   {
      int iPCount = hb_pcount() - 1;
      PHB_ITEM * pParams = NULL;
      int i;

      if( iPCount > 0 )
      {
         pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount );

         for( i = 0; i < iPCount; i++ )
            pParams[ i ] = hb_stackItemFromBase( i + 2 );
      }

      hb_hrbDo( pHrbBody, iPCount, pParams );

      if( pParams )
         hb_xfree( pParams );
   }
   else
      hb_errRT_BASE( EG_ARG, 6104, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}

Code: Select all

HB_HRBLOAD(void)
HB_FUNC( HB_HRBLOAD )
{
   ULONG ulLen = hb_parclen( 1 );

   if( ulLen > 0 )
   {
      char * fileOrBody = hb_parc( 1 );
      PHRB_BODY pHrbBody;

      if( ulLen > 4 && memcmp( szHead, fileOrBody, 4 ) == 0 )
         pHrbBody = hb_hrbLoad( fileOrBody, ulLen );
      else
         pHrbBody = hb_hrbLoadFromFile( fileOrBody );

      if( pHrbBody )
      {
         int iPCount = hb_pcount() - 1;
         PHB_ITEM * pParams = NULL;
         int i;

         if( iPCount > 0 )
         {
            pParams = ( PHB_ITEM * ) hb_xgrab( sizeof( PHB_ITEM ) * iPCount );

            for( i = 0; i < iPCount; i++ )
               pParams[ i ] = hb_stackItemFromBase( i + 2 );
         }

         hb_hrbInit( pHrbBody, iPCount, pParams );

         if( pParams )
            hb_xfree( pParams );
      }
      hb_hrbReturn( pHrbBody );
   }
   else
      hb_errRT_BASE( EG_ARG, 9998, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
This combined functions, I noted from Rossine post in viewtopic.php?p=20301#p20301 when Mr. Roberto ask for "invoke (run) a .hrb file from an application".
By the way, we have a little problem :

Error BASE/1003 Variable does not exist: HB_GTI_CLIPBOARDDATA
Called from SELESAIDA(338)

Probably, you have made a global find and replace for "HB_" -> "Hb_" ;)
sadly manifest constants are case sensitive :(
You are right, I´ve corrected this problem.
In other hand, IMHO we don't need tricky low level functions for hex <-> dec conversions;
NTOC( nX, 16 ) is usable to convert for any numeric to hex and CTON( cX, 16 ) any hex string to numeric.
Yes also right, I will need to optimize some functions.
This is my 2000 nth post :o
Congratulations !

<Attached file removed, see last message with now release>
Last edited by Pablo César on Mon Sep 03, 2012 6:36 pm, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply