FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Thu Oct 27, 2022 02:02 AM
ACTUALICE A LA ULTIMA VERSION DE FWH32

UTILIZO MYSQL VIA ADO

TODAS LA FECHAS EN LAS TABLAS
LAS TENGO DEFINIDAS COMO TIPO DATE


SIN EMBARGO AL MOSTRAR
UNA FECHA ME APARECE CON FORMATO FECHA -HORA

POR EJEMPLO:

? TRANS(oMOV:FIELDS("FECHA"):VALUE,"@E") // RESULTADO 11/08/2022 00:00:00.000

? VALTYPE(oMOV:FIELDS("FECHA"):VALUE) // RESULTADO T
Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Thu Oct 27, 2022 12:43 PM
Looks like the field "DATE" was actually created with type DATETIME or TIMESTAMP.
To Check:
Code (fw): Select all Collapse
? oMov:Fields( "DATE" ):Type
if the result is 7 or 133 , the field is of "DATE" type or if 135, it is TIMESTAMP or DATETIME.

Also, you can see the actual SQL that created this table, you can do this:
Code (fw): Select all Collapse
 聽 oRs := oAdoCon:Execute( "SHOW CREATE 聽TABLE <yourtablename>" )
聽 聽FW_MEMOEDIT( oRs:Fields( 1 ):Value )
Regards



G. N. Rao.

Hyderabad, India
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Thu Oct 27, 2022 01:20 PM

El resultado de

oMOV:FIELDS("FECHA"):VALUE // 133

la estructura de la tabla

Field Type Null Key Default Extra

LLAVE varchar(20) NO PRI

PERIODO varchar(6) YES MUL

POLIZA varchar(13) YES MUL

CONCEPTO varchar(100) YES

CARGOS decimal(14,2) YES 0

ABONOS decimal(14,2) YES 0

FECHA date NO MUL

FECHACAP date NO

HORA varchar(8) NO

CONCEPTO2 varchar(100) YES

FECHA2 date YES 0000-00-00

Anteriormente usaba versiones de FWH de 2010 (no recuerdo el mes)

y no ten铆a ese problema

En la versi贸n de FWH enero 2020 ya se presentaba el problema

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Thu Oct 27, 2022 06:44 PM

OK

oRs := oAdoCon:Execute( "SHOW CREATE TABLE <yourtablename>" )

FW_MEMOEDIT( oRs:Fields( 1 ):Value )

CREATE TABLE polizas (

LLAVE varchar(20) NOT NULL default '',

PERIODO varchar(6) default ' ',

POLIZA varchar(13) default ' ',

CONCEPTO varchar(100) default ' ',

CARGOS decimal(14,2) default '0.00',

ABONOS decimal(14,2) default '0.00',

FECHA date NOT NULL,

FECHACAP date NOT NULL,

HORA varchar(8) NOT NULL,

CONCEPTO2 varchar(100) default ' ',

FECHA2 date default '0000-00-00',

PRIMARY KEY (LLAVE),

KEY Index_2 (PERIODO),

KEY Index_3 (POLIZA),

KEY Index_4 (FECHA)

) ENGINE=InnoDB DEFAULT CHARSET=latin1

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sat Oct 29, 2022 01:03 PM

驴No hay soluci贸n a este problema?

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sat Oct 29, 2022 04:26 PM

Temporalmente podrias usar esto:

? SubStr( TRANS(oMOV:FIELDS("FECHA"):VALUE,"@E"), 1, 10 )

Que te muestra oMOV:FIELDS("FECHA"):VALUE ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sun Oct 30, 2022 01:02 AM

Saludos

Por supuesto que hay forma de corregirlo

pero implica modificar todas las llamadas a fechas

en todos los sistemas que quiera compilar con esta nueva versi贸n

function cfecha(dFE)

RETURN (fw_ttod(dFE))

El problema est谩 en que el campo est谩 definido en la tabla como tipo DATE

y lo toma como DATETIME

Y eso no suced铆a en la versi贸n que ven铆a utilizando en enero de 2010

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sat Nov 05, 2022 02:40 AM
The real problem is with xHarbour.
Harbour produces correct results.

For your information, FWH does not have to do anything at all with this code
Code (fw): Select all Collapse
oRs:Fields( xx ):Value
// or
ValType( oRs:Fields( xx ):Value )
This code is entirely executed by the OLE functions of (x)Harbour.
So, the results will be the same, whichever version of FWH you use.

We can confirm this by executing this sample program both with Harbour and xHarbour.
This test is done on a Cloud server belonging to FW and all of us can connect to this server.
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

聽 聽local oCn, oRs

聽 聽SET DATE ITALIAN
聽 聽SET CENTURY ON
聽 聽SET TIME FORMAT TO "HH:MM:SS"

聽 聽oCn 聽 := FW_OpenAdoConnection( { "MYSQL", "209.250.245.152","fwh","fwhuser","FiveTech@2022" }, .t. )
聽 聽if oCn == nil
聽 聽 聽 ? "Connect fail"
聽 聽 聽 return nil
聽 聽else
聽 聽 聽 ? "Connected"
聽 聽endif

聽 聽if FW_AdoTableExists( "ado_dates", oCn )
聽 聽 聽 oCn:Execute( "DROP TABLE `ado_dates`" )
聽 聽endif

聽 聽FWAdoCreateTable( "ado_dates", { ;
聽 聽 聽 { "FLD_CHAR", "C", 10, 0 }, ;
聽 聽 聽 { "FLD_DATE", "D", 聽8, 0 }, ;
聽 聽 聽 { "FLD_DTIME","T", 聽8, 0 } }, oCn )

聽 聽oRs 聽 := oCn:Execute( "SHOW CREATE TABLE `ado_dates`" )
聽 聽FW_MEMOEDIT( oRs:Fields( 1 ):Value )
聽 聽oRs:Close()

聽 聽oRs 聽 := FW_OpenRecordSet( oCn, "ado_dates" )
聽 聽oRs:AddNew( { "fld_char", "fld_date", "fld_dtime" }, ;
聽 聽 聽 聽 聽 聽 聽 聽{ "one", Date(), DateTime() } )

聽 聽XBROWSER oRs FASTEDIT

聽 聽? 聽"Compiler = " + Version(), ;
聽 聽 聽 "======================", ;
聽 聽 聽 "FLD_DATE", ;
聽 聽 聽 oRs:Fields( "fld_date" ):Value, ;
聽 聽 聽 ValType( oRs:Fields( "fld_date" ):Value ), ;
聽 聽 聽 oRs:Fields( "fld_date" ):Type, ;
聽 聽 聽 "----------", ;
聽 聽 聽 "FLD_DATIME", ;
聽 聽 聽 oRs:Fields( "fld_dtime" ):Value, ;
聽 聽 聽 ValType( oRs:Fields( "fld_dtime" ):Value ), ;
聽 聽 聽 oRs:Fields( "fld_dtime" ):Type

聽 聽oRs:Close()
聽 聽oCn:Close()

return nil
Results:
HARBOUR:


XHARBOUR:


I have not checked with later versions of xHarbour. Worth checking, if the issue is fixed in later versions of xHarbour.
Regards



G. N. Rao.

Hyderabad, India
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sat Nov 05, 2022 03:30 PM

gracias por la atenci贸n

en la versi贸n xharbour con la que no

hab铆a problema era de 2010-06-23 build 1.2.1

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sat Nov 05, 2022 04:35 PM
Marco Augusto wrote:gracias por la atenci贸n

en la versi贸n xharbour con la que no
hab铆a problema era de 2010-06-23 build 1.2.1
Did you test with that old version now?
Do you still have that old version?
Regards



G. N. Rao.

Hyderabad, India
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sun Nov 06, 2022 03:34 PM

Con Xharbour BUILD 1.2.1, FWH SEPTEMBER,2010 y BCC582

tengo muchos sistemas funcionando correctamente

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO
Posted: Sun Nov 06, 2022 05:20 PM

Do you have xHarbour 1.2.1 now?

Can you build the above sample with 1.2.1?

Let us assure you 100% that FWH has nothing do at all with this issue.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion