The create statement is:
- Code: Select all Expand view
- CREATE TABLE `usuarios` (
`nome` varchar(10) DEFAULT NULL,
`senh` varchar(10) DEFAULT NULL,
`nive` varchar(10) DEFAULT NULL,
`digi` varchar(10) DEFAULT NULL,
`perm` varchar(60) DEFAULT NULL,
`codi` varchar(4) DEFAULT NULL,
`sql_rowid` bigint(10) NOT NULL AUTO_INCREMENT,
`sql_deleted` enum('F','T') NOT NULL,
`ativ` varchar(1) NOT NULL DEFAULT 'S',
PRIMARY KEY (`sql_rowid`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1
The original field "nome" was filed with crypted values and I wanted to remove that crypt. The field "codi" was not used but I wanted to use it now. I managed to do everything but during the process I encountered sometinhg I don´t understand:
- Code: Select all Expand view
- oQuer := oServer:Query( "SELECT NOME FROM usuarios" )
oQuer:GoTop()
WHILE !oQuer:Eof()
oQuer:NOME := allTrim( crypt( oQuer:NOME, "ENCRYPTKEY" ) ) // Remove the encryption from field NOME
oQuer:Save()
oQuer:Skip()
ENDDO
oQuer:End()
Works perfect. The values of column NOME are saved readable text.
- Code: Select all Expand view
- oQuer := oServer:Query( "SELECT NOME,CODI FROM usuarios" )
oQuer:GoTop()
WHILE !oQuer:Eof()
oQuer:NOME := allTrim( crypt( oQuer:NOME, "ENCRYPTKEY" ) )
oQuer:CODI := strZero( oQuer:nRecNo, 4 )
oQuer:Save()
oQuer:Skip()
ENDDO
oQuer:End()
JUST DO NOTHING.
- Code: Select all Expand view
- oQuer := oServer:Query( "SELECT * FROM usuarios" )
oQuer:GoTop()
WHILE !oQuer:eOF()
oQuer:NOME := allTrim( crypt( oQuer:NOME, "ENCRYPTKEY" ) )
oQuer:CODI := strZero( oQuer:nRecNo, 4 )
oQuer:Save()
oQuer:Skip()
ENDDO
oQuer:End()
Works perfect. The values of column NOME are saved readable text and CODI is OK too.
What I understand from the above is that to alter more than 1 field I have to query * and not only the fields I want to alter. Is my understanding correct, is there a bug or am I missing something?