Error with MariaDB and DataRow

Post Reply
User avatar
Maurizio
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Error with MariaDB and DataRow

Post by Maurizio »

Hello Rao,
I use MariaDB and DataRow and I get an error when I add a record in filtered recordsource
CUSTID (in the example) is incorrect.
Maybe I use the commands incorrectly but with ADO it works correctly.

Code: Select all | Expand

#include "fivewin.ch"

static aStr := { "208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950", ;
                 "209.250.245.152,fwh,fwhuser,FiveTech@2022" }

static oCn

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

function Main()

   local oRs, cSql,oRec

   FWSetLanguage( 1 )
   FW_SetUnicode( .t. )

   if ( oCn := maria_Connect( aStr[ 1 ], .t. ) ) != nil

      TEXT INTO cSql
         SELECT C.ID AS CustID, C.FIRST AS CustName, C.AGE AS AG, C.STATE AS ST, S.NAME AS StateName
         FROM customer C
         LEFT OUTER JOIN states S ON C.STATE = S.CODE
         ORDER BY CUSTID
      ENDTEXT

      oRs   := oCn:RowSet( cSql )

     // xbrowse(oRs)  
      
      oRec  := TDataRow():New( oRs, nil, .t.)
      oRec:CUSTNAME := 'PIPPO'
      oRec:Save()
      ? 'Last CUSTID :'  + str(oRec:CUSTID ) + '* OK *' + ' Name:' + oRec:CUSTNAME
      
      
      oRs:Filter = "CUSTNAME = 'Tom'" 
      xbrowse(oRs) 
       
      oRec  := TDataRow():New( oRs, nil, .t.)
      oRec:CUSTNAME := 'Frank'
      oRec:Save()
      ? 'Last CUSTID :'  + str(oRec:CUSTID ) + '* ERROR  *' + ' Name:' + oRec:CUSTNAME
        
      
      
      
      
      
     /*
      XBROWSER oRs FASTEDIT AUTOSORT AUTOFIT SHOW RECID ;
         TITLE "Compare Editability Vs Other Libs" ;
         SETUP ( oBrw:lFastEdit := .f., oBrw:aCols[ 4 ]:cEditPicture := "@!" )
     */
      oCn:Close()

   endif

return nil
Regards Maurizio
www.nipeservice.com
User avatar
Maurizio
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: Error with MariaDB and DataRow

Post by Maurizio »

Hello RAO
could you see this post?
Maurizio
User avatar
Eroni
Posts: 100
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Error with MariaDB and DataRow

Post by Eroni »

Maurizio, I do not use tDataRow(), but it works for me:

Code: Select all | Expand

oRec := oRs:Record( .F. ) // or .T. to insert 
Wouldn't that be missing?

Regards.
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Error with MariaDB and DataRow

Post by nageswaragunupudi »

Code: Select all | Expand

oRec := oRs:Record( .F. ) // or .T. to insert
and

Code: Select all | Expand

oRec  := TDataRow():New( oRs, nil, .t.)// .t. or .f.
are same.
Regards

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

Re: Error with MariaDB and DataRow

Post by nageswaragunupudi »

We will test and get back
Regards

G. N. Rao.
Hyderabad, India
Post Reply