PROBLEMA CON FORMATO DE FECHA MYSQL ADO

PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Thu Oct 27, 2022 2: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby nageswaragunupudi » Thu Oct 27, 2022 12:43 pm

Looks like the field "DATE" was actually created with type DATETIME or TIMESTAMP.
To Check:
Code: Select all  Expand view
? 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: Select all  Expand view
  oRs := oAdoCon:Execute( "SHOW CREATE  TABLE <yourtablename>" )
   FW_MEMOEDIT( oRs:Fields( 1 ):Value )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Thu Oct 27, 2022 1: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Thu Oct 27, 2022 6: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Sat Oct 29, 2022 1: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Antonio Linares » Sat Oct 29, 2022 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Sun Oct 30, 2022 1: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby nageswaragunupudi » Sat Nov 05, 2022 2: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: Select all  Expand view
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: Select all  Expand view
#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:
Image

XHARBOUR:
Image

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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Sat Nov 05, 2022 3: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby nageswaragunupudi » Sat Nov 05, 2022 4: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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby Marco Augusto » Sun Nov 06, 2022 3: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
User avatar
Marco Augusto
 
Posts: 141
Joined: Wed Oct 12, 2005 1:03 pm
Location: Cuernacava, Morelos Mexico

Re: PROBLEMA CON FORMATO DE FECHA MYSQL ADO

Postby nageswaragunupudi » Sun Nov 06, 2022 5: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
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests