FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Mysql y tipo de dato decimal
Posts: 0
Joined: unknown
Mysql y tipo de dato decimal
Posted: Tue Jul 14, 2020 03:00 PM

Hola buen día, hace días que estoy tratando de ver porque no puedo abrir tablas con tipo de datos decimal.

Que me falta hacer?

Tengo varios clientes con sqlserver y nunca tuve problemas para leer las tablas.

La comunicación la realizo con ado.

Estoy queriendo ver las diferencias de trabajar con mysql y sqlserver.

Saludos.
Jorge.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Mysql y tipo de dato decimal
Posted: Tue Jul 14, 2020 04:40 PM

You can definitely read decimal data type also from mysql tables with ADO.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Mysql y tipo de dato decimal
Posted: Tue Jul 14, 2020 05:33 PM
Simple test:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn, oRs

   ? "Connecting to FWH cloud server"

   oCn   := FW_OpenAdoConnection( "MYSQL,208.91.198.197,fwhdemo,gnraofwh,Bharat@1950", .t. )
   if oCn == nil
      ? "Connect fail"
      return nil
   endif
   ? "Connected." + CRLF + "Reading structure of customer table"

   oRs   := FW_OpenRecordSet( oCn, "SHOW COLUMNS FROM customer" )
   XBROWSER oRs TITLE "customer table : columns"
   oRs:Close()

   ? "Reading customer table"
   oRs   := FW_OpenRecordSet( oCn, "customer" )
   WITH OBJECT oRs:Fields( "salary" )
      ? :Type, :Precision, :NumericScale // Result: 131 (adNumeric), 8, 2
   END
   XBROWSER oRs

   oRs:Close()
   oCn:Close()

return nil


Anyone having FWH (not very old version) can build this sample and run from any computer having internet connection.





Regards



G. N. Rao.

Hyderabad, India
Posts: 0
Joined: unknown
Re: Mysql y tipo de dato decimal
Posted: Wed Jul 15, 2020 01:59 PM

Buen día, no funciona, hice la prueba con sqlserver y funciona bien:

include "fivewin.ch"

function Main()

local oCn, oRs

msgrun( "Connecting to FWH cloud server")
oCn := FW_OpenAdoConnection( "MYSQL,localhost,rj,root,1234", .t. ) // con esta conexión no trae la tabla
* oCn := FW_OpenAdoConnection( "SQLSERVER,desarrollo\sqlexpress,rj,sa,1234", .t. ) // con esta conexión la trae perfecto tabla
if oCn == nil
? "Connect fail"
return nil
endif
msgrun( "Connected." + CRLF + "Reading structure of customer table")

  • oRs := FW_OpenRecordSet( oCn, "SHOW COLUMNS FROM clientes" )
  • XBROWSER oRs TITLE "customer table : columns"
  • oRs:Close()

msgrun( "Reading customer table")
oRs := FW_OpenRecordSet( oCn, "select * from clientes" )
XBROWSER oRs

oRs:Close()
oCn:Close()

return nil

Tengo fwh1709, con xharbour7, mysql server 8.0

Tengo una tabla sin campos decimal y lee perfecto.

Saludos.
Jorge

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Mysql y tipo de dato decimal
Posted: Wed Jul 15, 2020 04:52 PM

First, please clarify whether it worked with customer table on the Cloud server?

Depending on your answer, we can help you with your table on your own server.

Regards



G. N. Rao.

Hyderabad, India
Posts: 0
Joined: unknown
Re: Mysql y tipo de dato decimal
Posted: Thu Jul 16, 2020 12:44 PM

Con el ejemplo que enviaste, se conecta.

oCn := FW_OpenAdoConnection( "MYSQL,208.91.198.197,fwhdemo,gnraofwh,Bharat@1950", .t. )

oRs := FW_OpenRecordSet( oCn, "SHOW COLUMNS FROM customer" )
XBROWSER oRs TITLE "customer table : columns"
oRs:Close()

muestra bien la estructura

WITH OBJECT oRs:Fields( "salary" )
? :Type, :Precision, :NumericScale // Result: 131 (adNumeric), 8, 2
END
me muestra los datos ok.

XBROWSER oRs

pero no muestra el contenido de la tabla

Saludos
Jorge.

Continue the discussion