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 23 MAR 1998 02:33:03PM Oystein Reigem wrote:

I know the recommended way to remove problematic indexes. But the method is time-consuming and possibly dangerous. Is there no quick way to remove all indexes - problematic or not - from a table?

What about all indexes from all the tables of a location? Can one somehow save the state of an unindexed location before any problem occurs and restore it after a problem occurs?

What if one saves all dictionaries and the DBT file of the unindexed location?

- Oystein -


At 23 MAR 1998 10:14PM Aaron Kaplan wrote:

I suppose you've looked at Removing Indexing Manually, Rebuilding Indexes from R/BASIC and Reuilding Relational Indexes using R/BASIC and mean these are recommened?

Only way to save the state is copy off the dictionary file. To restore back to unindexed, copy back the old dictionary, remove SI.MFS from the REVMEDIA file and kill the !FILE.

apk@sprezzatura.com

Sprezzatura, Inc.

www.sprezzatura.com_zz.jpg


At 24 MAR 1998 04:35AM Oystein Reigem wrote:

Aaron,

Only way to save the state is copy off the dictionary file. To restore back to unindexed, copy back the old dictionary, remove SI.MFS from the REVMEDIA file and kill the !FILE.

Thanks!

Can this be done from a program?

- Oystein -


At 24 MAR 1998 12:52PM Aaron Kaplan wrote:

Sure, just alias in the REVMEDIA file (it's in the SYSPROG account) read in the media record (FILE*ACCOUNT) and remove SI.MFS from the list of MFS's.

There should be code in one of the TB's I posted before.

apk@sprezzatura.com

Sprezzatura, Inc.

www.sprezzatura.com_zz.jpg


At 25 MAR 1998 08:40AM Oystein Reigem wrote:

Aaron,

Sure, just alias in the REVMEDIA file (it's in the SYSPROG account) read in the media record (FILE*ACCOUNT) and remove SI.MFS from the list of MFS's.

Thanks. That wasn't too difficult.

I assume the list of MFS's is a @VM-delimited list (my tables have only SI.MFS so I can't tell by inspecting my REVMEDIA's).

There should be code in one of the TB's I posted before.

Not in the 3 TB's you referred to in your previous posting, but never mind.

I think I managed to write the index-killing routine I needed. But I'd be grateful for your opinion on a couple of points. Here is my code with questions inbetween:

function Kill_Indexes( DBName, Location, TableName, UnIxedDictLocation )
[b](UnIxedDictLocation is the location where I have saved a copy of the dictionary when the table was unindexed.)[/b]

    equate true$  to 1
    equate false$ to 0
    
    declare function Get_Status
    declare subroutine Set_Status
    declare subroutine Alias_Table
    declare subroutine Copy_Table
    declare subroutine Delete_Table
    declare subroutine Define_Database
    
    /* check parameters */
    if not(Assigned(DBName)) or not(Assigned(Location)) or not(Assigned(TableName)) or not(Assigned(UnIxedDictLocation)) then
        /* missing parameter(s) */
        return -1
    end
    if DBName=" or Location=" or TableName=" or UnIxedDictLocation=" then
        /* missing parameter(s) */
        return -2
    end
    
    /* restore the dictionary */
    
    Set_Status( 0 )   /* make sure status is clear */
    [b]Here I first tried to alias the dictionary table.[/b]
    *Alias_Table( UnIxedDictLocation, DBName, "DICT." : TableName, "RESTORE_DICT" )
    [b]But I didn't succeed, so I had to alias the data table instead.[/b]
    [b]This means I also have to save a copy of the data files.[/b]
    [b]Any idea to why I couldn't alias the dictionary table?[/b]
    [b]One more thing: If my UnIxedDictLocation is an absolute path[/b]
    [b]I get FS109 - Invalid map qualifier. Why?[/b]
    [b](I have posted a different message about locations and absolute paths,[/b]
    [b]by the way.)[/b]
    Alias_Table( UnIxedDictLocation, DBName, TableName, "RESTORE_DATA" )
    if Get_Status( StatusCode) then
        /* alias failed. possible course: same volume id */
        return -11
    end
    
    Set_Status( 0 )   /* make sure status is clear */
    Copy_Table( "DICT.RESTORE_DATA", Location, DBName, "DICT." : TableName, 1, 0, 1, 0, Stat, 0 )
    if Get_Status( StatusCode) then
    [b]Here I get SSP280 (Table %1% not found at %2%, filing system %3%)[/b]
    [b]even if the dictionary seems to be copied.[/b]
    [b]Have you got an explanation for that?[/b]
        /* copy dictionary failed */
*        return -12
    end
    
    /* remove SI.MFS from REVMEDIA */
    
    Set_Status( 0 )   /* make sure status is clear */
    Alias_Table( Location, "SYSPROG", "REVMEDIA", "REVMEDIA" )
    if Get_Status( StatusCode) then
        /* alias failed */
        return -21
    end
    
    open "REVMEDIA" to RevMediaVar else
        /* open REVMEDIA failed */
        return -22
    end
    
    read RevMediaRow from RevMediaVar, TableName : "*" : DBName else
        /* read failed */
        return -23
    end    
    
    Mfs=RevMediaRow
    locate "SI.MFS" in Mfs using @VM setting Pos then
        Mfs=delete( Mfs, 1, Pos, 0 )
    end
    RevMediaRow=Mfs
    
    write RevMediaRow on RevMediaVar, TableName : "*" : DBName else
        /* write failed */
        return -24
    end
    
    /* kill the index file */
    
    Set_Status( 0 )   /* make sure status is clear */
    [b]To get Delete_Table to work programmatically I had to use[/b]
    [b]a second (null) parameter. Is that correct?[/b]
    [b]Is Delete_Table documented?[/b]
    Delete_Table( "!" : TableName, "" )
    if Get_Status( StatusCode) then
        /* delete failed */
        /* but that could be because the table was without indexes in the first place */
        *return -31
    end
    
    /* save database definition */
    
    [b]Is this the right thing to do?[/b]
    Define_Database( DBName, true$ )
    
return 0

- Oystein -

Øystein Reigem,

Humanities Information Technologies,

Harald Haarfagresgt 31,

N-5007 Bergen,

Norway

Tel: +47 55 58 32 42

Fax: +47 55 58 94 70

E-mail: oystein.reigem@hd.uib.no

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/5563aae890705d64852565d00065e76d.txt
  • Last modified: 2024/01/04 21:00
  • by 127.0.0.1