• SQL long field names

    From Henry Fidler@21:1/5 to All on Sun Jul 4 02:39:42 2021
    I try to connect, via SQL objects, to an external internet host MySQL, and build from it local dbf files.
    The external MySQL has file names longer then 10, so DbCreate() truncate them. Any idea how to solve the problem?

    Henry

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Riedmann@21:1/5 to All on Sun Jul 4 15:30:01 2021
    Hi Henry,

    I try to connect, via SQL objects, to an external internet host
    MySQL, and build from it local dbf files. The external MySQL has
    file names longer then 10, so DbCreate() truncate them. Any idea how
    to solve the problem?

    if you are using your own dbServer subclass you could maintain an
    internal array of mapped fieldnames.

    I would use the first 8 characters of every fieldname and than add a 2 characters numeric suffix, and store that in some external
    configuration file.
    Then, when opening the DBF, read the aliases from your configuration
    file and map that in a subclassed
    FieldGet()/FieldPut()/IVarGet()/IVarPut() method.

    But there is also something like this already built in: please look at
    the DBFieldInfo() function or the DBServer:FieldInfo() method, using
    the constant DBS_ALIAS should do what you need (I have not tested that,
    so you have to try it yourself).

    Wolfgang


    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Henry Fidler@21:1/5 to All on Mon Jul 12 03:52:31 2021
    Wolfgang many thanks.

    An internal array could be a logical idea, until someone changes the original names of the SQL in the host.
    Dbs_Alias gave me little help. After assigning FieldInfo(Dbs_Alias, ...), the next time the file is opened, the alias has back the field name.

    I hoped the SQL method will have a built in possibility to solve the problem.

    Interesting: dbCreate() truncate the original field´s names, and build a db with few fields which have the same name.

    Henry

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wolfgang Riedmann@21:1/5 to All on Mon Jul 12 16:23:35 2021
    Hi Henry,

    An internal array could be a logical idea, until someone changes the
    original names of the SQL in the host. Dbs_Alias gave me little
    help. After assigning FieldInfo(Dbs_Alias, ...), the next time the
    file is opened, the alias has back the field name.

    of course, this is not a permanent option, so you have to store the
    aliases somewhere in a persistent manner

    Interesting: dbCreate() truncate the original field´s names, and
    build a db with few fields which have the same name.

    the DBF data structure limits the field names to 10 bytes, so changing
    that in the format would break backwards compatibility.
    AFAIK FoxPro has done something like this, but they have have an
    external file with the supplemental informations.

    Wolfgang

    --

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)