bug FWAdoFieldType [urgent]

bug FWAdoFieldType [urgent]

Postby MOISES » Thu Mar 19, 2020 11:55 am

Hi,

This function with DateTime fields wrongly retrieves such field type as D, but should be T in Access.

Thank you.
Last edited by MOISES on Wed Mar 25, 2020 7:21 am, edited 1 time in total.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby MOISES » Thu Mar 19, 2020 12:48 pm

function FieldTypeAdoToDbf( nType ) fails too, in Access and MYSQL.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby nageswaragunupudi » Thu Mar 19, 2020 2:19 pm

MOISES wrote:Hi,
but should be T in Access.

What is the field type in Acess for Only Date in Access? Field type that does not contain time part?
If a programmer wants to store only Dates what field type he has to choose other than DateTime?
Regards

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

Re: bug FWAdoFieldType

Postby MOISES » Thu Mar 19, 2020 3:24 pm

The field is defined in Access as DateTime, but if it only stores a date FWAdoFieldType returns D.

If it also has date and time, FWAdoFieldType returns T.

FieldTypeAdoToDbf fails alwawys.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby MOISES » Sun Mar 22, 2020 6:47 pm

Any clue please?

Thank you.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby Rick Lipkin » Mon Mar 23, 2020 1:14 pm

MOISES

Try this simple test on Ms Access or Ms Sql Server .. Valtype() on an ado fieldtype datetime should always equal T

Code: Select all  Expand view

dDate := oRs:Fields("Date"):Value      // assumes the ado field type = DateTime

cType := Valtype( dDate )

MsgInfo( cType )
cType should = T  

 


Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2663
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: bug FWAdoFieldType

Postby MOISES » Mon Mar 23, 2020 5:18 pm

No, it returns "D", when the field is empty or has a date only.

"T" is returned when the field has a datetime inside.

Thank you,
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby nageswaragunupudi » Mon Mar 23, 2020 6:02 pm

MOISES wrote:Hi,

This function with DateTime fields wrongly retrieves such field type as D, but should be T in Access.

Thank you.

This function is intended for internal use.
You may not use it. Even if you use it, if you get the value is "D", then you further check if the particular value is D or T.
Regards

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

Re: bug FWAdoFieldType

Postby MOISES » Mon Mar 23, 2020 6:10 pm

Thank you for your time.

So, how can I get the field type as "T", irrespective of if its empty or full?
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType

Postby MOISES » Wed Mar 25, 2020 7:21 am

Up, thank you.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType [urgent]

Postby MOISES » Mon Mar 30, 2020 10:59 am

Any clue please?

Thank you.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: bug FWAdoFieldType [urgent]

Postby Enrico Maria Giordano » Mon Mar 30, 2020 4:17 pm

Can we see a reduced and self-contained sample (database included) showing the problem, please?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: bug FWAdoFieldType [urgent]

Postby MOISES » Mon Mar 30, 2020 6:08 pm

Sure, thank you for your attention:

Code: Select all  Expand view
#include "fivewin.ch"
#include "adodef.ch"

static oCn
static cTable := "test_datetime"

//----------------------------------------------------------------------------//

function Main()

   SetGetColorFocus()
   FWNumFormat( "A", .t. )

   oCn   := FW_OpenAdoConnection( "xbrtest.mdb" )
   if oCn == nil
      ? "Connect Fail"
      return nil
   endif

   if .not. FW_AdoTableExists( cTable, oCn ) .or. ;
      MsgYesNo( "Create Table again?" )
      CreateTestTable()
   endif

   EditTable()

   oCn:Close()

return nil

//----------------------------------------------------------------------------//

function CreateTestTable()

   local aCols := { { "ITEM", "C", 10, 0 }, { "PRICE", "N", 12, 2 }, { "DATETIME", "T", 10, 0 }, { "DESCRIPTION", "C", 20, 0 } }
   local oRs

   ? "Creating Table"

   if FW_AdoTableExists( cTable, oCn )
      oCn:Execute( "DROP TABLE " + cTable )
   endif

   FWAdoCreateTable( cTable, aCols, oCn )

return nil

//----------------------------------------------------------------------------//

function EditTable()

   local oRs
   local oDlg, oFont, oBrw
   local nAppendRec   := nil

   local aStruct  := {}
   local nField   := 0
   local csql

   oRs   := FW_OpenRecordSet( oCn, cTable, adLockBatchOptimistic )


   aStruct := FWAdoStruct( oRs )
   nField      := AScan( aStruct, {|a| Upper(a[1]) == "DATETIME" } )


   cSQL     := FWAdoFieldType( oRs, nField )
   ?cSQL




   xbrowser ors fastedit








   oRs:Close()

return nil

//----------------------------------------------------------------------------//

 
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am


Re: bug FWAdoFieldType [urgent]

Postby Enrico Maria Giordano » Mon Mar 30, 2020 7:28 pm

Ok, I got xbrtest.mdb from FWH samples.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 46 guests