FWMARIADB: RowSet class error when inserting a new record

FWMARIADB: RowSet class error when inserting a new record

Postby vinhesoft » Fri Mar 16, 2018 4:02 pm

Mr.Rao,

error when inserting a new record, when primary key is numeric

table structure:

CREATE TABLE `admd0013` (
`CODGRU` INT (3) NOT NULL AUTO_INCREMENT,
`NOMGRU` VARCHAR (30) NULL DEFAULT NULL,
`ALTERA` DATE NULL DEFAULT NULL,
PRIMARY KEY (`CODGRU`)
)

oGrupos := oDB:Query( 'select * from ADMD0013 where CODGRU = ?',{0} )
...
oGrupos:ReQuery({27})
...
oGrupos: Append ()
oGrupos: NOMGRU: = cNOMGRU
oGrupos: ALTERA: = date ()
oGrupos: save () << error happens here
...

Error:

Application
===========
   Path and name: F: \ Systems \ WinADMplus \ WinADM.exe (32-bit)
   Size: ********* bytes
   Compiler version: Harbor 3.2.0dev (r1801051438)
   FiveWin version: FWH 18.02
   C compiler version: Borland / Embarcadero C ++ 7.0 (32-bit)
   Windows version: 6.1, Build 7601 Service Pack 1

   Time from start: 0 hours 1 mins 10 secs
   Error occurred at: 03/16/2018, 11:50:09
   Error description: BASE error / 1132 Bound error: array access
   Args:
     [1] = A {...} length: 1
     [2] = N 2

Stack Calls
===========
   Called from:. \ Source \ internal \ FWMARIA.PRG => FWMARIAROWSET: PRIMARYVAL (2339)
   Called from:. \ Source \ internal \ FWMARIA.PRG => FWMARIAROWSET: REQUERY (3114)
   Called from:. \ Source \ internal \ FWMARIA.PRG => FWMARIAROWSET: RESYNC (3407)
   Called from:. \ Source \ internal \ FWMARIA.PRG => FWMARIAROWSET: SAVE (3902)
   Called from: ADMP1190.PRG => SAVE (172)
Last edited by vinhesoft on Fri Mar 16, 2018 6:05 pm, edited 1 time in total.
João Carlos
VinheSoft Informatica
BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
vinhesoft
 
Posts: 36
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil

Re: FWMARIADB: RowSet class error when inserting a new record

Postby nageswaragunupudi » Fri Mar 16, 2018 6:00 pm

I have tried to reproduce the error at my end, but for me, it is working correctly. This is my test program run on FWH Demo Server.
Code: Select all  Expand view  RUN
#include "fivewin.ch"
function Main()

   local oCn, cSql, oGroups

   oCn   := FW_DemoDB()

   if oCn:TableExists( "admd0013" )
      oCn:DropTable( "admd0013" )
   endif

   ? "Create Table"

TEXT INTO cSql
CREATE TABLE `admd0013` (
 `CODGRU` INT (3) NOT NULL AUTO_INCREMENT,
 `NOMGRU` VARCHAR (30) NULL DEFAULT NULL,
 `ALTERA` DATE NULL DEFAULT NULL,
 PRIMARY KEY (`CODGRU`)
)
ENDTEXT

   oCn:Execute( cSql )


   XBROWSER ( oGroups := oCn:admd0013 )

   // Add Record 1
   oGroups:Append()
   oGroups:NOMGRU := "Some name"
   oGroups:ALTERA := date()
   oGroups:save()

   // Add Record 2
   oGroups:Append()
   oGroups:NOMGRU := "Second name"
   oGroups:ALTERA := date()
   oGroups:save()

   XBROWSER oGroups

   oGroups:Close()

   oCn:DropTable( "admd0013" )
   oCn:Close()

return nil
 


You can copy the above program, build and run as it is.

Image

I request you to please help me to reproduce the problem. For this purpose, you can use our demo server as in the above program. Please change or modify the above program to reproduce the error.
Regards

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

Re: FWMARIADB: RowSet class error when inserting a new record

Postby vinhesoft » Fri Mar 16, 2018 6:09 pm

the error happens only if there is a Requery before insertion:

Look

oGrupos := oDB:Query( 'select * from ADMD0013 where CODGRU = ?',{0} )
...
oGrupos:ReQuery({27})
...
oGrupos: Append ()
oGrupos: NOMGRU: = cNOMGRU
oGrupos: ALTERA: = date ()
oGrupos: save () << error happens here
...
João Carlos
VinheSoft Informatica
BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
vinhesoft
 
Posts: 36
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil

Re: FWMARIADB: RowSet class error when inserting a new record

Postby nageswaragunupudi » Fri Mar 16, 2018 6:36 pm

This is the modified program.
Code: Select all  Expand view  RUN
function ForumTest

   local oCn, cSql, oGroups

   oCn   := FW_DemoDB()

   if oCn:TableExists( "admd0013" )
      oCn:DropTable( "admd0013" )
   endif

   ? "Create Table"

TEXT INTO cSql
CREATE TABLE `admd0013` (
 `CODGRU` INT (3) NOT NULL AUTO_INCREMENT,
 `NOMGRU` VARCHAR (30) NULL DEFAULT NULL,
 `ALTERA` DATE NULL DEFAULT NULL,
 PRIMARY KEY (`CODGRU`)
)
ENDTEXT

   oCn:Execute( cSql )

   oGroups  := oCn:RowSet( "SELECT * from admd0013 WHERE codgru = ?", { 0 } )
   oGroups:ReQuery( { 27 } )

   XBROWSER oGroups

   // Add Record 1
   oGroups:Append()
   oGroups:NOMGRU := "First name"
   oGroups:ALTERA := date()
   oGroups:save()

   // Add Record 2
   oGroups:Append()
   oGroups:NOMGRU := "Second name"
   oGroups:ALTERA := date()
   oGroups:save()

   XBROWSER oGroups

   oGroups:Close()

   XBROWSER oCn:admd0013

   oCn:DropTable( "admd0013" )
   oCn:Close()

return nil
 

Please run this program as it is. I am still not getting any error.
First please build and run this program without changes.
Then modify this program to reproduce the error.
Regards

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

Re: FWMARIADB: RowSet class error when inserting a new record

Postby nageswaragunupudi » Fri Mar 16, 2018 7:16 pm

Mr João Carlos

I found the problem now.
Please give me some time.
We will come back with a proper solution to the issue.
Regards

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

Re: FWMARIADB: RowSet class error when inserting a new record

Postby vinhesoft » Fri Mar 16, 2018 7:32 pm

Mr Rao

Ok, I'll be waiting

thank you
João Carlos
VinheSoft Informatica
BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
vinhesoft
 
Posts: 36
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil

Re: FWMARIADB: RowSet class error when inserting a new record

Postby vinhesoft » Mon Apr 16, 2018 7:05 pm

up
João Carlos
VinheSoft Informatica
BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
vinhesoft
 
Posts: 36
Joined: Sat Sep 03, 2016 3:11 pm
Location: Campinas/SP-Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests