Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Changing DBISAM database from version 3 to version 4
Wed, Feb 20 2013 8:32 PMPermanent Link

Peter Evans

I am changing my DBISAM database from version 3 to version 4.
Looking at the documentation I see there are changes to do with what
used to be called RestructureTable.

It is now called AlterTable.

The following code worked under version 3.

PROCEDURE TTableAccess.DoRestructureTable(CONST LastAutoInc :INTEGER;
                                          CONST DataModule  :TDataMod3);
{Changing the LastAutoIncValue}
VAR
  wLanguageID : Word;
  wSortID     : Word;
  wUserMajorVersion : Word;
  wUserMinorVersion : Word;
  bEncrypted : BOOLEAN;
  sPassword : STRING;
  sDescription : STRING;
  wBlobBlockSize : Word;
  sTextIndexFields : STRING;
  TextIndexStopWordsStr : TStrings;
  sTextIndexSpaceChars : STRING;
  sTextIndexIncludeChars : STRING;
BEGIN
  TRY
    TextIndexStopWordsStr := TStringList.Create;
    {Retrieve all the values that we need}
    WITH DataModule.MyTable DO BEGIN
      wLanguageID := LanguageID;
      wSortID     := SortID;
      wUserMajorVersion := UserMajorVersion;
      wUserMinorVersion := UserMinorVersion;
      bEncrypted := Encrypted;
      sPassword  := Password;
      sDescription := Description;
      wBlobBlockSize := BlobBlockSize;
      sTextIndexFields := TextIndexFields;
      TextIndexStopWordsStr.Assign(TextIndexStopWords);
      sTextIndexSpaceChars := TextIndexSpaceChars;
      sTextIndexIncludeChars := TextIndexIncludeChars;
    END;
    DataModule.MyTable.RestructureFieldDefs.Update; {reads in existing
info}
    DataModule.MyTable.RestructureIndexDefs.Update; {reads in existing
info}

    DataModule.MyTable.RestructureTable(wLanguageID,
                                      wSortID,
                                      wUserMajorVersion,
                                      wUserMinorVersion,
                                      bEncrypted,
                                      sPassword,
                                      sDescription,
                                      wBlobBlockSize,
                                      LastAutoInc, {LastAutoIncValue}
                                      sTextIndexFields,
                                      TextIndexStopWordsStr,
                                      sTextIndexSpaceChars,
                                      sTextIndexIncludeChars,
                                      True {SuppressBackups} );
  FINALLY
    TextIndexStopWordsStr.Free;
  END;
END;

I have attempted to change the code for version 4 but am stuck.
It does not compile at the indicated line.
Here is my attempt:

PROCEDURE TTableAccess.DoRestructureTable(CONST LastAutoInc : INTEGER;
                                          CONST DataModule  : TDataMod3);
VAR
  saveNewLocalID : Integer;
  saveNewUserMajorVersion : Word;
  saveNewUserMinorVersion : Word;
  saveNewEncrypted : Boolean;
  saveNewPassword : String;
  saveNewDescription : String;
  saveNewIndexPageSize : Integer;
  saveNewBlobBlockSize : Integer;
  saveNewLastAutoIncValue : Integer;
  saveNewTextIndexFields : String;
  saveNewTextIndexStopWords : TStrings;
  saveNewTextIndexSpaceChars : String;
  saveNewTextIndexIncludeChars : String;
  saveSuppressBackups : Boolean;
BEGIN
  TRY
    saveNewTextIndexStopWords := TStringList.Create;
    {Retrieve all the values that we need}
    WITH DataModule.MyTable DO BEGIN
      saveNewLocalID := NewLocalID;              <====  Does Not Compile
      saveNewUserMajorVersion := NewUserMajorVersion;

      . . .
    END;
    DataModule.MyTable.RestructureFieldDefs.Update;  ????????
    DataModule.MyTable.RestructureIndexDefs.Update;   ?????????

    DataModule.MyTable.AlterTable(saveNewLocalID,
                                saveNewUserMajorVersion,
 . . .
END;

Any clues?

Regards,
  Peter Evans
Sat, Feb 23 2013 11:20 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< It does not compile at the indicated line.

      saveNewLocalID := NewLocalID;              <====  Does Not Compile
      saveNewUserMajorVersion := NewUserMajorVersion; >>

Where is NewLocalID defined ?  BTW, it should be "locale", not "local".

Use this instead for the update of the field defs and index defs:

    DataModule.MyTable.FieldDefs.Update;  ????????
    DataModule.MyTable.IndexDefs.Update;   ?????????

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Feb 23 2013 7:22 PMPermanent Link

Peter Evans

Tim,
Thank you for your reply.

>
> Where is NewLocalID defined ?  BTW, it should be "locale", not "local".

When I was making the changes code insight was not working for the
DBISAM code base.

Today code insight is working for the DBISAM code base.

Anyway I have now got the new code to compile.

I append the new code. Whether it works is another matter.

Regards,
  Peter Evans

--------------------

PROCEDURE TTableAccess.DoRestructureTable(CONST LastAutoInc : INTEGER;
                                          CONST DataModule  : TDataMod3);
{2013 Feb 20 PGE - Following required for version 4 of DBISAM}
VAR
  saveNewLocalID : Integer;
  saveNewUserMajorVersion : Word;
  saveNewUserMinorVersion : Word;
  saveNewEncrypted : Boolean;
  saveNewPassword : String;
  saveNewDescription : String;
  saveNewIndexPageSize : Integer;
  saveNewBlobBlockSize : Integer;
  {saveNewLastAutoIncValue : Integer;Not used}
  saveNewTextIndexFields : String;
  saveNewTextIndexStopWords : TStrings;
  saveNewTextIndexSpaceChars : String;
  saveNewTextIndexIncludeChars : String;
BEGIN
  TRY
    saveNewTextIndexStopWords := TStringList.Create;
    {Retrieve all the values that we need}
    WITH DataModule.MyTable DO BEGIN
      saveNewLocalID := LocaleID;
      saveNewUserMajorVersion := UserMajorVersion;
      saveNewUserMinorVersion := UserMinorVersion;
      saveNewEncrypted        := Encrypted;
      saveNewPassword         := Password;
      saveNewDescription      := Description;
      saveNewIndexPageSize    := IndexPageSize;
      saveNewBlobBlockSize    := BlobBlockSize;
      {saveNewLastAutoIncValue := LastAutoIncValue;Not used}
      saveNewTextIndexFields  := TextIndexFields;
      saveNewTextIndexStopWords.Assign(TextIndexStopWords);
      saveNewTextIndexSpaceChars   := TextIndexSpaceChars;
      saveNewTextIndexIncludeChars := TextIndexIncludeChars;
    END;{WITH}
    DataModule.MyTable.FieldDefs.Update;
    DataModule.MyTable.IndexDefs.Update;

    DataModule.MyTable.AlterTable(saveNewLocalID,
                                saveNewUserMajorVersion,
                                saveNewUserMinorVersion,
                                saveNewEncrypted,
                                saveNewPassword,
                                saveNewDescription,
                                saveNewIndexPageSize,
                                saveNewBlobBlockSize,
                                LastAutoInc, {LastAutoInc value}
                                saveNewTextIndexFields,
                                saveNewTextIndexStopWords,
                                saveNewTextIndexSpaceChars,
                                saveNewTextIndexIncludeChars,
                                True {SuppressBackups} );
  FINALLY
    FreeAndNil(saveNewTextIndexStopWords);
  END;
END;
Mon, Feb 25 2013 12:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Peter,

<< Anyway I have now got the new code to compile.

I append the new code. Whether it works is another matter. >>

It looks good to me.

Tim Young
Elevate Software
www.elevatesoft.com
Image