FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWMARIADB: RowSet class error when inserting a new record
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 04: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)

João Carlos

VinheSoft Informatica

BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 06: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 (fw): Select all Collapse
#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.



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
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 06: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 06:36 PM
This is the modified program.
Code (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 07: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
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Fri Mar 16, 2018 07: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
Posts: 36
Joined: Sat Sep 03, 2016 03:11 PM
Re: FWMARIADB: RowSet class error when inserting a new record
Posted: Mon Apr 16, 2018 07:05 PM

up

João Carlos

VinheSoft Informatica

BCC 7.7 - FHW 24.07 - Harbour 3.2.0dev (r2404101339) for BCC 7.7

Continue the discussion