Protegendo DBF

Aqui você poderá oferecer suas Contribuições, Dicas e Tutoriais (Texto ou Vídeo) que sejam de interesse de todos.

Moderador: Moderadores

Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

Protegendo DBF

Mensagem por Itamar M. Lins Jr. »

Olá!
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
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Responder