Problems with copy_row (OpenInsight Specific)
At 19 FEB 1999 11:12:54AM Tara wrote:
Hi people,
I've been trying to copy data from an old set of arev tables to a new set of OI tables using copy_row. It seems that all but two of my tables were copied correctly. With one of the other tables, only the record keys were copied over with all other fields remaining blank. The second table showed the keys again copied over correctly with incorrect data in the second field and all other fields remaining blank. Neither table has any indexes anymore. I've checked the column names and positions as well to make sure that they were identical between tables. The other tables copied over just fine and I am so puzzled. Any ideas? My copy subroutine follows:
SUBROUTINE COPY_TABLE_DATA(CharStr source_table, CharStr dest_table, CharStr table_key)
DECLARE SUBROUTINE Copy_Row, Delete_Row
DECLARE FUNCTION Get_Property, Get_Status
Delete_row(dest_table,'*',0)
Cursor_No=0
ClearSelect Cursor_No
Select source_table by table_key Setting Cursor_No Else
status=Set_FSError()ReturnEnd
Done=0
Loop
ReadNext key Using Cursor_No By 0 ElseDone=1EndCopy_Row(source_table,key,dest_table,key,0,0)Until Done Repeat
Thanks again for any help,
Tara
At 20 FEB 1999 10:52AM Oystein Reigem wrote:
Tara,
I don't know what went wrong.
But try to use read and write instead of Copy_Row. You must open the table first. And check @File_Error for errors after read and write. (@File_Error contains the error code - null if no error.) If necessary use the Debugger.
From Carl Pates I've learned that procedures like Delete_Row and Copy_Row are meant to be used when you access OI (OpenEngine) from programs written in other languages. When you program in Basic+ it's better to use simple statements like open, read, write.
Where that's documented? E.g in Carl Pates' head. And some other heads. Me? I used Copy_Row for years before I was told.
- Oystein -
PS. I have no reason to suspect that it's Copy_Row that causes your problems, but at least it's easier to locate the bug when you do it in smaller steps.
At 20 FEB 1999 08:10PM TARA wrote:
You won't believe this but the problem was when I added indexes to two tables, it wiped out every row in the tables except for the record keys! I deleted the indexes and tried to reload the tables and it would still not copy the records over except for the keys. I nuked the tables and re-built them from scratch and left off the indexes. I then copied over the data again and this time the tables were correctly filled. Then I re-added the indexes and once again all of the data was wiped out. The third time I was lucky. I'm waiting for tech support to call me back on this one. Am I the only one who has these types of problems?
Thanks for your help again Oystein.
Tara