Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBUSEAREA(0) LETO error = 21: EG_OPEN No 1000 // leto_ParseCommand() #39

Open
doubledev opened this issue Jul 20, 2023 · 4 comments
Open

Comments

@doubledev
Copy link

Hi,
using harbour lastest version and Letodbf lastest version, with the use of a filter, dbUsearea generates an error before opening the file again witout using dbclearfilter() before dbclosearea().
With previous versions there were no error.
Best regards,
Edmond

// -> error += DBUSEAREA(0)  LETO  error = 21: EG_OPEN  No 1000
// letodbf.log -> ERROR leto_ParseCommand()

private Mydbf:="//127.0.0.1:2812/\Testdbf.dbf"
private cfilter:='FIELD1="ABC"'
dbCreate( Mydbf , { {"FIELD1","C",3,0} } , "LETO" )
dbUsearea( .F. , "LETO" , Mydbf , NIL , .T. , .F. )
dbSetfilter( {|| &cfilter } , cfilter ) // or dbSetfilter( &( "{|| "+cfilter+" }" ) , cfilter )
// bug without dbclearfilter()
dbclosearea()

@Numerabilis
Copy link

Numerabilis commented Aug 7, 2023

Hi,

Didn´t work for me too but I made some changes for you and this code below works:

// servidor LETODBf
#include "rddleto.ch"  // defines do RDD
#include "dbinfo.ch"   // Header file for the RDD API Index OrderInfo and DBInfo support
#include "leto_std.ch" // traduz os comandos para o LETO
#define __LETO_TRANSLATE_FILE_ALL
#include "letofile.ch" // traduz todas as funções para o LETO
REQUEST RDDLETO
REQUEST RDDInfo

FUNCTION MAIN()
private Mydbf:="//127.0.0.1:2812/"
private cfilter:='FIELD1="ABC"'

setmode(25,80)
*****************************************************	
*** DEFINIR TIPO DE BANCO DE DADOS PADRÃO: DBFCDX ***
*****************************************************
ANNOUNCE RDDSYS
REQUEST DBFCDX
ANNOUNCE FPTCDX
REQUEST DBFFPT
Request ordfor
**********************************
*** CODEPAGE E CHARSET
**********************************
REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850 

***************************************************
*** CONFIGURAÇÃO DO BANCO DE DADOS PADRÃO *********
***************************************************
RDDSETDEFAULT("DBFCDX")
RDDREGISTER( "DBFCDX", 1 ) // RDT_FULL
SET AUTOPEN OFF
SET OPTIMIZE ON
SET HARDCOMMIT OFF 
SET DELETED ON
RDDSETDEFAULT( "LETO" )	

IF leto_Connect( Mydbf ) == -1	
	ALERT("Nenhum LetoDBF Server encontrado - Erro: " + leto_Connect_Err( .T. ) )
	QUIT
ELSE
    ? "LETODBF DATABASE MANAGER running"
ENDIF

? "Press ALT+D and read line by line with debug to see it working. Type F6 to see opened DBFs."
INKEY(0) 

dbCreate( "mydbf" , { {"FIELD1","C",3,0} } )
dbUsearea( .F. ,, "mydbf" ,,, .T. , .F. )

dbSetfilter( {|| &(cfilter) } , cfilter ) // or dbSetfilter( &( "{|| "+cfilter+" }" ) , cfilter )

dbclosearea()

Remember to close this ticket afterwards.

@doubledev
Copy link
Author

Hi Numerabilis,
dbSetfilter( {|| &(cfilter) } , cfilter ) didn´t work for me

dbSetfilter() works without the 2nd parameter and the exe does not bug when opening the file again.
dbSetfilter( {|| &cfilter } ) // ok

Best regards
Edmond

@Numerabilis
Copy link

Hi Doubledev,

Did you run the example I give? I tested it and it worked.

@Numerabilis
Copy link

Numerabilis commented Aug 18, 2023

Actually, if want to run it twice you should rewrite last lines like below

IF !FILE("mydbf.dbf")
   dbCreate( "mydbf" , { {"FIELD1","C",3,0} } )
ENDIF

dbUsearea( .F. ,, "mydbf" ,,, .T. , .F. )

DbClearFilter()
dbSetfilter( {|| &(cfilter) } , cfilter ) // or dbSetfilter( &( "{|| "+cfilter+" }" ) , cfilter )
DBGOTOP()

dbclosearea()

This way I think it would work as desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants