08 Ago 2017 17:06
08 Ago 2017 18:27
/*
* This sample tests working with dbf files
* Just change the cPath value to that one you need.
*/
REQUEST LETO
REQUEST DBFCDX
#include "dbinfo.ch"
Function Main( cPath )
LOCAL aNames := { "Petr", "Ivan", "Alexander", "Pavel", "Alexey", "Elch", ;
"Konstantin", "Vladimir", "Nikolay", "Andrey", "Dmitry", "Sergey" }
LOCAL i, aStru, aServerDriver
LOCAL nPort := 2812
FIELD NAME, NUM, INFO, DINFO, MINFO, TINFO
ALTD()
SET DATE FORMAT "dd/mm/yy"
IF Empty( cPath )
//cPath := "//127.0.0.1:2812/"
cPath := ""
RDDSETDEFAULT( "DBFCDX" )
ELSE
cPath := "//" + cPath + IiF( ":" $ cPath, "", ":" + ALLTRIM( STR( nPort ) ) )
cPath += Iif( Right(cPath,1) == "/", "", "/" )
RDDSETDEFAULT( "LETO" )
ENDIF
IF dbCreate( cPath + "test1", { { "NAME", "C", 10, 0 },;
{ "NUM" , "N", 4, 0 },;
{ "INFO", "C", 32, 0 },;
{ "DINFO", "D", 8, 0 },;
{ "TINFO", "@", 8, 0 },;
{ "MINFO", "M", 10, 0 } } )
? "File has been created"
ENDIF
USE ( cPath + "test1" ) NEW
IF ! NetErr() .AND. ! EMPTY( ALIAS() )
? "File has been opened"
ELSE
? "ERROR opening database! -- press any key to quit"
Inkey( 0 )
QUIT
ENDIF
aStru := dbStruct()
? "Fields:", Len( aStru )
FOR i := 1 TO Len( aStru )
? i, aStru[i,1], aStru[i,2], aStru[i,3], aStru[i,4]
NEXT
FOR i := 1 TO Len( aNames )
APPEND BLANK
REPLACE NAME WITH aNames[ i ],;
NUM WITH i + 1000,;
INFO WITH "This is a record number " + Ltrim( Str( i ) ),;
DINFO WITH Date() + i - 1,;
TINFO WITH IIF( i == 6, HB_STRTOTS( "" ), hb_DToT( DATE() + i, TIME() ) ),;
MINFO WITH aNames[ i ]
NEXT
? LEN( aNames ), "Records has been added"
INDEX ON NAME TAG NAME
? "INDEX KEY 1:", indexkey( 1 )
INDEX ON STR( NUM, 4 ) TAG NUM
? "INDEX KEY 2:", indexkey( 2 )
INDEX ON TINFO TAG TS
? "INDEX KEY 3:", indexkey( 3 )
INDEX ON INFO TAG ASH
? "INDEX KEY 3:", indexkey( 4 )
? "File has been indexed, "
?? DBORDERINFO( DBOI_ORDERCOUNT )
?? " active orders "
?? Iif( DBORDERINFO( DBOI_ORDERCOUNT ) == 4, "- Ok","- Failure" )
?
? "Press any key to continue..."
Inkey( 0 )
i := RecCount()
? "Reccount ", i, Iif( i == Len( aNames ), "- Ok","- Failure" )
DbSetOrder( 0 )
GO TOP
? "go top ", NUM, NAME, DINFO, Iif( NUM == 1001, "- Ok","- Failure" )
REPLACE INFO WITH "First", MINFO WITH "First"
DbGoTo( 5 )
REPLACE INFO WITH ""
GO BOTTOM
? "go bottom", NUM, NAME, DINFO, Iif( NUM == 1012, "- Ok","- Failure" )
REPLACE INFO WITH "Last", MINFO WITH "Last"
?
? 'ordSetFocus( "NAME" )'
ordSetFocus( "NAME" )
GO TOP
? "go top ", NUM, NAME, DINFO, Iif( NUM == 1003, "- Ok","- Failure" )
SKIP
? "skip ", NUM, NAME, DINFO, Iif( NUM == 1005, "- Ok","- Failure" )
GO BOTTOM
? "go bottom", NUM, NAME, DINFO, Iif( NUM == 1008, "- Ok","- Failure" )
SKIP -1
? "skip -1 ", NUM, NAME, DINFO, Iif( NUM == 1012, "- Ok","- Failure" )
DbSetOrder( 4 )
DBGOBOTTOM()
DBSEEK( "", .T. )
? "DbSeek( '',.T. ) ", NUM, NAME, DINFO, Iif( NUM == 1005, "- Ok","- Failure" )
DbSetOrder( 1 )
DBGOBOTTOM()
DBSEEK( "Petr", .F. )
? "DbSeek( 'Petr',.F. ) ", NUM, NAME, DINFO, Iif( NUM == 1001, "- Ok","- Failure" )
DBGOBOTTOM()
DBSEEK( "Petr", .T. )
? "DbSeek( 'Petr',.F. ) ", NUM, NAME, DINFO, Iif( NUM == 1001, "- Ok","- Failure" )
DBGOBOTTOM()
DBSEEK( "Pe", .T. )
? "DbSeek( 'Pe',.T. ) ", NUM, NAME, DINFO, Iif( NUM == 1001, "- Ok","- Failure" )
DbSetOrder( 3 )
DBGOBOTTOM()
DBSeek( hb_DToT( DATE() + 5 ), .T. )
? "DbSeek( TS,.T. ) ", NUM, NAME, DINFO, Iif( NUM == 1005, "- Ok","- Failure" )
DBGOBOTTOM()
DBSeek( hb_DToT( DATE() + 5 ), .F. )
? "DbSeek( TS,.F. ) ", NUM, NAME, DINFO, Iif( EOF(), "- Ok","- Failure" )
DbSetOrder( 1 )
DBGOTOP()
DBSEEK( "Sergey", .F. )
? "DbSeek( 'Sergey',.F. )", NUM, NAME, DINFO, Iif( NUM == 1012, "- Ok","- Failure" )
DBGOTOP()
DBSEEK( "Ser", .T. )
? "DbSeek( 'Sergey',.T. )", NUM, NAME, DINFO, Iif( NUM == 1012, "- Ok","- Failure" )
DBGOTOP()
DBSEEK( "Sergez", .F. )
? "DbSeek( 'Sergez',.F. )", NUM, NAME, DINFO, Iif( EOF(), "- Ok","- Failure" )
SET FILTER TO NUM >= 1004 .AND. NUM <= 1010
?
? "SET FILTER TO NUM >= 1004 .AND. NUM <= 1010"
GO TOP
? "go top ", NUM, NAME, DINFO, Iif( NUM == 1005, "- Ok","- Failure" )
SKIP
? "skip ", NUM, NAME, DINFO, Iif( NUM == 1010, "- Ok","- Failure" )
GO BOTTOM
? "go bottom", NUM, NAME, DINFO, Iif( NUM == 1008, "- Ok","- Failure" )
SKIP -1
? "skip -1 ", NUM, NAME, DINFO, Iif( NUM == 1004, "- Ok","- Failure" )
? "Press any key to continue..."
Inkey( 0 )
?
? "SET FILTER TO, SET ORDER TO 0"
SET FILTER TO
SET ORDER TO 0
GO TOP
? "First record", Iif( ALLTRIM( INFO ) == "First" .AND. MINFO == "First", "- Ok","- Failure" )
GO BOTTOM
? "Last record ", Iif( ALLTRIM( INFO ) == "Last" .AND. MINFO == "Last", "- Ok","- Failure" )
?
? 'ordSetFocus( "NUM" ), SET SCOPE TO "1009", "1011"'
ordSetFocus( "NUM" )
SET SCOPE TO "1009", "1011"
GO TOP
? "go top", NUM, NAME, DINFO, Iif( NUM == 1009, "- Ok","- Failure" )
SKIP
? "skip ", NUM, NAME, DINFO, Iif( NUM == 1010, "- Ok","- Failure" )
SKIP
? "skip ", NUM, NAME, DINFO, Iif( NUM == 1011, "- Ok","- Failure" )
SKIP
? "skip ", NUM, NAME, DINFO, Iif( Eof(), "- Ok","- Failure" )
dbCloseAll()
?
? "Press any key to continue..."
Inkey( 0 )
IF RDDSETDEFAULT() == "LETO"
aServerDriver := leto_DbDriver()
ENDIF
IF "CDX" $ RDDSETDEFAULT() .OR. ( VALTYPE( aServerDriver ) == "A" .AND. "CDX" $ aServerDriver[ 1 ] )
USE ( cPath + "test1" ) NEW
i := 0
? "auto opened index Tags:"
DO WHILE ! Empty( Ordkey( ++i ) )
? i, ordKey( i )
ENDDO
OrdSetFocus( 3 )
OrdDestroy( "TS" )
? "Indexord after OrdDestroy():", INDEXORD(), IIF( INDEXORD() == 0, " - Ok", " - Failure" )
ENDIF
dbCloseAll()
?
? "dropping test DBF: "
?? Iif( DbDrop( cPath + "test1" ), "- Ok","- Failure" )
?
? "Press any key to finish ..."
Inkey( 0 )
Return Nil
08 Ago 2017 21:34
Itamar M. Lins Jr. escreveu:Ola!
Se vc não colocar o programa para podermos testar, o erro e mandar para o Elch para ele poder resolver caso exista o problema mais tempo vamos perder.
Crie um programa, ai o menor possível que demonstre o problema, para que todos aqui do forum possam te ajudar.
Nesse programa, que demonstre o erro, vc cria a estrutura do DBF, abre o DBF e mostra como acontece o erro.
Mais ou menos nesses moldes ai em baixo.
15 Ago 2017 14:07
15 Ago 2017 17:55
Infelizmente o erro de abertura nos módulos do sistema ainda persistem,
IF ARQLOCOK = 'F' ; dbCloseAll() ; RETURN ; ENDIF
16 Ago 2017 13:30
Itamar M. Lins Jr. escreveu:Não use suas funções, RDUSE,RDREC,RD...
03 Abr 2018 20:36
04 Abr 2018 06:22
05 Abr 2018 11:13
LETO_RECONNECT( [ cAddress ], [ cUserName ], [ cPassword ],
[ nTimeOut ], [ nBufRefreshTime ], [ lZombieCheck ], [ nDelay ] )
==> nConnection, -1 if failed
All param are optional! and same as LETO_CONNECT(), plus optional 7th param <nDelay> in unit seconds.
This will close a possible still alive or dead connection to server, and re-establish a new connection
to the same or even different server if <cAddress> is given. Except <cUserName> and <cPassword> all
params are filled in by setting of the old connection.
The full WA environment ( tables, index orders, filters, scope, relations, R|F-locks ) is restored
for the new connection.
If it is the same server, <nDelay> will be 1.0 second to let the server close the tables and remove
existing locks before try to establish a new connection, for different server no delay is needed.
<nDelay> should only needed to be manually set, if a connection is made to same server, but over
different network.
05 Abr 2018 11:25
07 Abr 2018 12:27
Bom, pela minha experiência com o avast, isso não adianta nada. Uso meus programas com Hwgui, desde muito tempo com o manifest, e o avast faz a checagem as vezes apaga o .exe outras não..., alias o avast apaga qualquer programa em qualquer linguagem, porque ele informa ao usuário que é suspeito e mostra a tela p/ usuário decidir se apaga ou não, e o usuário na maioria das vezes clica em apagar.
Outra dor de cabeça que tenho com o avast é o firewall de vez em quando ele derruba as conexões Letodb/TS porta 2812/3389, tenho que manter o firewall dele desligado, usando o nativo do windows mesmo.
Razão pela qual muitos preferem usar AVG, etc
12 Abr 2018 16:40
12 Abr 2018 17:13
17 Abr 2018 16:48
17 Abr 2018 18:26