Salvando a bÃblia em MySQL.
Mas num comando pesquisando o nome do meu filho.... eis que aparecem registros sem o nome.
Tanto faz com ou sem acento, as mesmas linhas aparecem.
Esquisito....
Pra quem quiser brincar no bom sentido....
Aqui em txt
https://umsocorpo.com.br/downloads/biblia-sagrada-em-txt-versao-revista-e-corrigida/
Já avisando que tem alguns erros de digitação, onde foi trocado o número 1 pela letra L.
l1, l3, l4, etc., precisando de ajuste
E também alguns textos que foram divididos, precisando ajuste.
#include "inkey.ch"
PROCEDURE PTESBIBLIA
LOCAL cText, aText, cLine, cLivro := "", cCapitulo := "", cVersiculo, nKey, nId := 1
LOCAL cnSQL := ADOClass():New( AppConexao() )
SetMode( 30, 100 )
CLS
cText := MemoRead( "d:\temp\biblia.txt" )
aText := hb_RegExSplit( hb_Eol(), cText )
IF Len( aText ) < 2
aText := hb_RegExSplit( Chr(13), cText )
ENDIF
WITH OBJECT cnSQL
FOR EACH cLine IN aText
cLine := AllTrim( cLine )
IF Left( cLine, 1 ) $ "0123456789"
cVersiculo := Substr( cLine, 1, At( " ", cLine ) - 1 )
cLine := Substr( cLine, At( " ", cLine ) + 1 )
ELSEIF Right( cLine, 1 ) $ "0123456789"
cCapitulo := Substr( cLine, Rat( " ", cLine ) + 1 )
cLine := Substr( cLine, 1, Rat( " ", cLine ) - 1 )
cVersiculo := ""
ELSE
cLivro := cLine
cCapitulo := ""
cVersiculo := ""
ENDIF
:QueryCreate()
:QueryAdd( "LIVRO", cLivro )
:QueryAdd( "CAPITULO", cCapitulo )
:QueryAdd( "VERSICULO", cVersiculo )
:QueryAdd( "TEXTO", cLine )
:QueryExecuteInsert( "biblia" )
SayScroll( Str( nId++, 6 ) + " " + cLivro + " " + cCapitulo + " " + cVersiculo )
IF ( Upper( Left( cLine, 1 ) ) == "L" .AND. Substr( cLine, 2, 1 ) $ "0123456789" ) .OR. ;
Len( cVersiculo ) > 25 .OR. Len( cCapitulo ) > 25 .OR. Len( cLivro ) > 25
SayScroll( cLine )
Inkey(20)
ENDIF
nKey := Inkey()
IF nKey == K_ESC
EXIT
ENDIF
IF nKey != 0
Inkey(10)
ENDIF
NEXT
ENDWITH
RETURN