Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 2 of 2 total |
Version 3, restructure loses all indexes |
Tue, Nov 11 2008 11:18 AM | Permanent Link |
Joel Schaubert | I am restructuring 4 tables to increase the size of one of the string fields. The table itself is working perfectly, even preserving the old data. However the indexes are always lost with the resulting table having no indexes at all. Is this the right API (for RestructureTable) to be using when I need indexes on the tables? (NOTE version 3.x dbisam engine) SchoolTable->Close(); //just to make sure SchoolTable->Exclusive = true; SchoolTable->RestructureFieldDefs->Update(); SchoolTable->RestructureFieldDefs->Delete(0); SchoolTable->RestructureFieldDefs->Insert(0,1,"SCHID",ftString,12,false,"","","",""); SchoolTable->IndexDefs->Clear(); SchoolTable->IndexDefs->Add("SCHID","SCHID",TIndexOptions() << ixPrimary << ixUnique); SchoolTable->IndexDefs->Add("bySchoolName","SCHOOLNAME",TIndexOptions()); SchoolTable->RestructureTable(0,0,1,1,false,"","School table",512,false); SchoolTable->RepairTable(); SchoolTable->Close(); SchoolTable->Exclusive = false; This also removes all indices MessageTable->Close(); //just to make sure MessageTable->Exclusive = true; MessageTable->IndexDefs->Update(); MessageTable->RestructureFieldDefs->Update(); MessageTable->RestructureFieldDefs->Delete(12); MessageTable->RestructureFieldDefs->Insert(12,13,"SCHID",ftString,12,false,"","","",""); MessageTable->RestructureTable(0,0,1,1,false,"","Student message table",512,false); MessageTable->RepairTable(); MessageTable->Close(); MessageTable->Exclusive = false; |
Tue, Nov 11 2008 2:26 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Joel,
<< Is this the right API (for RestructureTable) to be using when I need indexes on the tables?>> Yes. Use this code instead: SchoolTable->Close(); //just to make sure SchoolTable->Exclusive = true; SchoolTable->RestructureFieldDefs->Update(); SchoolTable->RestructureFieldDefs->Delete(0); SchoolTable->RestructureFieldDefs->Insert(0,1,"SCHID",ftString,12,false,"","","",""); // If you want to just add the indexes, then use this SchoolTable->RestructureIndexDefs->Update(); // Otherwise, use this SchoolTable->RestructureIndexDefs->Clear(); SchoolTable->RestructureIndexDefs->Add("SCHID","SCHID",TIndexOptions() << ixPrimary << ixUnique); SchoolTable->RestructureIndexDefs->Add("bySchoolName","SCHOOLNAME",TIndexOptions()); SchoolTable->RestructureTable(0,0,1,1,false,"","School table",512,false); // You don't need this at all SchoolTable->RepairTable(); SchoolTable->Close(); SchoolTable->Exclusive = false; -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, March 29, 2024 at 03:30 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |