Página 2 de 16

LetoDb e Harbour, como usar.

Enviado: 05 Jun 2014 17:19
por Itamar M. Lins Jr.
Vc fez uma salada ai.
Bem pelo que vc mostrou você conseguiu rodar o letodb e compilar.
Depois você mostra uma tela de erros que não conseguiu.

Você está usando Harbour ou xHb ?
no mesmo momento, o executável também retorna o erro abaixo, na função:
dbUseArea( .T., "LETO", "//localhost:2812/ARQ20670.DBF", "ARQ20270", .F.)
Testou assim?
dbUseArea( .T., "LETO", "ARQ20670.DBF")
ou assim ?
use ARQ20670 via "LETO"

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 05 Jun 2014 21:59
por janio
Itamar,

Ha um tempo vc reportou um bug na função leto_fRename.

Esse bug ainda persiste??

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 00:32
por janio
Ah, so para esclarecer... o make_xhb.bat deve ser mesmo para xharbour COMERCIAL! Mesmo ajustando aqui o path da uma porrada de erros! Ele reclama da falta de alguns exe's (xcc.exe, xhb.exe, xlink.exe, etc)... que so podem ser do xh comercial.

Conclusão: Para xharbour (free) apenas as lib's são geradas... o executavel não!

Quem tiver contato com o russo, favor reportar esse negocio pra a gente saber como fazer!

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 10:12
por Itamar M. Lins Jr.
O xHarbour comercial ou não, tem uma serie de bugs no modo MT, motivo pelo qual foi abandonado pelo Pavel Tsareko, essa versão que postei é a dele, a antiga foi abandonada por esses motivos, tinha muitos problemas. Como a LIB pode ser usada inclusive em PHP, tém até exemplos, o melhor é usar somente a LIB e pegar o executável que postei.
O Alexander e Pavel usam o Harbour ele adicionou esse make em 2008, como ninguém na Russia e no Brasil reclamou, esse arquivo foi esquecido.
Esse arquivo make_xhb.bat deve ter sido enviado p/ ele por algum Brasileiro.

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 11:05
por janio
Ok Itamar!

Ja estou usando o executavel postado por vc e tem funcionado muito bem! Estou fazendo umas mudanças no meu sistema de modo que eu possa usar ou não o leto apenas lendo uma chave num arquivo ini. Ta ficando muito bom!

O ruim de o xharbour não gerar o executavel é que vamos ficar sempre na dependencia de alguem compilar pra gente. Mas num tem problema... vamos no virando.

Qnto a função leto_fRename()... ja ta tudo ok???

Janio

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 11:29
por Minduim
agradeço a colaboração;

caro Itamar, bom dia a todos nos;
perdoe a demora em retornar;

1 - iniciei os meus testes utilizando a versão compilada indicada por você:
"https://pctoledo.org/forum/fileba ... t=c&page=1"
em tempo: esta faltando rddleto.ch;

utilizo harbour 3.2 + mingw

fiz os testes com as observações apontadas por você:
1 - não esta mais aparecendo mensagem de erro no arquivo letodb.log;
2 - mas continua aparecendo mensagem de erro no executável = "tipo incorreto de dado";

2 - infelizmente ontem não houve salada (sou vegetariano);
depois de muitos testes infrutíferos e de muitos cabelos a menos, resolvi dar um tempo e
baixei o letodb indicado pelo Toledo:
"http://letodb.cvs.sourceforge.net/viewv ... v=rel-1-mt"
ao compilá-lo notei os erros, na realidade apenas um;
nas rotinas LetoDbCreateTable e LetoDbOpenTable contidas no arquivo letocl em letodb/souce/cliente
a linha de comando:
pTable->uiDriver = LETO_NTX; (linhas 114 e 242)
pelo que notei, não existe nenhuma referencia a LETO_NTX, mas também não sei como corrigir pois não entendo desta linguagem;

mais alguma luz?

Código: Selecionar todos

HB_EXPORT LETOTABLE * LetoDbCreateTable( LETOCONNECTION * pConnection, char * szFile, char * szAlias, char * szFields, unsigned int uiArea )
{

   LETOTABLE * pTable;

   char * szData, * ptr = szFields, szTemp[14];

   unsigned int ui, uiFields = 0;


   while( *ptr )

   {

      for( ui=0; ui<4; ui++ )

      {

         while( *ptr && *ptr++ != ';' );

         if( !(*ptr) && ( *(ptr-1) != ';' || ui < 3 ) )

         {

            s_iError = 1;

            return NULL;

         }

      }

      uiFields ++;

   }


   szData = (char *) malloc( (unsigned int) uiFields * 24 + 10 + _POSIX_PATH_MAX );


   if( LetoCheckServerVer( pConnection, 100 ) )

      sprintf( szData,"creat;%s;%s;%d;%s\r\n", szFile, szAlias, uiFields, szFields );

   else

      sprintf( szData,"creat;01;%d;%s;%s;%d;%s\r\n", uiArea, szFile, szAlias, uiFields, szFields );


   if( !leto_DataSendRecv( pConnection, szData, 0 ) )

   {

      s_iError = 1000;

      free( szData );

      return NULL;
   }

   free( szData );


   ptr = leto_getRcvBuff();
   if( *ptr == '-' )

   {

      if( ptr[4] == ':' )

         sscanf( ptr+5, "%u-%u-", &ui, &s_iError );

      else

         s_iError = 1021;

      return NULL;

   }


   pTable = (LETOTABLE*) malloc( sizeof(LETOTABLE) );

   memset( pTable, 0, sizeof( LETOTABLE ) );

   pTable->uiConnection = pConnection - letoConnPool;

   pTable->iBufRefreshTime = -1;

   pTable->uiSkipBuf = 0;

   pTable->fShared = pTable->fReadonly = 0;


   pTable->pLocksPos  = NULL;

   pTable->ulLocksMax = pTable->ulLocksAlloc = 0;


   leto_AddFields( pTable, uiFields, szFields );


   pTable->pRecord = ( unsigned char * ) malloc( pTable->uiRecordLen+1 );


   ptr = leto_firstchar();
   LetoGetCmdItem( &ptr, szTemp );
 ptr ++;

   sscanf( szTemp, "%lu" , &(pTable->hTable) );

   if( *ptr == '1' )

     pTable->uiDriver = LETO_NTX;

   ptr ++;
 ptr++;


   leto_ParseRecord( pTable, ptr, 1 );



   /*
   if( LetoCheckServerVer( pConnection, 100 ) )

   {

      ptr += HB_GET_LE_UINT24( ptr ) + 3;
      leto_ReadMemoInfo( pTable, ptr );

   }

   */


   return pTable;

}



HB_EXPORT LETOTABLE * LetoDbOpenTable( LETOCONNECTION * pConnection, char * szFile, char * szAlias, int iShared, int iReadOnly, char * szCdp, unsigned int uiArea )

{


   char szData[_POSIX_PATH_MAX + 16], * ptr, szTemp[14];
   LETOTABLE * pTable;

   unsigned int uiFields;


   if( szFile[0] != '+' && szFile[0] != '-' )

   {
      if( LetoCheckServerVer( pConnection, 100 ) )

         sprintf( szData,"open;%s;%s;%c%c;%s;\r\n", szFile,

             szAlias, (iShared)? 'T':'F', (iReadOnly)? 'T':'F', szCdp );

      else

         sprintf( szData,"open;01;%d;%s;%s;%c%c;%s;\r\n", uiArea, szFile,

             szAlias, (iShared)? 'T':'F', (iReadOnly)? 'T':'F', szCdp );


      if( !leto_DataSendRecv( pConnection, szData, 0 ) )

      {
         s_iError = 1000;

         return NULL;

      }
      ptr = leto_getRcvBuff();

      if( *ptr == '-' )

      {

         if( *(ptr+3) == '4' )

            s_iError = 103;

         else

            s_iError = 1021     return NULL;

      }


      pTable = (LETOTABLE*) malloc( sizeof(LETOTABLE) );

      memset( pTable, 0, sizeof( LETOTABLE ) );

      pTable->uiConnection = pConnection - letoConnPool;


      ptr = leto_firstchar();

   }

   else

   {

      if( ( ptr = strchr( szFile + 1, ';' ) ) == NULL )

         return NULL;

      pTable = (LETOTABLE*) malloc( sizeof(LETOTABLE) );

      ptr ++;

   }


   pTable->fShared = iShared;

   pTable->fReadonly = iReadOnly;

   pTable->iBufRefreshTime = -1;

   pTable->uiSkipBuf = 0;


   pTable->pLocksPos  = NULL;

   pTable->ulLocksMax = pTable->ulLocksAlloc = 0;


   LetoGetCmdItem( &ptr, szTemp );
 ptr ++;

   sscanf( szTemp, "%lu" , &(pTable->hTable) );

   if( *ptr == '1' )

     pTable->uiDriver = LETO_NTX;

   ptr ++;
 ptr++;


   if( LetoCheckServerVer( pConnection, 100 ) )

   {

      // Read MEMOEXT, MEMOTYPE, MEMOVERSION

      ptr = leto_ReadMemoInfo( pTable, ptr );

      // for DBI_LASTUPDATE

      if( LetoCheckServerVer( pConnection, 208 ) )

      {

         LetoGetCmdItem( &ptr, szTemp );
 ptr ++;

         pTable->lLastUpdate = leto_dateEncStr( szTemp );

      }

   }

   // Read number of fields

   LetoGetCmdItem( &ptr, szTemp );
 ptr ++;

   sscanf( szTemp, "%d" , &uiFields );

   ptr = leto_AddFields( pTable, uiFields, ptr );


   pTable->pRecord = ( unsigned char * ) malloc( pTable->uiRecordLen+1 );


   if( s_uiAutOpen )

      ptr = leto_ParseTagInfo( pTable, ptr );

   else

      ptr = leto_SkipTagInfo( pConnection, ptr );


   leto_ParseRecord( pTable, ptr, 1 );


   return pTable;

}

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 11:58
por janio
"tipo incorreto de dado" quer dizer que vc não está setando o rdd correto!

Colocou no inicio do seu sistema

REQUEST LETO
RDDSETDEFAULT("LETO")

?????

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 12:31
por Itamar M. Lins Jr.
Ola!
Minduim coloca um pequeno PRG com o teste que vc está fazendo. Inclusive como está seu LETODB.INI

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 12:41
por Itamar M. Lins Jr.
Ola!
Esqueci de colocar o arquivo rddleto.ch
Segue anexo com correção.

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 13:42
por Minduim
agradeço a colaboração de todos

Janio - suas observações constam do meu .prg

Itamar - fiz rapidinho um .prg de teste

arquivo teste.prg

Código: Selecionar todos

********************************
PROCEDURE MAIN(npa)

   local cPath, nConnect, nRes

   REQUEST DBFNTX
   REQUEST DBFCDX
   REQUEST LETO

   RDDSETDEFAULT( "DBFCDX" )

   #include "rddleto.ch"

   #include "inkey.ch"
   #include "hbgtinfo.ch"

   REQUEST HB_LANG_PT
   REQUEST HB_CODEPAGE_PT850
   REQUEST HB_CODEPAGE_PTISO
   HB_LANGSELECT("PT")
   HB_CDPSELECT("PT850")

   REQUEST HB_GT_WVG_DEFAULT

   hb_gtinfo( HB_GTI_SELECTCOPY,.T.)
   hb_gtinfo( HB_GTI_RESIZABLE, .F.)
   hb_gtinfo( HB_GTI_CLOSABLE, .T.)
   hb_gtinfo( HB_GTI_CODEPAGE, 255) 
   hb_gtinfo( HB_GTI_MOUSESTATUS, 0)
   hb_gtinfo( HB_GTI_FONTNAME, "Courier New")      
   hb_gtinfo( HB_GTI_FONTQUALITY, HB_GTI_FONTQ_DRAFT) // _DRAFT _NORMAL _HIGH

   SetMode(32, 120)
   do case 
      case hb_gtinfo( HB_GTI_DESKTOPWIDTH) > 1023
           hb_gtinfo( HB_GTI_SCREENWIDTH, 960)
           hb_gtinfo( HB_GTI_SCREENHEIGHT, 512)
           hb_gtinfo( HB_GTI_FONTWIDTH, 10)
           hb_gtinfo( HB_GTI_FONTSIZE,  22)
      case hb_gtinfo( HB_GTI_DESKTOPWIDTH) > 799
           hb_gtinfo( HB_GTI_SCREENWIDTH, 640)
           hb_gtinfo( HB_GTI_SCREENHEIGHT, 400)
           hb_gtinfo( HB_GTI_FONTWIDTH, 12)
           hb_gtinfo( HB_GTI_FONTSIZE,  27)
      otherwise
           hb_gtinfo( HB_GTI_FONTWIDTH, 8)
           hb_gtinfo( HB_GTI_FONTSIZE, 17)
   endcase

   cPath:= "//localhost:2812/"
   nConect := leto_Connect( cPath )
   if nConect == -1
      nRes := leto_Connect_Err()
      if nRes == LETO_ERR_LOGIN
         alert( "Falha ao Logar" )
      elseif nRes == LETO_ERR_RECV
         alert( "Error ao conectar" )
      elseif nRes == LETO_ERR_SEND
         alert( "Erro de envio" )
      else
         alert( "Nao conectado ao servidor: " + cPath )
      endif
   endif

   dbUseArea( .T., "LETO", "ARQ2070.DBF", "ARQ20670", .F. )

   browse()

   dbCloseArea()

   return .t.
 
EXIT PROCEDURE MAIN_SAIR
   quit

   return
arquivo letodb.ini

Código: Selecionar todos

Port = 2812              
Logfile = "letodb.log"   
DEFAULT_DRIVER = CDX     
DATAPATH = d:\arq00001\
ENABLEFILEFUNC = 1
CRYPT_TRAFFIC = 0
PASS_FOR_LOGIN = 0
PASS_FOR_MANAGE = 0
PASS_FOR_DATA = 0
Share_Tables  = 0
Cache_Records = 50
[DATABASE]
DataPath = d:\arq00001\
Driver = CDX
arquivo .hbp

Código: Selecionar todos

#
# $Id: hbmain.hbp $
#

-lrddleto

-lhbtip

-lxhb

-lhbcomm

-lhbct

-lhbwin

-lgtwvg

-oteste

-gui

-inc

-mt

-es2

-strip

-quiet

-compr

-workdir=d:\grlsis\r_apoio\teste_leto\temp

d:\grlsis\r_apoio\teste_leto\teste.prg

arquivo .bat para executar o letodb

Código: Selecionar todos

letodb install
net start letodb_service

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 14:50
por Itamar M. Lins Jr.
Diminui ai o exemplo:

Código: Selecionar todos

Function Main
LOCAL cPath

REQUEST LETO
RDDSETDEFAULT( "LETO" )
SET DATE FORMAT "dd/mm/yy"

cPath := "//127.0.0.1:2812/"
dbCreate( cPath+"test1", { {"NOME","C",10,0}, {"NUMERO","N",4,0}, {"DESCRICAO","C",40,0}, {"DATA","D",8,0} } )

? "Arquivo criado"
USE ( cPath+"test1" ) New
? "Arquivo aberto"
aStru := dbStruct()
? "Campos:", Len( aStru )
FOR i := 1 TO Len( aStru )
      ? i, aStru[i,1], aStru[i,2], aStru[i,3], aStru[i,4]
NEXT
close all
//Fim
Criar um arquivo com o nome rddleto.hbc

Código: Selecionar todos

incpaths=\lugar_do_\include
libpaths=\lugar_do\lib

libs=rddleto
Criar um arquivo com o nome hbmk.hbm //Esse é um arquivo padrão que o hbmk2 procura automaticamente, e dentro colocar.

Código: Selecionar todos

rddleto.hbc
Depois é compilar assim:

Código: Selecionar todos

hbmk2 teste.prg //só isso!!!
Ps. Teste p/ ver se o motor do letodb está rodando antes.

Código: Selecionar todos

C:\devl\LetoDB\tests>net stop letodb_service
.
O serviço de LetoDB Service foi finalizado com êxito.
C:\devl\LetoDB\tests>net start letodb_service
O serviço de LetoDB Service está sendo iniciado.
O serviço de LetoDB Service foi iniciado com êxito.
Aqui rodou sem problema!

Código: Selecionar todos

C:\devl\LetoDB\tests>notepad testx.prg

C:\devl\LetoDB\tests>hbmk2 testx
hbmk2: Processando script local make: hbmk.hbm
Harbour 3.4.0dev () (2014-05-30 23:24)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'testx.prg'...
Lines 20, Functions/Procedures 1
Generating C source output to 'C:\Users\Itamar\AppData\Local\Temp\hbmk_pafawe.di
r\testx.c'... Done.

C:\devl\LetoDB\tests>testx

Arquivo criado
Arquivo aberto
Campos:          4
         1 NOME C         10          0
         2 NUMERO N          4          0
         3 DESCRICAO C         40          0
         4 DATA D          8          0
Um detalhe neste exemplo, é que não preciso conectar com o letodb via comando:
nConect := leto_Connect( //localhost:2812/ )
Porquê ?, porque o letodb(servidor) está rodando na mesma máquina, no caso meu notebook.
Se o letodb estiver em outra máquina ai sim é necessário conectar via leto_Connect

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 06 Jun 2014 15:29
por Minduim
Itamar;
agradeço a atenção, a paciência e a boa vontade de ajudar;
não sei o que seria de nós sem a pronta ajuda de vocês;
sem literatura específica e com poucos textos em outra língua, tendo que ficar traduzindo, é muito frustante;

vou testar suas sugestões e depois retorno;
depois, agora já estou estressado;

LetoDb e Harbour, como usar.

Enviado: 08 Jun 2014 14:23
por Minduim
caro Itamar, muita boa tarde;
nada como uma boa noite de sono...

me corrija se eu estiver errado;

sua postagem de teste funcionou perfeitamente, então onde esta o erro...

entendo que não demos a devida importância a uma postagem anterior:
arquivo letodb.log

Código: Selecionar todos

06/05/14 11:01:16: Error BASE/1001  Undefined function: DESCRIPT Arguments: ( [ 1] = Type: C Val:       )
analisando o arquivo letodb.prg, entendi que que quando estamos executando o letodb algumas funções não são mais executadas pelo
nosso executável e sim pelo Letodb;

então compilei o letodb acrescentando minhas funções de usuário CRIPT e DESCRIPT e o sistema deu sinais de vida;

agora inicialmente me deparo com algumas dificuldades, onde não encontrei referencia:
- não encontrei referencia as novas funções introduzidas pelo Letodb;

- na libleto existem muitas funções mas não encontrei referências de como utilizá-las;

- as funções que entendo que são de baixo nível: FOPEN, FWRITE, FCLOSE, FERASE, etc não funcionaram, existe alguma outra opção;

- como criar, abrir e apagar um arquivo em um diretório diferente do padrão:
-- cParh:= "//localhost:2812/"
-- carqu:= "temp\teste.dbf"
-- cinde:= "temp\teste.cdx"

- executando o meu aplicativo, tenho como mudar o RDD padrão:
-- de DBFCDX para DBFNTX

- existe alguma função para capturar no meu executável o diretório padrão;

alguma luz?

LetoDb e Harbour, como usar.

Enviado: 08 Jun 2014 17:41
por Itamar M. Lins Jr.
sua postagem de teste funcionou perfeitamente, então onde esta o erro...
Beleza então! O feedback é importante. Agora fica fácil!
- não encontrei referencia as novas funções introduzidas pelo Letodb;
No arquivo readme.txt tem os comandos, porque o que está em português está defasado.
O problema é que as variáveis do lado cliente e até o alias não é visto do lado do servidor. Como resolver ?
Simples vc pode usa o &(comercial), por exemplo:

Código: Selecionar todos

Function teste
Local minha_var_date := date()
use xyz alias "xy" new via "LETO"

index on cliente //Não pode "index on xy->cliente" uso de alias... o servidor não sabe que o alias é xy 
index on cliente for data > minha_var_date //também não pode. porque o servidor não sabe. É uma variavel LOCAL. Como resolver ?
A mesma técnica que usamo em SQL veja.
cTemp  := "rec002"+dtos(hb_datetime())

cQuery := " dtos(emissao) >= '"+DToS(dIni)+"' .and. dtos(emissao) <= '"+DToS(dFim)+"' .and. cod_venda == " + "'" + cCodVenda + "'"
OrdBy  := "cliente"
Index on &OrdBy to &cTemp for &cQuery temporary 
Então se voce criptografa o BD você precisa além de adicionar as funções do lado do servidor, eliminar as VARIÁVEIS.
O letodb tem outros recursos mais interessantes, não precisa vc recompilar o LetoDb p/ adicionar suas funções, se bem que é possível isso.
Crie um arquivo de nome letoudf.prg e coloque lá dentro suas funções.
Compilar usando hbmk2 letodbudf -gh //Vair gerar um arquivo de nome letoudf.hrb
O motor letodb procura este arquivo(letoudf.hrb) automaticamente, quando inicializado.
Quanto as variáveis serem vistas do lado do servidor, o letodb tem como fazer, porém eu não as uso.

Código: Selecionar todos

      7.9 Server variable management functions

      LETO_VARSET( cGroupName, cVarName, xValue[, nFlags[, @xRetValue]] ) --> lSuccess

 This function assign value <xValue> to variable <cVarName> from group <cGroupName>
 Optional parameter <nFlags> defines function mode:
 LETO_VCREAT    - if variable doesn't exist, it's created;
 LETO_VOWN      - own user variable (free after user disconnect);
 LETO_VDENYWR   - write deny for other users;
 LETO_VDENYRD   - read deny for other users;
 LETO_VPREVIOUS - retusn previos value to <xRetValue> parameter.

      LETO_VARGET( cGroupName, cVarName )                  --> xValue

 Function return value of variable <cVarName> from group <cGroupName>

      LETO_VARINCR( cGroupName, cVarName )                 --> nValue

 Function increment value of variable <cVarName> from group <cGroupName>

      LETO_VARDECR( cGroupName, cVarName )                 --> nValue

 Function decrement value of variable <cVarName> from group <cGroupName>

      LETO_VARDEL( cGroupName, cVarName )                  --> lSuccess

 Function delete variable <cVarName> from group <cGroupName>

      LETO_VARGETLIST( [cGroupName [, nMaxLen]] )          --> aList

 Function return two-dimensional array with variables: { {<cVarName>, <value>}, ...}

      7.10 Calling udf-functions on the server

      LETO_UDF( cSeverFunc, xParam1, ... )                 --> xResult
 This function is called from client application. A string
 <cServerFunc> contains a server connection string and name
 of udf function:
 //ip_address:port/funcname
 A <funcname> function should be defined on the letodb server.
 The first parameter of udf function is nUserStru.
 Udf function can return result (any type) to client.
 Examples of udf-functions are in the tests/letoudf.prg

      LETO_UDFEXIST( cSeverFunc )                          --> lExist
 leto_udfExist check the existance of udf-function at the letodb server.
 <cSeverFunc> parameter is the same as for leto_udf().

      LETO_PARSEREC( cRecBuf )                             --> nil
 This function is necessary for calling, if udf-function returns as
 result the buffer of record which should be current after of it
 works.

      LETO_PARSERECODRS( cRecBuf )                         --> nil
 This function is necessary for calling to fill the skip-buffer as a result
 of udf-function UDF_dbEval. After calling this function, the data from the
 skip-buffer can be received by dbSkip() calls. See sample in comments for
 UDF_dbEval() in tests/letoudf.prg
Funções de baixo nível, fopen, etc.

Código: Selecionar todos

      7.6 File functions

 The <cFileName> parameter of all file functions can contain a connection string
 to the letodb server in a format:
 //ip_address:port/data_path/file_name.
 If the connection string is omitted, the current active connection is used:
 /data_path/file_name.
 All files is searching at the DataPath catalog on the server. The ".."
 symbols are disabled.

      LETO_FILE( cFileName )                               --> lFileExists
 Determine if file exist at the server, analog of File() function

      LETO_FERASE( cFileName )                             --> -1 if failed
 Delete a file at the server.

      LETO_FRENAME( cFileName, cFileNewName )              --> -1 if failed
 Rename a file: <cFileName> --> <cFileNewName>. <cFileNewName> should be without
 connection string.

      LETO_MEMOREAD( cFileName )                           --> cStr
 Returns the contents of file at the server as character string, analog of
 MemoRead() function.

      Leto_MemoWrite( cFileName, cBuf )                    --> lSuccess
 Writes a character string into a file at the server, analog of
 MemoWrit() function.

      LETO_MAKEDIR( cDirName )                             --> -1 if failed
 Creates a directory at the server

      LETO_FERROR()                                        --> nError
 Returns an error code of last file function.

      Leto_FileRead( cFileName, nStart, nLen, @cBuf )      --> -1 if failed
 Read a content of file at the server from <nStart> offset and <nLen> length

      Leto_FileWrite( cFileName, nStart, cBuf )            --> lSuccess
 Write <cBuf> character string to a file at the server from <nStart> offset and <nLen> length

      Leto_FileSize( cFileName )                           --> -1 if failed
 Returns a length of filt at the server

      Leto_Directory( cDir[, cAttr] )                      --> aDirectory
 Returns a content of directory at the server in the same format as Directory() function
- existe alguma função para capturar no meu executável o diretório padrão;
Do aplicativo:

Código: Selecionar todos

cPasta    := LEFT(hb_argv(0), RAT(HB_OSPathSeparator(), hb_argv(0)))
Mudar o PATH do LETODB

Código: Selecionar todos

      LETO_PATH( [<cPath>], [cConnString | nConnection] )  --> cOldPath
Leia o arquivo readme.txt

Código: Selecionar todos

      /* $Id: Readme.txt,v 1.33.2.37 2014/03/14 15:25:30 ptsarenko Exp $ */

      Leto DB Server is a multiplatform database server or a database 
 management system, chiefly intended for client programs, written on Harbour,
 be able to work with dbf/cdx files, located on a remote server.

Contents
--------

1. Directory structure
2. Building binaries
   2.1 Borland Win32 C compiler
   2.2 Linux GNU C compiler
   2.3 xHarbour Builder
   2.4 Mingw C compiler
   2.5 Building letodb with hbmk
   2.6 Addition functions support
3. Running and stopping server
4. Server configuration
   4.1 letodb.ini
   4.2 Authentication
5. Features of work with the letodb server
   5.1 Connecting to the server from client programs
   5.2 Filters
6. Variables management
7. Functions list
   7.1 Connection management functions
   7.2 Transaction functions
   7.3 Additional functions for current workarea
   7.4 Additional rdd functions
   7.5 Setting client paramenter
   7.6 File functions
   7.7 Management functions
   7.8 User account management functions
   7.9 Server variable management functions
   7.10 Calling udf-functions on the server
   7.11 Functions for bitmap filters
8. Management utility
9. Server-side functions


      1. Directory structure

      bin/          -    server executable file
      doc/          -    documentation
      include/      -    source header files
      lib/          -    rdd library
      source/
          client/   -    rdd sources
          common/   -    some common source files
          client/   -    server sources
      tests/        -    test programs, samples
      utils/
          manage/   -    server management utilities


      2. Building binaries

      The letodb server can be compiled only by the Harbour compiler, and client
 library - both Harbour, and xHarbour. For OS Windows the letodb server can be
 compiled as Windows service (the macro by __WIN_SERVICE__ should be initialized),
 or as the daemon (process) for what it's necessary to set a macro __WIN_DAEMON__.
 For Linux it is necessary to set a macro __LINUX_DAEMON__.
 The server and the client library can be built with the support of the driver BMDBFCDX/BMDBFNTX.
 In this case, the basic rdd letodb server will be used instead DBFCDX/DBFNTX
 driver BMDBFCDX/BMDBFNTX, and supported the same functionality that BMDBF*.
 To build on this mode, in build scripts (letodb.hbp, rddleto.hbp for hbmk2
 and makefile.* for other compilers) it's need to set a macro __BM.

      2.1 Borland Win32 C compiler

      An environment variable HB_PATH, which defines a path to the Harbour
 directory, must be set before compiling. This can be done, for example, 
 by adding a line in a make_b32.bat:

          SET HB_PATH=c:\harbour

 If you use xHarbour, uncomment a line 'XHARBOUR = yes' in makefile.bc.
 Then run the make_b32.bat and you will get server executable file letodb.exe in a bin/
 directory and rdd library rddleto.lib in a lib/ directory.

      2.2 Linux GNU C compiler

      An environment variable HB_ROOT, which defines a path to the Harbour
 directory, must be set before compiling. Or just change the value of HRB_DIR
 in the Makefile.linux.

 Then run the make_linux.sh and you will get server executable file letodb in a bin/
 directory and rdd library librddleto.a in a lib/ directory.

      2.3 xHarbour Builder

      Run the make_xhb.bat to build binaries with this compiler. Probably,
  you will need to change the path to your xHarbour Builder copy in the
  make_xhb.bat. Default value is:

          set XHB_PATH=c:\xhb

      2.4 Mingw C compiler

      An environment variable HB_PATH, which defines a path to the Harbour
 directory, must be set before compiling. This can be done, for example, 
 by adding a line in a make_mingw.bat:

          SET HB_PATH=c:\harbour

 If you use xHarbour, uncomment a line 'XHARBOUR = yes' in makefile.gcc.
 Then run the make_mingw.bat and you will get server executable file letodb.exe in a bin/
 directory and rdd library librddleto.a in a lib/ directory.

      2.5 Building letodb with hbmk

      Now there is a possibility to build letodb with a Harbour make utility, provided by
 Viktor Szakats. The command line syntax is:

      hbmk2 [-hb10|-xhb] rddleto.hbp letodb.hbp [-target=tests/test_ta.prg]

 Optional parameters: -hb10 - Harbour version is 1.0 or 1.0.1,
                      -xhb - xHarbour,
                      -target="blank"\test_ta.prg - build the test, too.

      2.6 Addition functions support

      LetoDB use Harbour expression engine for evaluating index expressions and filters,
 and allows a call of the following functions:

      ABS, ALLTRIM, AT, CHR, CTOD, DATE, DAY, DELETED, DESCEND, DTOC, DTOS,
      EMPTY, I2BIN, L2BIN, LEFT, LEN, LOWER, LTRIM, MAX, MIN, MONTH, PAD, PADC,
      PADL, PADR, RAT, RECNO, RIGHT, ROUND, RTRIM, SPACE, STOD, STR, STRZERO,
      SUBSTR, REPLICATE, TIME, TRANSFORM, TRIM, UPPER, VAL, YEAR,
      hb_ATokens, hb_WildMatch

      If it's necessary to add this set of functions, in the source/server.prg module
it's necessary to add a line:

      REQUEST <cFName1>[, ...]

      And then rebuild server.

      3. Running and stopping server

      Just run it:
      
      letodb.exe                    ( under Windows )
      ./letodb                      ( under Linux )

      To shutdown the server, run the same executable with a 'stop' parameter:

      letodb.exe stop               ( under Windows )
      ./letodb stop                 ( under Linux )

      To reload letoudf.hrb module, run the same executable with a 'reload' parameter:

      letodb.exe reload             ( under Windows )
      ./letodb reload               ( under Linux )

      For windows service (server should be compiled with __WIN_SERVICE__ flag):

      To install and uninstall service, you must have administrative privileges.
      To install service, run letodb with 'install' parameter:

      letodb.exe install

      To uninstall service, run letodb with 'uninstall' parameter:

      letodb.exe uninstall

      To start and stop server, run service manager.

      4. Server configuration

      4.1 letodb.ini

      You may provide configuration file letodb.ini if you isn't satisfied with
 default parameters values. Currently following parameters exists ( default
 values are designated ), they should be written in section [MAIN]:

      [MAIN]
      Port = 2812              -    server port number;
      TimeOut = -1             -    connection timeout;
      DataPath =               -    path to a data directory on a server;
      LogPath = letodb.log     -    path and name of a log file;
      Default_Driver = CDX     -    default RDD to open files on server ( CDX/NTX );
      Memo_Type =              -    memo type ( FPT/DBT ). Default: FPT for DBFCDX, DBT for DBFNTX;
      Lower_Path = 0           -    if 1, convert all paths to lower case;
      EnableFileFunc = 0       -    if 1, using of file functions ( leto_file(),
                                    leto_ferase(), leto_frename() is enabled;
      EnableAnyExt = 0         -    if 1, creating of data tables and indexes with
                                    any extention, other than standard ( dbf,cdx,ntx )
                                    is enabled; 
      Pass_for_Login = 0       -    if 1, user authentication is necessary to
                                    login to the server;
      Pass_for_Manage = 0      -    if 1, user authentication is necessary to
                                    use management functions ( Leto_mggetinfo(), etc. );
      Pass_for_Data = 0        -    if 1, user authentication is necessary to
                                    have write access to the data;
      Pass_File = "leto_users" -    the path and name of users info file;
      Crypt_Traffic = 0        -    if 1, the data passes to the network encrypted;
      Share_Tables = 0         -    if 0 (default, this mode server was the only from the
                                    start of a letodb project), the letodb opens all
                                    tables in an exclusive mode, what allows to increase
                                    the speed. If 1 (new mode, added since June 11, 2009),
                                    tables are opened in the same mode as client
                                    applications opens them, exclusive or shared, what
                                    allows the letodb to work in coexistence with other
                                    types of applications.
      No_Save_WA = 0           -    When this mode is set, each dbUseArea() will cause
                                    a real file open operation and creating a new 
                                    workarea on the server ( in default mode each file
                                    is opened only one time and have only one real
                                    workarea for all users ).
                                    Theoretically this new mode may increase the speed
                                    in case of a big number of active users. It isn't
                                    properly tested yet, so for production use default
                                    mode is recommended.
      Cache_Records            -    The number of records to read into the cache
      Max_Vars_Number = 10000  -    Maximum number of shared variables
      Max_Var_Size = 10000     -    Maximim size of a text variable
      Trigger = <cFuncName>    -    Global function letodb RDDI_TRIGGER
      PendingTrigger = <cFuncName>- Global function letodb RDDI_PENDINGTRIGGER
      Tables_Max  = 5000       -    Number of tables
      Users_Max = 500          -    Number of users
      Debug = 0                -    Debug level
      Optimize = 0             -    if 1, SET HARDCOMMIT OFF
      AutOrder = 0             -    SET AUTORDER setting
      ForceOpt = 0             -    _SET_FORCEOPT setting

      It is possible to define [DATABASE] structure if you need to have a
 directory, where files are opened via other RDD:

      [DATABASE]
      DataPath =               -    (mandatory option)
      Driver = CDX             -    ( CDX/NTX )

      You can define as many [DATABASE] sections, as needed.

      In Windows environment the letodb.ini must be placed in a directory, from
 where server is started.
      In Linux the program looks for it in the directory from where the server
 is started and, if unsuccessfully, in the /etc directory.

      4.2 Authentication

      To turn authentication subsystem on you need to set one of the following 
 letodb.ini parameters to 1: Pass_for_Login, Pass_for_Manage, Pass_for_Data. But before
 you need to create, at least, one user with admin rights, because when authentication
 subsystem works, only authenticated users with admin rights are able to add/change users
 and passwords.
      To add a user, you need to include a call of LETO_USERADD() in your client side
 program, for example:

      LETO_USERADD( "admin", "secret:)", "YYY" )

 where "YYY" is a string, which gives rights to admin, manage and write access. You may
 also use the utils/manager/console.prg program to set or change authentication data.

 To connect to a server with an authentication data ( username and password ) you need to
 use LETO_CONNECT() function.

      5. Features of work with the letodb server

      5.1 Connecting to the server from client programs

      To be able to connect to the server you need to link the rddleto library
 to your aplication and add at start of a main source file two lines:

      REQUEST LETO
      RDDSETDEFAULT( "LETO" )

      To open a dbf file on a server, you need to write in a SET PATH TO
 statement or in the USE command directly a path to the server in a standard
 form //ip_address:port/data_path/file_name.

      If a 'DataPath' parameter of a server configuration file is set to a non
 empty value, you need to designate not the full path to a file on the server,
 but only a relative ( relatively the 'DataPath' ).
      For example, if the you need to open a file test.dbf, which is located on
 a server 192.168.5.22 in a directory /data/mydir and the 'DataPath' parameter
 value ( of a letodb.ini server configuration file ) is '/data', the syntax
 will be the following:

      USE "//192.168.5.22:2812/mydir/test"

      If the server doesn't run or you write a wrong path, you'll get open error.
 It is possible to check accessibility of a server before opening files by using
 the leto_Connect( cAddress ) function, which returns -1 in case of unsuccessful
 attempt:

      IF leto_Connect( "//192.168.5.22:2812/mydir/" ) == -1
         Alert( "Can't connect to server ..." )
      ENDIF

     At connection with the server the client send to it information about codepage,
which the server then uses for operations of indexation, a filtration and for some
other operations. The client codepage should be established before connection with
the letodb server.

      5.2 Filters

      The filter is established usually: by the SET FILTER TO command or by a call
dbSetFilter() function. The filter which can be executed on the server, is called optimized.
If the filter can't be executed on the server, it is not optimized. Such filter
is slow as from the server all records, which are all the same requested then
are filtered on the client. To set the optimized filter, it is necessary, that in logical
expression for the filter there were no variables or the functions defined on the client.
To check, whether the filter is optimized, it is necessary to caall the LETO_ISFLTOPTIM()
function.

      6. Variables management

      Letodb allows to manage variables, which are shared between applications, connected
 to the server. Variables are separated into groups and may be of logical, integer or 
 character type. You can set a variable, get it, delete or increment/decrement
 ( numerical, of course ). All operations on variables are performed consecutively by
 one thread, so the variables may work as semaphores. See the functions list for a syntax
 of appropriate functions and tests/test_var.prg for a sample.
      Letodb.ini may contain lines to determine the maximum number of variables and a
 maximum size of a text variable.

      7. Functions list

      7.1 Connection management functions

      Below is a full ( at least, for the moment I write it ) list of functions,
 available for using in client applications with RDD LETO linked.

      LETO_CONNECT( cAddress, [ cUserName ], [ cPassword ], [ nTimeOut ], [ nBufRefreshTime ] )
                                                           --> nConnection, -1 if failed
 nBufRefreshTime defines the time interval in 0.01 sec. After this 
 time is up, the records buffer must be refreshed, 100 by default (1 sec)

      LETO_CONNECT_ERR()                                   --> nError
      LETO_DISCONNECT( [ cConnString | nConnection ] )     --> nil
      LETO_SETCURRENTCONNECTION( nConnection )             --> nil
      LETO_GETCURRENTCONNECTION()                          --> nConnection
      LETO_GETSERVERVERSION()                              --> cVersion
      LETO_GETLOCALIP()                                    --> IP address of client station
      LETO_ADDCDPTRANSLATE(cClientCdp, cServerCdp )        --> nil
      LETO_PATH( [<cPath>], [cConnString | nConnection] )  --> cOldPath

      7.2 Transaction functions

      LETO_BEGINTRANSACTION( [ nBlockLen ] )
 Parameter <nBlockLen> can be used for set memory allocation block size.
 For big transaction it can improve transaction speed at the client side.

      LETO_ROLLBACK()

      LETO_COMMITTRANSACTION( [ lUnlockAll ] )             --> lSuccess

      LETO_INTRANSACTION()                                 --> lTransactionActive

      7.3 Additional functions for current workarea

      LETO_COMMIT()
 This function can be used for current workarea instead of calls:

 dbCommit()
 dbUnlock()

 The client sends to the server 3 packages: for record updating
 on the server, for commit record and area unlock. Leto_Commit sends
 only one package for all these operations

      LETO_SUM( <cFieldNames>|<cExpr>, [ cFilter ], [xScope], [xScopeBottom] )
                                                           --> nSumma if one field or expression passed, or
                                                               {nSumma1, nSumma2, ...} for several fields
 The first parameter of leto_sum if comma separated fields or expressions:
 leto_sum("Sum1,Sum2", cFilter, cScopeTop, cScopeBottom) return
 an array with values of sum fields Sum1 and Sum2.

 If "#" symbol passed as field name, leto_sum returns a count of
 evaluated records, f.e:
 leto_sum("Sum1,Sum2,Sum1+Sum2,#", cFilter, cScopeTop, cScopeBottom) -->
 {nSum1, nSum2, nSum3, nCount}

  If only one field name or expression is passed, leto_sum() returns a numeric value

      LETO_GROUPBY(cGroup, <cFields>|<cExpr>, [cFilter], [xScopeTop], [xScopeBottom]) --> aValues
                                                               {{xGroup1, nSumma1, nSumma2, ...}, ...}

 This function return two-dimensional array. The first element of each row is
 a value of <cGroup> field, elements from 2 - sum of comma separated fields or
 expressions, represented in <cFields>. If "#" symbol passed as field name in cFields,
 leto_groupby return a count of evaluated records in each group

      LETO_ISFLTOPTIM()                                    --> lFilterOptimized

      dbInfo( DBI_BUFREFRESHTIME[, nNewVal])               --> nOldVal
  Setting new value for area skip and seek buffers refresh time in 0.01 sec.
  If -1: using connection setting. If 0 - buffers are used anyway.

      dbInfo( DBI_CLEARBUFFER )
  This command cleared skip buffer.

      7.4 Additional rdd functions

      leto_CloseAll( [ cConnString | nConnection ] )       --> nil
 Close all workareas for specified or default connection

      7.5 Setting client paramenter

      LETO_SETSKIPBUFFER( nSkip )                          --> nCount (buffer statistic using)
 This buffer is intended for optimization of multiple calls of skip.
 This function set size in records of skip buffer for current workarea.
 By default, the size of skip buffer is 10 records. Skip buffer is bidirectional.
 Skip buffer is refreshed after BUFF_REFRESH_TIME (1 sec)
 If parameter <nSkip> is absent, function returns bufferr statictic (number of buffer shooting)

      LETO_SETSEEKBUFFER( nRecsInBuf )                     --> nCount (buffer statistic using)
 This buffer is intended for optimization of multiple calls of seek.
 This function set size in records of seek buffer for current index order.
 If record is found in seek buffer on dbSeek(), it's not loaded from server.
 Like skip buffer, seek buffer is refreshed after BUFF_REFRESH_TIME (1 sec)
 If parameter <nRecsInBuf> is absent, function returns bufferr statictic
 (number of buffer shooting)
 By default, seek buffer is turned off.

      LETO_SETFASTAPPEND( lFastAppend )                    --> lFastAppend (previous value)
 If the fast append mode isn't set, record is added on the server at once
 after a dbAppend() function call. If this mode is set, record is added
 by dbCommit() call, or after a call of functions of navigation. By default
 a mode fast append isn't set. The switch working on all workareas.

      RddInfo( RDDI_REFRESHCOUNT, <lSet>,, [nConnection] )
 By default, the RDDI_REFRESHCOUNT flag is set to true.  If this flag is set,
 RecCount() function retrieve records count from server, if doesn't set -
 use last value from server.  If other applications are appending records
 to the table, new value of records count won't be immediately received.
 If RDDI_REFRESHCOUNT flag is cleared, dbGoto(0) cleared record buffer and
 set eof and other flags instead of server request.

      RddInfo( RDDI_BUFKEYCOUNT, <lSet>,, [nConnection] )
 By default, the RDDI_BUFKEYCOUNT flag is set to false.  If this flag isn't set,
 ordKeyCount() function retrieve key count from server, if set -
 use last value from server.

      RddInfo( RDDI_BUFKEYNO, <lSet>,, [nConnection] )
 By default, the RDDI_BUFKEYNO flag is set to false.  If this flag isn't set,
 ordKeyNo() function retrieve value from server, if set - use last value from server.

      7.6 File functions

 The <cFileName> parameter of all file functions can contain a connection string
 to the letodb server in a format:
 //ip_address:port/data_path/file_name.
 If the connection string is omitted, the current active connection is used:
 /data_path/file_name.
 All files is searching at the DataPath catalog on the server. The ".."
 symbols are disabled.

      LETO_FILE( cFileName )                               --> lFileExists
 Determine if file exist at the server, analog of File() function

      LETO_FERASE( cFileName )                             --> -1 if failed
 Delete a file at the server.

      LETO_FRENAME( cFileName, cFileNewName )              --> -1 if failed
 Rename a file: <cFileName> --> <cFileNewName>. <cFileNewName> should be without
 connection string.

      LETO_MEMOREAD( cFileName )                           --> cStr
 Returns the contents of file at the server as character string, analog of
 MemoRead() function.

      Leto_MemoWrite( cFileName, cBuf )                    --> lSuccess
 Writes a character string into a file at the server, analog of
 MemoWrit() function.

      LETO_MAKEDIR( cDirName )                             --> -1 if failed
 Creates a directory at the server

      LETO_FERROR()                                        --> nError
 Returns an error code of last file function.

      Leto_FileRead( cFileName, nStart, nLen, @cBuf )      --> -1 if failed
 Read a content of file at the server from <nStart> offset and <nLen> length

      Leto_FileWrite( cFileName, nStart, cBuf )            --> lSuccess
 Write <cBuf> character string to a file at the server from <nStart> offset and <nLen> length

      Leto_FileSize( cFileName )                           --> -1 if failed
 Returns a length of filt at the server

      Leto_Directory( cDir[, cAttr] )                      --> aDirectory
 Returns a content of directory at the server in the same format as Directory() function

      7.7 Management functions

      LETO_MGGETINFO()                                     --> aInfo
 This function returns parameters of current connection as 17-element array
 of char type values:
 1 - count of active users
 2 - max count of users
 3 - opened tables
 4 - max opened tables
 5 - time elapsed
 6 - count of operations
 7 - bytes sent
 8 - bytes read
 9 - opened indexes
 10 - max opened indexes
 11 - data path
 12 - max day wait
 13 - ulWait
 14 - count of transactions
 15 - count successfully of transactions
 16 - current memory used
 17 - max memory used

      LETO_MGGETUSERS( [<cTableId>|<nTable>] )                        --> aInfo
 Function returns two-dimensional array, each row is info about user:
 aInfo[i,1] - user number
 aInfo[i,2] - ip address
 aInfo[i,3] - net name of client
 aInfo[i,4] - program name
 aInfo[i,5] - timeout

      LETO_MGGETTABLES( [<cUserId>|<nUser>] )                         --> aInfo
 Function returns two-dimensional array, each row is info about opened tables:
 aInfo[i,1] - table number
 aInfo[i,2] - table name

      LETO_MGGETTIME()                                     --> aDateTime
 Function returns array {<dDate>, <nSeconds>}:
 dDate - server date;
 nSeconds - seconds after midnight.
 Convert this values to datetime variable (Harbour):
 hb_DTOT( aDateTime[1], aDateTime[2] )

      LETO_MGKILL( <nUser>|<cUserId> )
 Kill user number <nUser>

      LETO_LOCKCONN( lOnOff )                              --> lSuccess
 After leto_lockconn( .t. ) request new connections are blocked by server, until
 leto_lockconn( .f. ) called

      LETO_LOCKLOCK( lOnOff, nSecs )                       --> lSuccess
 This function wait until any updates are closed, commit all changes and
 trying to lock server from any updates from clients.
 It returns True, if lock is succesfull.

      7.8 User account management functions

      LETO_USERADD( cUserName, cPass [, cRights ] )        --> lSuccess
      LETO_USERPASSWD( cUserName, cPass )                  --> lSuccess
      LETO_USERRIGHTS( cUserName, cRights )                --> lSuccess
      LETO_USERFLUSH()                                     --> lSuccess
      LETO_USERGETRIGHTS()                                 --> cRights

      7.9 Server variable management functions

      LETO_VARSET( cGroupName, cVarName, xValue[, nFlags[, @xRetValue]] ) --> lSuccess

 This function assign value <xValue> to variable <cVarName> from group <cGroupName>
 Optional parameter <nFlags> defines function mode:
 LETO_VCREAT    - if variable doesn't exist, it's created;
 LETO_VOWN      - own user variable (free after user disconnect);
 LETO_VDENYWR   - write deny for other users;
 LETO_VDENYRD   - read deny for other users;
 LETO_VPREVIOUS - retusn previos value to <xRetValue> parameter.

      LETO_VARGET( cGroupName, cVarName )                  --> xValue

 Function return value of variable <cVarName> from group <cGroupName>

      LETO_VARINCR( cGroupName, cVarName )                 --> nValue

 Function increment value of variable <cVarName> from group <cGroupName>

      LETO_VARDECR( cGroupName, cVarName )                 --> nValue

 Function decrement value of variable <cVarName> from group <cGroupName>

      LETO_VARDEL( cGroupName, cVarName )                  --> lSuccess

 Function delete variable <cVarName> from group <cGroupName>

      LETO_VARGETLIST( [cGroupName [, nMaxLen]] )          --> aList

 Function return two-dimensional array with variables: { {<cVarName>, <value>}, ...}

      7.10 Calling udf-functions on the server

      LETO_UDF( cSeverFunc, xParam1, ... )                 --> xResult
 This function is called from client application. A string
 <cServerFunc> contains a server connection string and name
 of udf function:
 //ip_address:port/funcname
 A <funcname> function should be defined on the letodb server.
 The first parameter of udf function is nUserStru.
 Udf function can return result (any type) to client.
 Examples of udf-functions are in the tests/letoudf.prg

      LETO_UDFEXIST( cSeverFunc )                          --> lExist
 leto_udfExist check the existance of udf-function at the letodb server.
 <cSeverFunc> parameter is the same as for leto_udf().

      LETO_PARSEREC( cRecBuf )                             --> nil
 This function is necessary for calling, if udf-function returns as
 result the buffer of record which should be current after of it
 works.

      LETO_PARSERECODRS( cRecBuf )                         --> nil
 This function is necessary for calling to fill the skip-buffer as a result
 of udf-function UDF_dbEval. After calling this function, the data from the
 skip-buffer can be received by dbSkip() calls. See sample in comments for
 UDF_dbEval() in tests/letoudf.prg

      7.11 Functions for bitmap filters

 If letodb compiled with rdd BMDBFCDX/BMDBFNTX, then there is support
 the following functions:

      LBM_DbGetFilterArray()                               --> aFilterRec
      LBM_DbSetFilterArray( aFilterRec )                   --> nil
      LBM_DbSetFilterArrayAdd( aFilterRec )                --> nil
      LBM_DbSetFilterArrayDel( aFilterRec )                --> nil

 Purpose and the parameters of these functions is the same as for the
 corresponding functions BM_*.

      LBM_DbSetFilter( [<xScope>], [<xScopeBottom>], [<cFilter>] ) -> nil
 This function set bitmap filter by current index order and for condition,
 defined in <xScope>, <xScopeBottom>, <cFilter> parameters.
 The current record after LBM_DbSetFilter() is the first record satisfying
 filter condition.

      8. Management utility

      There are two management utilities, GUI and console, the sources are in
 utils/manage directory.

      GUI utility, manage.prg, is made with the HwGUI library. If you have HwGUI,
 just write in the line 'set HWGUI_INSTALL=' in utils/manage/bld.bat a path
 to your HwGUI directory and run the bld.bat, it will build manage.exe for you.
   
      For those, who doesn't use HwGUI, there is a console mode utility,
 console.prg. Build a console.exe with a make/bat files, which you use to build
 Harbour single-file programs, you just need to add rddleto.lib to the libraries
 list. Run the console.exe with a server name or ip and port as a parameter:

      console.exe server_name:nPort
      console.exe ip_address:nPort

 The server_name and ip_address in a command line must be without leading
 slashes ( '//' ), because Clipper/Harbour interprets them in a special way.

      9. Server-side functions

      These functions can be run from the client by function leto_udf,
 and also from the functions defined in a file letoudf.hrb.
 The first parameter such function always nUserStru

      leto_Alias( nUserStru, cClientAlias )                --> cRealAlias
 This function return server alias for client alias <cClientAlias>.
 The server alias then can be user in usial rdd-operations

      leto_RecLock( nUserStru [, nRecord] )                --> lSuccess
  leto_Reclock function locked record with <nRecord> number, or a current record.

      leto_RecUnLock( nUserStru [, nRecord] )              --> Nil
  leto_RecUnlock function unlocked record with <nRecord> number, or a current
  record.

      leto_RecLockList( nUserStru, aRecNo )                --> lSuccess
  leto_ReclockList function locked records with number in the <aRecNo> array.
  If any record isn't locked, all records are unlocked, and function returns
  .F. result.
  This function can be used at the server from letoodf.prg module, or from
  client by a call leto_UDF( "leto_RecLockList", aRecNo ).

      leto_TableLock( <nUserStru>, [<nFlag>], [<Secs>])    --> lSuccess
      leto_TableUnLock( <nUserStru>, [<nFlag>])

      nFlag - parameter from 1 to 32, nSecs - seconds for wait locking (1 by default)
      These functions are intended for concurrent access to the table for
      actions except updating of the data.

      leto_SelectArea( nUserStru, nAreaId )                --> lSuccess

      leto_areaID( nUserStru )                             --> nAreaId
 Function return internal id of current workarea

      letoUseArea( nUserStru, cFileName, cAlias, lShared, lReadOnly, cdp ) --> nAreaId
      letoOrdListAdd( nUserStru, cBagName )                --> Nil
      letoOrdCreate( nUserStru, cBagName, cKey, cTagName,
                     lUnique, cFor, cWhile, lAll, nRecNo,
                     nNext, lRest, lDesc, lCustom,
                     lAdditive )                           --> Nil
      letoCloseArea( nUserStru )                           --> Nil

 The functions letoUseArea, letoOrdListAdd, letoOrdCreate, letoCloseArea,
 leto_RecLock, leto_RecLock is intended for using in udf-functions instead
 of rdd functions: dbUseArea, OrdListAdd, OrdCreate, dbCloseArea, RLock, dbUnlock

      LETO_VARSET( nUserStru, cGroupName, cVarName, xValue[, nFlags )
                                                           --> lSuccess
      LETO_VARGET( nUserStru, cGroupName, cVarName )       --> xValue
      LETO_VARINCR( nUserStru, cGroupName, cVarName )      --> nValue
      LETO_VARDECR( nUserStru, cGroupName, cVarName )      --> nValue
      LETO_VARDEL( nUserStru, cGroupName, cVarName )       --> lSuccess
      LETO_VARGETLIST( nUserStru, [cGroupName, [lValue]] ) --> aList

Saudações,
Itamar M. Lins Jr.

LetoDb e Harbour, como usar.

Enviado: 09 Jun 2014 08:43
por Minduim
caro Itamar, bom dia para todos nós;

agradeço sua colaboração;

creio que entendi suas observações;

entendo que terei re-escrever grande parte do dos meus .prg;

bem, mãos a obra;