Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 15 MAY 1998 09:06:47AM Oystein Reigem wrote:

Experts and Gurus (and Gnus and Emus and all other Revelation creatures),

I have this function that runs through a whole table and changes the keys (it searches and replaces one string with another). Since the key cannot really be changed it does its thing by copying each row to a new one, deleting the source row afterwards. Earlier the function seemed to work well, but now when I (my colleague) ran it on a largish table it failed. I think it at one point started again on keys already changed, but there were other anomalies too. - Could I please ask you lot if you can see something wrong with what I'm doing?

I first select the whole table with an RList to a TARGET_ACTIVELIST$:

Cmnd=SELECT " : TableName
Set_Status(0)
RList( Cmnd, TARGET_ACTIVELIST$, '', '', '' )
if Get_Status( ErrCodes ) then
  etc

I now have a resolved list, right? I guess a latent list would fail miserably, but a resolved list should be OK?

Then I readnext through the list and do the changes.

if   then
  ...
  Set_Status( 0 )
  Copy_Row( TableName, Orig_Key, "", New_Key, 0, 1 )
  if Get_Status( ErrCodes ) then
    etc
Set_Status( 0 )
delete TableVar, Orig_Key else
  etc

Can you spot what might be wrong?

- Oystein -


At 15 MAY 1998 11:04AM Carl Pates wrote:

Hi Oystein,

I don't know if this would make any difference, but have you tried reading and writing the rows back yourself,instead of relying on Copy_Row?

As everything seems to be in one table, and you've already opened it, I think it would be more efficient too.

It sounds as if the select cursor or the readnext pointer is becoming corrupt somehow, and after finding out the hard way with S/List I'd never trust an OI system global variable as far as I could throw it (well, not those that I could set anyway! )

cpates@sprezzatura.com

Sprezzatura Ltd

World Leaders in all things RevSoft


At 18 MAY 1998 12:08PM Cameron Revelation wrote:

Oystein,

I am not certain that you would have a resolved list just by issuing:

SELECT

Try instead:

SELECT BY @ID

Cameron Purdy

Revelation Software


At 19 MAY 1998 03:49AM Oystein Reigem wrote:

Cameron,

I am not certain that you would have a resolved list just by issuing: SELECT .

Even when I process the SELECT with RList and the TARGET_ACTIVELIST$ parameter? Do you mean there's a bug? Or an error in the documentation? Will it happen always or just some of the time?

It cannot happen all the time because I just tried it - on a different table in a different copy of the database, that is. For various reasons I cannot try it on the actual table today.

Try instead: SELECT BY @ID

I will follow this advice anyway. I think most of our users would prefer the process to be done BY @ID.

And I will also let my function check if the list really is resolved by inspecting @REDUCTION_DONE.

But I hope you will be so kind as to answer the questions in my first paragraph too.

- Oystein -


At 19 MAY 1998 04:12AM Oystein Reigem wrote:

Carl,

Thanks.

I don't know if this would make any difference, but have you tried reading and writing the rows back yourself, instead of relying on Copy_Row?

Since you say it's more efficient too, I can always try, along with Cameron's suggestions.

It sounds as if the select cursor or the readnext pointer is becoming corrupt somehow, and after finding out the hard way with S/List I'd never trust an OI system global variable as far as I could throw it (well, not those that I could set anyway! )

I'm not sure if you with your joke implies the programmer's often at fault (e.g, me or you) or that easily settable variables are prone to be misused by the RevSoft staff too, introducing bugs in the OI system. But I'm certain I don't set any system global variables, and even if I know you're a gifted programmer I don't think you could have set my system global variables either, so then there's only OI left.

- Oystein -


At 19 MAY 1998 05:08AM Carl Pates wrote:

Hi Oystein,

]]]

I'm not sure if you with your joke implies the programmer's often at fault (e.g, me or you) or that easily settable variables are prone to be misused by the RevSoft staff too, introducing bugs in the OI system. )

If Cameron's suggestions don't work (and then I'd be surprised because they normally do!) you could also try the Push.Select and Pop.Select functions which save and restore the state of select lists before you go into another function. ((I believe they still function the same way as they did in ARev)

Cheers,

cpates@sprezzatura.com

Sprezzatura Ltd

World Leaders in all things RevSoft

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/dbb7e5a2c1851ec98525660500480893.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1