Protegendo DBF
Enviado: 29 Set 2023 08:32
Olá!
Essa função dbinfo() tem muuuuita coisa!
Saudações,
Itamar M. Lins Jr.
Essa função dbinfo() tem muuuuita coisa!
Código: Selecionar todos
#include "dbinfo.ch"
proc main()
field F1, F2
local aStru := {{"F1","C",10,0},{"F2","C",10,0}}, nRow
dbCreate( "tst", aStru )
use tst
/* set encryption key for new and modified records */
dbInfo( DBI_PASSWORD, "mypasswd" )
/* add few records */
dbAppend()
F1:="Hello"; F2:="World"
dbAppend()
F1:="Can you"; F2:="see it?"
dbcommit()
? "Let's see the table"
wait
nRow:=row(); dbgotop(); browse(); setpos(nRow+1,0)
? "Clear encryption key and see the table again"
wait
dbInfo( DBI_PASSWORD, "" )
nRow:=row(); dbgotop(); browse(); setpos(nRow+1,0)
? "Restore valid encryption key then"
? "copy table to the new unencrypted one and browse it"
wait
dbInfo( DBI_PASSWORD, "mypasswd" )
copy to tst2
use tst2 new
nRow:=row(); dbgotop(); browse(); setpos(nRow+1,0)
close all
? "Create new table then set encryption key for it and"
? "append records from other unencrypted table"
Wait
dbCreate( "tst3", aStru )
use tst3
dbInfo( DBI_PASSWORD, "mypasswd" )
append from tst2
nRow:=row(); dbgotop(); browse(); setpos(nRow+1,0)
? "That's all folks ;-)"
Wait
return
// by Przemek Czerpak
Itamar M. Lins Jr.