Letodb UDF

434 views
Skip to first unread message

Raymond

unread,
Jul 6, 2016, 3:41:54 AM7/6/16
to Harbour Users
Hi,

I need help using Letodb UDF.

leto_udf( "letoUseArea", "INVOICE", "TableMaster", .T., .F., "" ) always returns 0.
leto_udf( "leto_Use", "INVOICE", "TableMaster",  .T., .F., "" ) will return "-003:21-1001-2-5o[full_path_to_invoice.dbf]"

Is my syntax correct?

I tried letoudf.prg by compiling it into letoudf.hrb & placing it together with letodb.exe & letodb would not start.
Compile command: hbmk2 letoudf.prg -gh

Thanks,
Raymond

Raymond

unread,
Jul 7, 2016, 4:24:50 AM7/7/16
to Harbour Users
Anyone with experience using letodb server side functions?
Would be grateful if you can provide sample code so I know how to proceed.

Thanks.

Raymond

unread,
Jul 8, 2016, 2:00:20 AM7/8/16
to Harbour Users
Hi,

I managed to get letoUseArea working & the AreaId is returned but I can't refer to it directly from the client. I am assuming it can be used by UDF functions?

I still have no luck with letoudf.hrb.

Anyone have the knowledge/experience please help to shade some light. Much appreciated.

Thanks.

Amos

unread,
Jul 9, 2016, 3:02:09 PM7/9/16
to Harbour Users
Hi Raymond

I do not understand what you are attempting to do. What is the code of your letoudf.prg and what are you trying to call with letoudf() ?

Regards
Amos

Nenad Batoćanin

unread,
Jul 10, 2016, 9:24:46 PM7/10/16
to Harbour Users
I suggest you to go from the simplest UDFs:

FUNCTION Udf_Test (nUserStru, x)
RETURN x+1

In client programe, write:

? Leto_UDF ("Udf_Test", 123)       // 124

If you want to make UDF function that uses the DBF is used like this:

FUNCTION Udf_Test (nUserStru)
   LOCAL cLetoAlias

   cLetoAlias := leto_Alias (nUserStru, "TEST")
   SELECT (cLetoAlias)
...

Raymond

unread,
Jul 10, 2016, 10:27:06 PM7/10/16
to Harbour Users
Hi Amos & Nenad,

Thanks for replying.

My problem right now is I can't get the letodb service (under Windows) to start when I have the letoudf.hrb file together with letodb.exe in the same folder.

I have tested the following:
1.  Using letoudf.prg from the tests folder & compiled using "Compile command: hbmk2 letoudf.prg -gh"
2.  Removed all the functions in letoudf.prg except the following & compiled using the same command as in #1.
~~~
/*  $Id: letoudf.prg,v 1.1.2.9 2012/11/12 17:20:30 ptsarenko Exp $  */

#include "dbinfo.ch"

#ifdef __LINUX__
   #define DEF_SEP      '/'
   #define DEF_CH_SEP   '\'
#else
   #define DEF_SEP      '\'
   #define DEF_CH_SEP   '/'
#endif
~~~

In both the above scenarios, my service would not start. I have tried setting "Debug = 1" in letodb.ini but not entry was added to the log file, so I don't know what's going on.
Once I removed/renamed letoudf.hrb, the letodb service starts normally.

Thanks,
Raymond

Nenad Batoćanin

unread,
Jul 11, 2016, 10:32:55 AM7/11/16
to Harbour Users
First start letoDB service without letoudf.hrb. Then copy letoudf.hrb in LetoDB dir, and stop/start LetoDB service. If LetoDB found some errors, will register them in a leto??.log. Try this letoudf.log. 

Regards, NB
letoudf.hrb

Raymond

unread,
Jul 12, 2016, 9:03:03 AM7/12/16
to Harbour Users
Hi Nenad,

There is something wrong with my letodb.ini. With it I can start letodb but can't get anything in the log. Without it I can start letodb as well but the log get updated.
Trying to start letodb with letoudf.hrb, I get the following error:
~~~
07/12/16 21:00:10: Leto DB Server has been started.
Leto DB Server v.2.09 ! INIT: DataPath=, ShareTables=0, MaxUsers=500, MaxTables=5000, CacheRecords=10
07/12/16 21:00:10: Error BASE/6101  Unknown or unregistered symbol: LETO_SETENV
ERROR! SETHRBERROR - pUStru not found!!!!!!!!!!!!!!!!!!!!
~~~

Any idea what I'm missing?

Thanks,
Raymond

Nenad Batoćanin

unread,
Jul 12, 2016, 10:05:50 AM7/12/16
to Harbour Users
I am not sure. But, your version is very old - please download new version: 

Raymond

unread,
Jul 14, 2016, 5:27:25 AM7/14/16
to Harbour Users
Hi Nenad,

The version from your link works. Great.

What is the syntax you used to compile letoudf.prg?
I need to create custom functions to add into letoudf.prg.

Thanks.

Nenad Batoćanin

unread,
Jul 14, 2016, 9:24:34 AM7/14/16
to Harbour Users
hbmk2 -gh letoudf.prg

but keep in mind that UDFs have limitations working with dbf tables.

Regards, NB
Reply all
Reply to author
Forward
0 new messages