ReDim var holding an array of User Type fails

Please report bugs.

ReDim var holding an array of User Type fails

Postby Henning » Wed Apr 17, 2013 11:46 pm

While working on accessing a MySQL database using Records.Value, to be closer to an old VB'ers ADO.

ReDim a Public variable holding an array of User Type fails!!

In Global: Public Dim ArtRec[1] As rcArt, rcArt is a User Type.

In Module1: ReDim ArtRec[recCount + 1] !!!! This is what screws-up the array.

If I in Global: Public Dim ArtRec[10] As rcArt and comment out the ReDim it works correctly.

/Henning
Henning
 
Posts: 522
Joined: Fri Aug 13, 2010 6:29 pm

Re: ReDim var holding an array of User Type fails

Postby Slowdown » Thu Apr 18, 2013 6:57 pm

Henning,

No errorś reported here.

in Global;
Code: Select all
Type rcArt
  arNr As Short
  arArt As String * 20
  arSize As Short
  arType As String
  arID As String * 15
  arIndate As String
  arInpris As Short
  arAntut As Short
  arTotut As Integer
  arStat As Byte
  arKvnr As Short
  arRedat As String
  arKr As Integer
  arKrtot As Integer
  arAge As Short
  arPris As Short
End Type

Public Dim ArtRec[1] As rcArt


In Mainwindow;
Code: Select all
Dim recCount As Integer

Event Init()
 recCount = 10
 ReDim ArtRec[recCount + 1]'   !!!!This Is what screws - up the array.
End Event


Did not test it further but this code works with no error on Linux 64bit.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 464
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: ReDim var holding an array of User Type fails

Postby Henning » Thu Apr 18, 2013 8:15 pm

It's when running the prog. and ReDim ArtRec[] then at "ArtRec[rc].arType = Records.Value(sRecordsId, fld)" it screws-up, with the RunTimeError.

Also if I comment all those lines, and do MainWindow.txtSomeLineEdit = Records.Value(sRecordsId, fld) all is fine.

/Henning
Henning
 
Posts: 522
Joined: Fri Aug 13, 2010 6:29 pm

Re: ReDim var holding an array of User Type fails

Postby Henning » Fri Apr 19, 2013 12:03 am

I really don't understand what is going wrong. With or without the ReDim compiles to the exact same C++ code... :?

Code: Select all
With ReDim
do {
                                                                  /*DEBUG*/Q7BS("Module1.Module.q7b", "GetArt", "137", "1");
Q7B_ASSIGNMENT(&fld, &Q7B__STRING(Q7B_ID("artnr")));
                                                                  /*DEBUG*/Q7BS("Module1.Module.q7b", "GetArt", "138", "1");
Q7B_ASSIGNMENT(q7b_type_get(*q7b_array_at(Q7B_Global_Class(Q7B_Global_Object())->ArtRec, rc, Q7B_ID((qint64) -1), Q7B_ID((qint64) -1), Q7B_ID((qint64) -1)), Q7B_ID((qint64) 0), Q7B_ID(-1), Q7B_ID(-1), Q7B_ID(-1), Q7B_ID(-1)), &Q7B__SHORT(Q7B_RECORDS_VALUE(Q7B_Records_Object(), sRecordsId, Q7B_ID("artnr"))));
                                                                  /*DEBUG*/Q7BS("Module1.Module.q7b", "GetArt", "140", "1");
Without ReDim
do {
                                                                  /*DEBUG*/Q7BS("Module1.Module.q7b", "GetArt", "137", "1");
Q7B_ASSIGNMENT(&fld, &Q7B__STRING(Q7B_ID("artnr")));
                                                                  /*DEBUG*/Q7BS("Module1.Module.q7b", "GetArt", "138", "1");
Q7B_ASSIGNMENT(q7b_type_get(*q7b_array_at(Q7B_Global_Class(Q7B_Global_Object())->ArtRec, rc, Q7B_ID((qint64) -1), Q7B_ID((qint64) -1), Q7B_ID((qint64) -1)), Q7B_ID((qint64) 0), Q7B_ID(-1), Q7B_ID(-1), Q7B_ID(-1), Q7B_ID(-1)), &Q7B__SHORT(Q7B_RECORDS_VALUE(Q7B_Records_Object(), sRecordsId, Q7B_ID("artnr"))));


The error scrn is in Q&A < Array of User Type Error

/Henning
Henning
 
Posts: 522
Joined: Fri Aug 13, 2010 6:29 pm

Re: ReDim var holding an array of User Type fails

Postby Slowdown » Fri Apr 19, 2013 6:28 pm

Willing to compile/test it on Linux just dump the project.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 464
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: ReDim var holding an array of User Type fails

Postby Slowdown » Sat Apr 20, 2013 9:09 am

Hi Henning,

Did test the code i posted with XP and again no error's.
After some brainstorming is the problem you have really with DIM or REDIM or is it something else (Records.) and the error reported by Q7B
pointing you into the wrong direction ?
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 464
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron