Length fieldname longer than 10

399 views
Skip to first unread message

Thiarnron

unread,
May 22, 2019, 10:59:19 AM5/22/19
to Harbour Users
In Clipper there is a 10 character limit for each fieldname in a database,

In Harbour, this should be limimtless and is standard liùmited to 63 characters. This can be changed, according to some info I found on the web, bij changing this line :

#define HB_SYMBOL_NAME_LEN   63

that can be found in a file named hbvmpub.h

But even with the default value of 63, if I create a dbf file like this :

mteamname="test.dbf"
TeamDbf := {} 
  AADD(TeamDbf, { "TeamFullName", "C", 20, 0 }) 
  DBCREATE(alltrim(lower(MTEAMNAME)), TeamDbf)

The fieldname in test.dbf is "TeamFullNa" ... So the max length of a fieldname is still 10 ....

I even included the line in test.dbf like this :

#define HB_SYMBOL_NAME_LEN   63
mteamname="test.dbf"
TeamDbf := {} 
  AADD(TeamDbf, { "TeamFullName", "C", 20, 0 }) 
  DBCREATE(alltrim(lower(MTEAMNAME)), TeamDbf)

This compiles without problem, but still the fieldname is chopped to 10 characters in test.dbf

What am I doing wrong ? Because it's frustrating to limit each fieldname to 10 chars while Harbour supposed to allow longer fieldnames (for readability)

I use Harbour 3.0

Thanks in advance 


Ronny (programming in Clipper since 1988 ....)

Klas Engwall

unread,
May 22, 2019, 2:29:10 PM5/22/19
to harbou...@googlegroups.com
Hi Thiarnron,

> In Clipper there is a 10 character limit for each fieldname in a database,
>
> In Harbour, this should be limimtless and is standard liùmited to 63
> characters. This can be changed, according to some info I found on the
> web, bij changing this line :
>
> #define HB_SYMBOL_NAME_LEN   63
>
> that can be found in a file named hbvmpub.h
>
> But even with the default value of 63, if I create a dbf file like this :
>
> mteamname="test.dbf"
> TeamDbf := {}
>   AADD(TeamDbf, { "TeamFullName", "C", 20, 0 })
>   DBCREATE(alltrim(lower(MTEAMNAME)), TeamDbf)
>
> The fieldname in test.dbf is "TeamFullNa" ... So the max length of a
> fieldname is still 10 ....

[...]

HB_SYMBOL_NAME_LEN can change the usable length of variable names, alias
names etc (after recompiling Harbour). But it cannot change the DBF file
structure standard, where the length of the field name is always ten
characters. If you tried to do that, it would not be a DBF file anymore.
If you know how to write an RDD, then you can create your own RDD based
on DBF but with your own structure and your own field length. It would
however not be compatible with any other DBF tool.

Regards,
Klas

elch

unread,
May 22, 2019, 4:01:22 PM5/22/19
to Harbour Users
Hi Klas,

If you know how to write an RDD, then you can create your own RDD based  
on DBF ..
 
this ! part of your answer -- excuse me -- is wrong.
It would need only two absolutely minor changes to the DBF RDD,
plus to register two -- very uncommon -- DBF types,
then ! someone can derive a RDD with longer field names.
You may check for: 'dBASE v7 SQL table file' with 32 char long field names.

I did some experiments in that area,
and like to prepare a post/ question at developer list ...

very best regards
Rolf

Klas Engwall

unread,
May 22, 2019, 5:32:27 PM5/22/19
to harbou...@googlegroups.com
Hi Rolf,

>> If you know how to write an RDD, then you can create your own RDD based
>> on DBF ..
>
> this ! part of your answer -- excuse me -- is wrong.
> It would need only two absolutely minor changes to the DBF RDD,
> plus to register two -- very uncommon -- DBF types,
> then ! someone can derive a RDD with longer field names.
> You may check for: 'dBASE v7 SQL table file' with 32 char long field names.

Well, isn't that exactly what I said (minus the extra detail)? If you
know what you are doing you can create your own RDD. Inherit from the
existing DBF RDD and make your own variant.

:-)

Regards,
Klas

elch

unread,
May 22, 2019, 11:45:51 PM5/22/19
to Harbour Users
Hi Klas,


Well, isn't that exactly what I said (minus the extra detail)? If you  
know what you are doing you can create your own RDD. Inherit from the
existing DBF RDD and make your own variant.
 
The detail is important [ -- and sometimes i don't know what i do :-) ]

Actually we can not ! inherit from *DBF* RDD -- only from an universal workarea.
That is a big detail, as then we miss all the field types etc ...
Because that we can not inherit i.e. from DBFNTX by over-laying one single method.

I have to show the details ...

very best regards
Rolf
Reply all
Reply to author
Forward
0 new messages