diff --git a/FoxBin2PRGVersionFile.txt b/FoxBin2PRGVersionFile.txt index 331619a..9413152 100644 --- a/FoxBin2PRGVersionFile.txt +++ b/FoxBin2PRGVersionFile.txt @@ -2,8 +2,8 @@ Lparameters toUpdateInfo Local lcNote With toUpdateInfo - .VersionNumber = 'v1.19.27' - .VersionDate = Date(2014,07,18) + .VersionNumber = 'v1.19.28' + .VersionDate = Date(2014,07,26) .SourceFileUrl = 'http://vfpxrepository.com/dl/thorupdate/Projects/FoxBin2Prg/FoxBin2Prg.Zip' .Link = 'http://vfpx.codeplex.com/wikipage?title=FoxBin2PRG' @@ -17,6 +17,8 @@ Demo video using FoxBin2Prg with PlasticSCM: http://youtu.be/sE4wQ50Itqg Change History ------------------------------------------------------------- +2014/07/26 v1.19.28 +- Feature: Added new options in foxbin2prg.cfg (DBF_Conversion_Included, DBF_Conversion_Excluded) and in filename.dbf.cfg (DBF_Conversion_Order, DBF_Conversion_Condition) for exporting DBFs data to text when DBF_Conversion_Support is 4 (Edyshor) 2014/07/18 v1.19.27 - Feature: Added support for exporting DBF data for DIFF (It's intended just for DIFF small DBFs, as config ones, not for true Data export. Binary fields are not exported and there is not an Import Data feature) (Doug Hennig) diff --git a/TESTS/ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter.prg b/TESTS/ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter.prg new file mode 100644 index 0000000..568548b --- /dev/null +++ b/TESTS/ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter.prg @@ -0,0 +1,239 @@ +DEFINE CLASS ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter AS FxuTestCase OF FxuTestCase.prg + + #IF .F. + LOCAL THIS AS ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter OF ut__foxbin2prg__c_foxbin2prg__FilenameFoundInFilter.PRG + #ENDIF + + icObj = NULL + + + ******************************************************************************************************************************************* + FUNCTION SETUP + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + *LOCAL loObj AS c_conversor_base OF "FOXBIN2PRG.PRG" + SET PROCEDURE TO 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + oFXU_LIB = CREATEOBJECT('CL_FXU_CONFIG') + *oFXU_LIB.setup_comun() + THIS.icObj = NEWOBJECT("c_foxbin2prg", "FOXBIN2PRG.PRG") + *loObj = THIS.icObj + *loObj.l_Test = .F. + + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION TearDown + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + THIS.icObj = NULL + + IF VARTYPE(oFXU_LIB) = "O" + *oFXU_LIB.teardown_comun() + oFXU_LIB = NULL + ENDIF + RELEASE PROCEDURE 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + RELEASE oFXU_LIB + CLOSE PROCEDURES + CLEAR RESOURCES + + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION Evaluate_results + LPARAMETERS toEx AS EXCEPTION, tnCodError_Esperado, tl_Valor, tl_ValorEsperado + + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + + IF PCOUNT() = 0 + THIS.messageout( "* Support method, not a valid test." ) + RETURN .T. + ENDIF + + LOCAL loFoxBin2Prg AS c_foxbin2prg OF "FOXBIN2PRG.PRG" + + IF ISNULL(toEx) + loFoxBin2Prg = THIS.icObj + + *-- MESSAGES + THIS.messageout( 'Filename found in filter >> Esperado: ' + TRANSFORM(tl_ValorEsperado) ) + THIS.messageout( 'Filename found in filter >> Actual : ' + TRANSFORM(tl_Valor) ) + + *-- ASSERTIONS + THIS.assertequals( tl_ValorEsperado, tl_Valor, 'Filename found in filter' ) + + loFoxBin2Prg = NULL + RELEASE loFoxBin2Prg + + ELSE + *-- Evaluación de errores + THIS.messageout( "Error " + TRANSFORM(toEx.ERRORNO) + ', ' + TRANSFORM(toEx.MESSAGE) ) + THIS.messageout( toEx.PROCEDURE + ', ' + TRANSFORM(toEx.LINENO) ) + IF NOT INLIST( toEx.ERRORNO, 1098, 2071 ) && Error del usuario (ERROR y THROW) + THIS.messageout( TRANSFORM(toEx.LINECONTENTS) ) + ENDIF + + THIS.assertequals( tnCodError_Esperado, toEx.ERRORNO, 'Error' ) + ENDIF + + THIS.messageout( '' ) + THIS.messageout( REPLICATE('*',80) ) + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION Deberia_EncontrarElArchivo__FB2P_FOXUSER_DBF__UsandoElFiltro__TB2P_xpx + LOCAL lnCodError, lnCodError_Esperado ; + , lc_File, lc_Filtros, ll_Valor, ll_ValorEsperado ; + , loFoxBin2Prg AS c_foxbin2prg OF "FOXBIN2PRG.PRG" ; + , loEx AS EXCEPTION + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + + TRY + loEx = NULL + loFoxBin2Prg = NEWOBJECT("c_foxbin2prg", "FOXBIN2PRG.PRG") + *loFoxBin2Prg.l_Debug = .F. + loFoxBin2Prg.l_ShowErrors = .F. + *loFoxBin2Prg.l_Test = .T. + + + *-- DATOS DE ENTRADA + STORE 0 TO lnCodError, lnCodError_Esperado + lc_File = 'FB2P_FOXUSER.DBF' + lc_Filtros = 'XX.DBF,FF.FRX,FB2P_*.*' + ll_ValorEsperado = .T. + + *-- EVALUACIÓN DEL TEST + ll_Valor = loFoxBin2Prg.FilenameFoundInFilter( lc_File, lc_Filtros ) + + CATCH TO loEx + + FINALLY + THIS.Evaluate_results( loEx, lnCodError_Esperado, ll_Valor, ll_ValorEsperado ) + STORE NULL TO loFoxBin2Prg + RELEASE loFoxBin2Prg + ENDTRY + + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION Deberia_EncontrarElArchivo__FB2P_FOXUSER_DBF__UsandoElFiltro__x_FOXUSERpx + LOCAL lnCodError, lnCodError_Esperado ; + , lc_File, lc_Filtros, ll_Valor, ll_ValorEsperado ; + , loFoxBin2Prg AS c_foxbin2prg OF "FOXBIN2PRG.PRG" ; + , loEx AS EXCEPTION + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + + TRY + loEx = NULL + loFoxBin2Prg = NEWOBJECT("c_foxbin2prg", "FOXBIN2PRG.PRG") + *loFoxBin2Prg.l_Debug = .F. + loFoxBin2Prg.l_ShowErrors = .F. + *loFoxBin2Prg.l_Test = .T. + + + *-- DATOS DE ENTRADA + STORE 0 TO lnCodError, lnCodError_Esperado + lc_File = 'FB2P_FOXUSER.DBF' + lc_Filtros = 'XX.DBF,FF.FRX,*_FOXUSER.*' + ll_ValorEsperado = .T. + + *-- EVALUACIÓN DEL TEST + ll_Valor = loFoxBin2Prg.FilenameFoundInFilter( lc_File, lc_Filtros ) + + CATCH TO loEx + + FINALLY + THIS.Evaluate_results( loEx, lnCodError_Esperado, ll_Valor, ll_ValorEsperado ) + STORE NULL TO loFoxBin2Prg + RELEASE loFoxBin2Prg + ENDTRY + + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION Deberia_EncontrarElArchivo__FB2P_FOXUSER_DBF__UsandoElFiltro__x_F_Xxpx + LOCAL lnCodError, lnCodError_Esperado ; + , lc_File, lc_Filtros, ll_Valor, ll_ValorEsperado ; + , loFoxBin2Prg AS c_foxbin2prg OF "FOXBIN2PRG.PRG" ; + , loEx AS EXCEPTION + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + + TRY + loEx = NULL + loFoxBin2Prg = NEWOBJECT("c_foxbin2prg", "FOXBIN2PRG.PRG") + *loFoxBin2Prg.l_Debug = .F. + loFoxBin2Prg.l_ShowErrors = .F. + *loFoxBin2Prg.l_Test = .T. + + + *-- DATOS DE ENTRADA + STORE 0 TO lnCodError, lnCodError_Esperado + lc_File = 'FB2P_FOXUSER.DBF' + lc_Filtros = 'XX.DBF,FF.FRX,*_F?X*.*' + ll_ValorEsperado = .T. + + *-- EVALUACIÓN DEL TEST + ll_Valor = loFoxBin2Prg.FilenameFoundInFilter( lc_File, lc_Filtros ) + + CATCH TO loEx + + FINALLY + THIS.Evaluate_results( loEx, lnCodError_Esperado, ll_Valor, ll_ValorEsperado ) + STORE NULL TO loFoxBin2Prg + RELEASE loFoxBin2Prg + ENDTRY + + ENDFUNC + + + ******************************************************************************************************************************************* + FUNCTION Deberia_NoEncontrarElArchivo__FB2P_FOXUSER_DBF__UsandoElFiltro__uuFxpx + LOCAL lnCodError, lnCodError_Esperado ; + , lc_File, lc_Filtros, ll_Valor, ll_ValorEsperado ; + , loFoxBin2Prg AS c_foxbin2prg OF "FOXBIN2PRG.PRG" ; + , loEx AS EXCEPTION + #IF .F. + PUBLIC oFXU_LIB AS CL_FXU_CONFIG OF 'TESTS\fxu_lib_objetos_y_funciones_de_soporte.PRG' + #ENDIF + + TRY + loEx = NULL + loFoxBin2Prg = NEWOBJECT("c_foxbin2prg", "FOXBIN2PRG.PRG") + *loFoxBin2Prg.l_Debug = .F. + loFoxBin2Prg.l_ShowErrors = .F. + *loFoxBin2Prg.l_Test = .T. + + + *-- DATOS DE ENTRADA + STORE 0 TO lnCodError, lnCodError_Esperado + lc_File = 'FB2P_FOXUSER.DBF' + lc_Filtros = 'XX.DBF,FF.FRX,??F*.*' + ll_ValorEsperado = .F. + + *-- EVALUACIÓN DEL TEST + ll_Valor = loFoxBin2Prg.FilenameFoundInFilter( lc_File, lc_Filtros ) + + CATCH TO loEx + + FINALLY + THIS.Evaluate_results( loEx, lnCodError_Esperado, ll_Valor, ll_ValorEsperado ) + STORE NULL TO loFoxBin2Prg + RELEASE loFoxBin2Prg + ENDTRY + + ENDFUNC + + +ENDDEFINE diff --git a/foxbin2prg.cfg b/foxbin2prg.cfg index 0acd373..6cd76ad 100644 --- a/foxbin2prg.cfg +++ b/foxbin2prg.cfg @@ -2,7 +2,8 @@ * FOXBIN2PRG v1.19.26 * CONFIGURATION FILE / ARCHIVO DE CONFIGURACIÓN *--------------------------------------------------------------------------------------------------- -* DON'T MODIFY THIS DOCUMENTATION SECTION / NO MODIFIQUE ESTA SECCIÓN DE DOCUMENTACIÓN +* EN: DON'T MODIFY THIS DOCUMENTATION SECTION, MODIFY *UNDER* THIS SECTION +* ES: NO MODIFIQUE ESTA SECCIÓN DE DOCUMENTACIÓN, MODIFIQUE *DEBAJO* DE ESTA SECCIÓN * * DETAIL OF SUPPORTED VALUES / DETALLE DE VALORES SOPORTADOS * If no values given, this are the defaults / Si no se proporcionan valores, estos son los predeterminados @@ -27,6 +28,8 @@ * DBC_Conversion_Support: 2 && Default value * DBF_Conversion_Support: 1 && Default value >> EN: FoxBin2Prg support bi-directional convertion of DBFs, but does not keep data. Use with care. * >> ES: FoxBin2Prg tiene soporte bi-direccional para convertir DBF, pero no mantiene los datos. Usar con cuidado. +* DBF_Conversion_Included: * && If DBF_Conversion_Support:4, you can specify mnultiple filemasks: www,fb2p_free.dbf / Si DBF_Conversion_Support:4, se pueden indicar múltiples máscaras de archivo: www,fb2p_free.dbf +* DBF_Conversion_Excluded: && If DBF_Conversion_Support:4, you can specify mnultiple filemasks: www,fb2p_free.dbf / Si DBF_Conversion_Support:4, se pueden indicar múltiples máscaras de archivo: www,fb2p_free.dbf * * EN: Note: This values have precedence over internal parameters and parameters used on scripts * ES: Nota: Estos valores tienen precedencia sobre los parámetros internos y los parámetros usados en los scripts @@ -35,6 +38,9 @@ **************************************************************************************************** +**************************************************************************************************** +* YOU CAN MODIFY FROM HERE! / PUEDE MODIFICAR DESDE AQUÍ! + * EN: Uncomment for SourceSafe compatibility. You can change the extension on the right side. * ES: Descomentar para compatibilidad con SourceSafe. Puede cambiar la extensión del lado derecho. *--------------------------------------------------------------------------------------------------- @@ -47,30 +53,3 @@ *extension: db2=dba *extension: dc2=dca - -* EN: Uncomment to activate the new value, comment to deactivate and use the default -* ES: Descomente para activar el nuevo valor, comente para desactivarlo y usar el predeterminado -*--------------------------------------------------------------------------------------------------- -*DontShowProgress: 1 -*DontShowErrors: 1 -*NoTimestamps: 0 -*Debug: 1 -*ExtraBackupLevels: 0 -*ClearUniqueID: 0 -*OptimizeByFilestamp: 0 -*AllowMultiConfig: 0 -*DropNullCharsFromCode: 0 - - -* EN: Uncomment to activate the new value, comment to deactivate and use the default -* ES: Descomente para activar el nuevo valor, comente para desactivarlo y usar el predeterminado -* 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) -*--------------------------------------------------------------------------------------------------- -*PJX_Conversion_Support: 2 -*VCX_Conversion_Support: 2 -*SCX_Conversion_Support: 2 -*FRX_Conversion_Support: 2 -*LBX_Conversion_Support: 2 -*MNX_Conversion_Support: 2 -*DBC_Conversion_Support: 2 -*DBF_Conversion_Support: 2 diff --git a/foxbin2prg.exe b/foxbin2prg.exe index 459d3d2..608d912 100644 Binary files a/foxbin2prg.exe and b/foxbin2prg.exe differ diff --git a/foxbin2prg.pj2 b/foxbin2prg.pj2 index d8c1e4f..b132a4e 100644 --- a/foxbin2prg.pj2 +++ b/foxbin2prg.pj2 @@ -23,10 +23,10 @@ _CompanyName = "Fernando D. Bozzo" _FileDescription = "Conversor bidireccional de binarios FoxPro 9 (scx,vcx,pjx) a texto para sustituir al scctext :-)" _LegalCopyright = "Creative Commons 4: Reconocimiento - CompartirIgual (by-sa): http://creativecommons.org/licenses/by/4.0/" _LegalTrademark = "Creative Commons 4: Reconocimiento - CompartirIgual (by-sa): http://creativecommons.org/licenses/by/4.0/" -_ProductName = " FOXBIN2PRG v1.19.27" +_ProductName = " FOXBIN2PRG v1.19.28" _MajorVer = "1" _MinorVer = "19" -_Revision = "27" +_Revision = "28" _LanguageID = "1034" _AutoIncrement = "0" * diff --git a/foxbin2prg.pjt b/foxbin2prg.pjt index 704b77e..ca38851 100644 Binary files a/foxbin2prg.pjt and b/foxbin2prg.pjt differ diff --git a/foxbin2prg.pjx b/foxbin2prg.pjx index 185998c..030188a 100644 Binary files a/foxbin2prg.pjx and b/foxbin2prg.pjx differ diff --git a/foxbin2prg.prg b/foxbin2prg.prg index 5cd6a9f..e14cd3f 100644 --- a/foxbin2prg.prg +++ b/foxbin2prg.prg @@ -94,6 +94,7 @@ * 27/06/2014 FDBOZZO v1.19.26 Mejora: Si el campo memo "methods" de los vcx/scx contiene asteriscos fuera de lugar (que no debería), FoxBin2Prg lo procesa igualmente. (Daniel Sánchez) * 06/07/2014 FDBOZZO v1.19.26 Bug Fix cfg: ExtraBackupLevel no se tiene en cuenta cuando se usa multi-configuración * 02/06/2014 DH/FDBOZZO v1.19.27 Mejora: Agregado soporte para exportar datos para DIFF (no para importar) +* 21/07/2014 FDBOZZO v1.19.28 Mejora: Agregada funcionalidad para filtrado de tablas y datos cuando se elige DBF_Conversion_Support:4 (Edyshor) * * *--------------------------------------------------------------------------------------------------- @@ -131,6 +132,7 @@ * 02/07/2014 Matt Slay MEJORA v1.19.25: Se filtran algunos CHR(0) de los binarios al tx2, provocando que a veces no sea reconocido como texto. Deberían poderse quitar los NULLs (Arreglado en v1.19.26) * 27/06/2014 Daniel Sánchez MEJORA v1.19.25: Si el campo memo "methods" de los vcx/scx contiene asteriscos fuera de lugar (que no debería), FoxBin2Prg falla. Debería poder procesarlo igual. * 02/06/2014 Doug Hennig MEJORA v1.19.22: Agregada funcionalidad para exportar los datos de las tablas al archivo db2 (Agregado en v1.19.27) +* 21/07/2014 Edyshor PROPUESTA DE MEJORA db2 v1.19.27: Sería útil poder filtrar tablas y datos cuando se elige DBF_Conversion_Support:4 (Agregado en v1.19.28) * * *--------------------------------------------------------------------------------------------------- @@ -451,6 +453,7 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM + [] ; + [] ; + [] ; + + [] ; + [] ; + [] ; + [] ; @@ -492,6 +495,8 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM + [] ; + [] ; + [] ; + + [] ; + + [] ; + [] ; + [] ; + [] ; @@ -566,6 +571,8 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM MNX_Conversion_Support = 2 DBF_Conversion_Support = 1 DBC_Conversion_Support = 2 + DBF_Conversion_Included = '' + DBF_Conversion_Excluded = '' PROCEDURE INIT @@ -832,6 +839,24 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM ENDPROC + PROCEDURE DBF_Conversion_Included_ACCESS + IF THIS.n_CFG_Actual = 0 OR ISNULL( THIS.o_Configuration( THIS.n_CFG_Actual ) ) + RETURN THIS.DBF_Conversion_Included + ELSE + RETURN NVL( THIS.o_Configuration( THIS.n_CFG_Actual ).DBF_Conversion_Included, THIS.DBF_Conversion_Included ) + ENDIF + ENDPROC + + + PROCEDURE DBF_Conversion_Excluded_ACCESS + IF THIS.n_CFG_Actual = 0 OR ISNULL( THIS.o_Configuration( THIS.n_CFG_Actual ) ) + RETURN THIS.DBF_Conversion_Excluded + ELSE + RETURN NVL( THIS.o_Configuration( THIS.n_CFG_Actual ).DBF_Conversion_Excluded, THIS.DBF_Conversion_Excluded ) + ENDIF + ENDPROC + + PROCEDURE DBC_Conversion_Support_ACCESS IF THIS.n_CFG_Actual = 0 OR ISNULL( THIS.o_Configuration( THIS.n_CFG_Actual ) ) RETURN THIS.DBC_Conversion_Support @@ -1127,7 +1152,7 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM lcValue = ALLTRIM( SUBSTR( laConfig(I), 18 ) ) IF NOT INLIST( TRANSFORM(tcDontShowProgress), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcDontShowProgress = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDontShowProgress: ' + TRANSFORM(tcDontShowProgress) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDontShowProgress: ' + TRANSFORM(tcDontShowProgress) ) ENDIF CASE LEFT( laConfig(I), 15 ) == LOWER('DontShowErrors:') @@ -1136,112 +1161,126 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM lcValue = ALLTRIM( SUBSTR( laConfig(I), 16 ) ) IF NOT INLIST( TRANSFORM(tcDontShowErrors), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcDontShowErrors = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDontShowErrors: ' + TRANSFORM(tcDontShowErrors) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDontShowErrors: ' + TRANSFORM(tcDontShowErrors) ) ENDIF CASE LEFT( laConfig(I), 13 ) == LOWER('NoTimestamps:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 14 ) ) IF NOT INLIST( TRANSFORM(tcNoTimestamps), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcNoTimestamps = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > tcNoTimestamps: ' + TRANSFORM(tcNoTimestamps) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > tcNoTimestamps: ' + TRANSFORM(tcNoTimestamps) ) ENDIF CASE LEFT( laConfig(I), 6 ) == LOWER('Debug:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 7 ) ) IF NOT INLIST( TRANSFORM(tcDebug), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcDebug = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDebug: ' + TRANSFORM(tcDebug) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > tcDebug: ' + TRANSFORM(tcDebug) ) ENDIF CASE LEFT( laConfig(I), 18 ) == LOWER('ExtraBackupLevels:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 19 ) ) IF NOT ISDIGIT( TRANSFORM(tcExtraBackupLevels) ) AND ISDIGIT( lcValue ) THEN tcExtraBackupLevels = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > tcExtraBackupLevels: ' + TRANSFORM(tcExtraBackupLevels) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > tcExtraBackupLevels: ' + TRANSFORM(tcExtraBackupLevels) ) ENDIF CASE LEFT( laConfig(I), 14 ) == LOWER('ClearUniqueID:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 15 ) ) IF NOT INLIST( TRANSFORM(tcClearUniqueID), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcClearUniqueID = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > ClearUniqueID: ' + TRANSFORM(lcValue) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > ClearUniqueID: ' + TRANSFORM(lcValue) ) ENDIF CASE LEFT( laConfig(I), 20 ) == LOWER('OptimizeByFilestamp:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 21 ) ) IF NOT INLIST( TRANSFORM(tcOptimizeByFilestamp), '0', '1' ) AND INLIST( lcValue, '0', '1' ) THEN tcOptimizeByFilestamp = lcValue - .writeLog( JUSTFNAME(lcConfigFile) + ' > OptimizeByFilestamp: ' + TRANSFORM(lcValue) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > OptimizeByFilestamp: ' + TRANSFORM(lcValue) ) ENDIF CASE LEFT( laConfig(I), 17 ) == LOWER('AllowMultiConfig:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 18 ) ) IF INLIST( lcValue, '0', '1' ) THEN .l_AllowMultiConfig = ( TRANSFORM(lcValue) == '1' ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > AllowMultiConfig: ' + TRANSFORM(lcValue) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > AllowMultiConfig: ' + TRANSFORM(lcValue) ) ENDIF CASE LEFT( laConfig(I), 22 ) == LOWER('DropNullCharsFromCode:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 23 ) ) IF INLIST( lcValue, '0', '1' ) THEN .l_DropNullCharsFromCode = ( TRANSFORM(lcValue) == '1' ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > DropNullCharsFromCode: ' + TRANSFORM(lcValue) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > DropNullCharsFromCode: ' + TRANSFORM(lcValue) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('PJX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.PJX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > PJX_Conversion_Support: ' + TRANSFORM(lo_CFG.PJX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > PJX_Conversion_Support: ' + TRANSFORM(lo_CFG.PJX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('VCX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.VCX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > VCX_Conversion_Support: ' + TRANSFORM(lo_CFG.VCX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > VCX_Conversion_Support: ' + TRANSFORM(lo_CFG.VCX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('SCX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.SCX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > SCX_Conversion_Support: ' + TRANSFORM(lo_CFG.SCX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > SCX_Conversion_Support: ' + TRANSFORM(lo_CFG.SCX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('FRX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.FRX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > FRX_Conversion_Support: ' + TRANSFORM(lo_CFG.FRX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > FRX_Conversion_Support: ' + TRANSFORM(lo_CFG.FRX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('LBX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.LBX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > LBX_Conversion_Support: ' + TRANSFORM(lo_CFG.LBX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > LBX_Conversion_Support: ' + TRANSFORM(lo_CFG.LBX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('MNX_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.MNX_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > MNX_Conversion_Support: ' + TRANSFORM(lo_CFG.MNX_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > MNX_Conversion_Support: ' + TRANSFORM(lo_CFG.MNX_Conversion_Support) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('DBF_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2', '4' ) THEN lo_CFG.DBF_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > DBF_Conversion_Support: ' + TRANSFORM(lo_CFG.DBF_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > DBF_Conversion_Support: ' + TRANSFORM(lo_CFG.DBF_Conversion_Support) ) + ENDIF + + CASE LEFT( laConfig(I), 24 ) == LOWER('DBF_Conversion_Included:') + lcValue = ALLTRIM( SUBSTR( laConfig(I), 25 ) ) + IF NOT EMPTY(lcValue) THEN + lo_CFG.DBF_Conversion_Included = lcValue + .writeLog( JUSTFNAME(lcConfigFile) + ' > DBF_Conversion_Included: ' + TRANSFORM(lo_CFG.DBF_Conversion_Included) ) + ENDIF + + CASE LEFT( laConfig(I), 24 ) == LOWER('DBF_Conversion_Excluded:') + lcValue = ALLTRIM( SUBSTR( laConfig(I), 25 ) ) + IF NOT EMPTY(lcValue) THEN + lo_CFG.DBF_Conversion_Excluded = lcValue + .writeLog( JUSTFNAME(lcConfigFile) + ' > DBF_Conversion_Excluded: ' + TRANSFORM(lo_CFG.DBF_Conversion_Excluded) ) ENDIF CASE LEFT( laConfig(I), 23 ) == LOWER('DBC_Conversion_Support:') lcValue = ALLTRIM( SUBSTR( laConfig(I), 24 ) ) IF INLIST( lcValue, '0', '1', '2' ) THEN lo_CFG.DBC_Conversion_Support = INT( VAL( lcValue ) ) - .writeLog( JUSTFNAME(lcConfigFile) + ' > DBC_Conversion_Support: ' + TRANSFORM(lo_CFG.DBC_Conversion_Support) ) + .writeLog( JUSTFNAME(lcConfigFile) + ' > DBC_Conversion_Support: ' + TRANSFORM(lo_CFG.DBC_Conversion_Support) ) ENDIF ENDCASE @@ -1329,6 +1368,28 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM ENDPROC + FUNCTION FilenameFoundInFilter + *--------------------------------------------------------------------------------------------------- + * PARÁMETROS: (v=Pasar por valor | @=Pasar por referencia) (!=Obligatorio | ?=Opcional) (IN/OUT) + * tcFilename (v! IN ) Nombre del archivo a evaluar + * tcFilters (v! IN ) Filtros a evaluar (*,??E.*,R*.*) + *--------------------------------------------------------------------------------------------------- + LPARAMETERS tcFilename, tcFilters + + LOCAL llFound, laFiltros(1) + tcFilename = UPPER(tcFilename) + + FOR I = 1 TO ALINES( laFiltros, tcFilters + ',', 1+4, ',' ) + IF LIKE( UPPER(laFiltros(I)), tcFilename ) + llFound = .T. + EXIT + ENDIF + ENDFOR + + RETURN llFound + ENDFUNC + + PROCEDURE Get_Ext2FromExt LPARAMETERS tcExt LOCAL lcExt2 @@ -11131,7 +11192,7 @@ DEFINE CLASS c_conversor_dbf_a_prg AS c_conversor_bin_a_prg DODEFAULT( @toModulo, @toEx ) TRY - LOCAL lnCodError, laDatabases(1), lnDatabases_Count, laDatabases2(1), lnLen, lc_FileTypeDesc ; + LOCAL lnCodError, laDatabases(1), lnDatabases_Count, laDatabases2(1), lnLen, lc_FileTypeDesc, laLines(1) ; , ln_HexFileType, ll_FileHasCDX, ll_FileHasMemo, ll_FileIsDBC, lc_DBC_Name, lnDataSessionID, lnSelect ; , loTable AS CL_DBF_TABLE OF 'FOXBIN2PRG.PRG' ; , loDBFUtils AS CL_DBF_UTILS OF 'FOXBIN2PRG.PRG' @@ -11140,6 +11201,22 @@ DEFINE CLASS c_conversor_dbf_a_prg AS c_conversor_bin_a_prg loDBFUtils = CREATEOBJECT('CL_DBF_UTILS') WITH THIS AS c_conversor_dbf_a_prg OF 'FOXBIN2PRG.PRG' + *-- EVALUAR OPCIONES ESPECÍFICAS DE DBF + + *-- Include + IF NOT EMPTY(toFoxBin2Prg.DBF_Conversion_Included) AND NOT toFoxBin2Prg.DBF_Conversion_Included == '*' ; + AND NOT toFoxBin2Prg.FilenameFoundInFilter( JUSTFNAME(.c_InputFile), toFoxBin2Prg.DBF_Conversion_Included ) + toFoxBin2Prg.writeLog(' ' + JUSTFNAME(.c_InputFile) + ' no está en el filtro DBF_Conversion_Included (' + toFoxBin2Prg.DBF_Conversion_Included + ')' ) + EXIT + ENDIF + + *-- Exclude + IF NOT EMPTY(toFoxBin2Prg.DBF_Conversion_Excluded) ; + AND toFoxBin2Prg.FilenameFoundInFilter( JUSTFNAME(.c_InputFile), toFoxBin2Prg.DBF_Conversion_Excluded ) + toFoxBin2Prg.writeLog(' ' + JUSTFNAME(.c_InputFile) + ' está en el filtro DBF_Conversion_Excluded (' + toFoxBin2Prg.DBF_Conversion_Excluded + ')' ) + EXIT + ENDIF + loDBFUtils.getDBFmetadata( .c_InputFile, @ln_HexFileType, @ll_FileHasCDX, @ll_FileHasMemo, @ll_FileIsDBC, @lc_DBC_Name ) lc_FileTypeDesc = loDBFUtils.fileTypeDescription(ln_HexFileType) lnDatabases_Count = ADATABASES(laDatabases) @@ -15900,7 +15977,9 @@ DEFINE CLASS CL_DBF_TABLE AS CL_CUS_BASE #ENDIF TRY - LOCAL lcText, lcTableCFG, lcIndexKey, lcIndexFile, loEx AS EXCEPTION ; + LOCAL lcText, lcTableCFG, lcIndexKey, lcIndexFile, laConfig(1), lcValue, lcConfigItem ; + , lc_DBF_Conversion_Order, lc_DBF_Conversion_Condition ; + , loEx AS EXCEPTION ; , loRecords AS CL_DBF_RECORDS OF 'FOXBIN2PRG.PRG' ; , loFields AS CL_DBF_FIELDS OF 'FOXBIN2PRG.PRG' ; , loIndexes AS CL_DBF_INDEXES OF 'FOXBIN2PRG.PRG' @@ -15932,24 +16011,43 @@ DEFINE CLASS CL_DBF_TABLE AS CL_CUS_BASE lcText = lcText + loIndexes.toText( '', '', tc_InputFile ) IF toFoxBin2Prg.DBF_Conversion_Support = 4 && BIN2PRG (DATA EXPORT FOR DIFF) - *-- If table CFG exists, use it to order records. FDBOZZO. 2014/06/15 + *-- If table CFG exists, use it for DBF-specific configuration. FDBOZZO. 2014/06/15 lcTableCFG = tc_InputFile + '.CFG' IF FILE(lcTableCFG) toFoxBin2Prg.writeLog() toFoxBin2Prg.writeLog('* Found configuration file: ' + lcTableCFG) - lcIndexKey = ALLTRIM( FILETOSTR(lcTableCFG), 0, ' ', CHR(13), CHR(10) ) - IF NOT EMPTY(lcIndexKey) + *-- Leer valores de configuración + FOR I = 1 TO ALINES( laConfig, FILETOSTR( lcTableCFG ), 1+4 ) + lcConfigItem = LOWER( laConfig(I) ) + + DO CASE + CASE INLIST( LEFT( lcConfigItem, 1 ), '*', '#', '/', "'" ) + LOOP + + CASE LEFT( lcConfigItem, 21 ) == LOWER('DBF_Conversion_Order:') + lc_DBF_Conversion_Order = ALLTRIM( SUBSTR( laConfig(I), 22 ) ) + toFoxBin2Prg.writeLog(' ' + JUSTFNAME(lcTableCFG) + ' -> DBF_Conversion_Order: ' + lc_DBF_Conversion_Order ) + + CASE LEFT( lcConfigItem, 25 ) == LOWER('DBF_Conversion_Condition:') + lc_DBF_Conversion_Condition = ALLTRIM( SUBSTR( laConfig(I), 26 ) ) + toFoxBin2Prg.writeLog(' ' + JUSTFNAME(lcTableCFG) + ' -> DBF_Conversion_Condition: ' + lc_DBF_Conversion_Condition ) + + ENDCASE + ENDFOR + + IF NOT EMPTY(lc_DBF_Conversion_Order) lcIndexFile = FORCEEXT(tc_InputFile,'IDX') - INDEX ON &lcIndexKey. TO (lcIndexFile) COMPACT - toFoxBin2Prg.writeLog(' > Using Index order key: ' + lcIndexKey) + INDEX ON &lc_DBF_Conversion_Order. TO (lcIndexFile) COMPACT + toFoxBin2Prg.writeLog(' > Using Index order key: ' + lc_DBF_Conversion_Order) ENDIF + ENDIF *** DH 06/02/2014: added _Records loRecords = THIS._Records - lcText = lcText + loRecords.toText(@laFields, lnFieldCount) + lcText = lcText + loRecords.toText(@laFields, lnFieldCount, lc_DBF_Conversion_Condition) ENDIF @@ -16548,11 +16646,12 @@ DEFINE CLASS CL_DBF_RECORDS AS CL_COL_BASE PROCEDURE toText *--------------------------------------------------------------------------------------------------- - * PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT) - * taFields (@! IN ) Array de información de campos - * tnField_Count (v! IN ) Cantidad de campos + * PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT) + * taFields (@! IN ) Array de información de campos + * tnField_Count (v! IN ) Cantidad de campos + * tc_DBF_Conversion_Condition (v? IN ) Condición de filtro para la conversión. Solo se exporta lo que la cumpla. *--------------------------------------------------------------------------------------------------- - LPARAMETERS taFields, tnField_Count + LPARAMETERS taFields, tnField_Count, tc_DBF_Conversion_Condition EXTERNAL ARRAY taFields @@ -16567,8 +16666,12 @@ DEFINE CLASS CL_DBF_RECORDS AS CL_COL_BASE ENDTEXT loRecord = CREATEOBJECT('CL_DBF_RECORD') + + IF EMPTY(tc_DBF_Conversion_Condition) + tc_DBF_Conversion_Condition = '.T.' + ENDIF - SCAN + SCAN FOR &tc_DBF_Conversion_Condition. lcText = lcText + loRecord.toText(@taFields, tnField_Count) ENDSCAN @@ -16579,6 +16682,7 @@ DEFINE CLASS CL_DBF_RECORDS AS CL_COL_BASE CATCH TO loEx + loEx.UserValue = loEx.UserValue + 'tc_DBF_Conversion_Condition = [' + TRANSFORM(tc_DBF_Conversion_Condition) + ']' + CR_LF IF THIS.l_Debug AND _VFP.STARTMODE = 0 SET STEP ON ENDIF @@ -19644,6 +19748,8 @@ DEFINE CLASS CL_CFG AS CUSTOM + [] ; + [] ; + [] ; + + [] ; + + [] ; + [] ; + [] @@ -19652,7 +19758,7 @@ DEFINE CLASS CL_CFG AS CUSTOM #ENDIF - *-- + *-- Configuration class. By default asumes master value, except when overriding one. c_Foxbin2prg_FullPath = '' c_Foxbin2prg_ConfigFile = '' c_CurDir = '' @@ -19679,6 +19785,8 @@ DEFINE CLASS CL_CFG AS CUSTOM LBX_Conversion_Support = NULL MNX_Conversion_Support = NULL DBF_Conversion_Support = NULL + DBF_Conversion_Included = NULL + DBF_Conversion_Excluded = NULL DBC_Conversion_Support = NULL