Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread AlterTables problem
Sun, Aug 21 2022 11:02 AMPermanent Link

plm

Hello everyone and thanks in advance to those who want to help me.
First, I apologize for my English which is not my motherlanguage and second for my possible trivial mistakes ... I am a hobbyist, not a professional programmer.
I have the following problem... I should update the table of a software that, over the years, has been customized for different friends and therefore is not the same for everyone. Now I would like to standardize this table so that they all have the same table format. Things to change are from new fields, to new field sizes, new indexes, new sets of SpaceChars and IncludeChars. Unfortunately, running the code below seems to ignore my parameters related to StopWords, SpaceChars and IncludeChars and apply the default ones (this by checking after the table with dbsys): everything else is altered correctly and I don't understand where I can have wrong. Note that using the same parameters to create a new table, rather than altering it, everything looks fine. I use Delphi 6 pro with the latest version of DBISAM 4.50 build 4.
Best Regards,
Pier

procedure TBasileusWin.DBUpdateExecute(Sender: TObject);
var
 StopWords: TstringList;
begin
 Screen.Cursor := crHourglass;
 Application.ProcessMessages;
 with DBTable.FieldDefs do
 begin
   Clear;
   Add('ID', ftAutoInc, 0, True);
   Add('Disponibile', ftBoolean, 0, True, 'True');
   Add('Soggetto1', ftString, 35);
   Add('Soggetto2', ftString, 35);
   Add('Soggetto3', ftString, 35);
   Add('Autore', ftString, 90);
   Add('OperaAttribuita', ftBoolean, 0, False, 'False');
   Add('Titolo', ftString, 500, True);
   Add('Luogo', ftString, 50);
   Add('LuogoAttuale', ftString, 30);
   Add('Editore', ftString, 50);
   Add('Data', ftString, 30);
   Add('DataAttribuita', ftString, 4);
   Add('Prezzo', ftCurrency);
   Add('Par', ftBoolean, 0, False, 'False');
   Add('CatalogoCarta', ftString, 30);
   Add('CatalogoWeb', ftString, 30);
   Add('StoricoCataloghi', ftMemo);
   Add('ChiaviRicerca', ftString, 100);
   Add('DatiX', ftString, 40);
   Add('DatiY', ftString, 40);
   Add('Copie', ftSmallint, 0, True, '1');
   Add('DataInserimento', ftDate);
   Add('DataCancellazione', ftDate);
   Add('Descrizione', ftMemo, 0, False, '', '', '', '', fcNoChange, 6);
   Add('Note', ftMemo, 0, False, '', '', '', '', fcNoChange, 6);
   Add('Immagine1', ftString, 16);
   Add('Immagine2', ftString, 16);
   Add('Marker', ftFixedChar, 1);
   Add('Lingua', ftString, 30);
   Add('Stato', ftString, 30);
   Add('Legatura', ftString, 30);
   Add('PrimaEdizione', ftBoolean, 0, False, 'False');
   Add('Illustrata', ftBoolean, 0, False, 'False');
   Add('Autografa', ftBoolean, 0, False, 'False');
   Add('Sovracoperta', ftBoolean, 0, False, 'False');
   Add('ISBN', ftString, 20);
   Add('Peso', ftFloat);
 end;
 with DBTable.IndexDefs do
 begin
   Clear;
   Add('', 'ID', [ixPrimary, ixCaseInsensitive, ixUnique], '', icFull);
   Add('Autore', 'Autore;Titolo;DataAttribuita', [ixCaseInsensitive], '', icFull);
   Add('Disponibile', 'Disponibile', [ixCaseInsensitive], '', icFull);
   Add('Soggetto', 'Soggetto1;Autore;Titolo;DataAttribuita', [ixCaseInsensitive], '', icFull);
   Add('Data', 'DataAttribuita;Autore;Titolo', [ixCaseInsensitive], '', icFull);
   Add('DatiX', 'DatiX', [ixCaseInsensitive], '', icFull);
   Add('DatiY', 'DatiY', [ixCaseInsensitive], '', icFull);
   Add('DataInserimento', 'DataInserimento', [ixCaseInsensitive], '', icFull);
   Add('DataCancellazione', 'DataCancellazione', [ixCaseInsensitive], '', icFull);
   Add('Marker', 'Marker', [ixCaseInsensitive], '', icFull);
   Add('Prezzo', 'Prezzo', [ixCaseInsensitive], '', icFull);
   Add('PrimaEdizione', 'PrimaEdizione', [ixCaseInsensitive], '', icFull);
   Add('Illustrata', 'Illustrata', [ixCaseInsensitive], '', icFull);
   Add('Autografa', 'Autografa', [ixCaseInsensitive], '', icFull);
   Add('ISBN', 'ISBN', [ixCaseInsensitive], '', icFull);
   Add('Sovracoperta', 'Sovracoperta', [ixCaseInsensitive], '', icFull);
 end;
 StopWords := TStringList.Create;
 try
   with StopWords do
   begin
     Add('UN');
     Add('UNA');
     Add('IL');
     Add('LO');
     Add('LA');
     Add('DI');
     Add('PER');
     Add('IN');
     Add('TRA');
     Add('CON');
   end;
   DBTable.AlterTable(1040, 5, 3, False, '', 'Basileus', 4096, 256, DBTable.LastAutoIncValue,    'Soggetto1;Soggetto2;Soggetto3;Autore;Titolo;Luogo;LuogoAttuale;Editore;DataAttribuita;CatalogoCarta;CatalogoWeb;ChiaviRicerca;Descrizione;Note;Lingua',
    StopWords,
     #1+#2+#3+#4+#5+#6+#7+#8+#9+#10+#11+#12+#13+#14+#15+#16+#17+#18+#19+#20+
     #21+#22+#23+#24+#25+#26+#27+#28+#29+#30+#31+#32+#33+#34+#35+#36+#37+
     #38+#39+#40+#41+#42+#43+#44+#45+#47+#58+#59+#60+#61+#62+#63+#64+#91+
     #92+#93+#94+#95+#96+#123+#124+#125+#126+#127+#128+#129+#130+#131+#132+
     #133+#134+#135+#136+#137+#138+#139+#140+#141+#142+#143+#144+#145+#146+
     #147+#148+#149+#150+#151+#152+#153+#154+#155+#156+#157+#158+#159+#160+
     #161+#162+#163+#164+#165+#166+#167+#168+#169+#170+#171+#172+#173+#174+
     #175+#176+#177+#178+#179+#180+#181+#182+#183+#184+#185+#186+#187+#188+
     #189+#190+#191+#247+#248,
     '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' +
     #192+#193+#194+#195+#196+#197+#198+#199+#200+#201+#202+#203+#204+#205+
     #206+#207+#208+#209+#210+#211+#212+#213+#214+#215+#216+#217+#218+#219+
     #220+#221+#222+#223+#224+#225+#226+#227+#228+#229+#230+#231+#232+#233+
     #234+#235+#236+#237+#238+#239+#240+#241+#242+#243+#244+#245+#246+#249+
     #250+#251+#252+#253+#254+#255, False);
   DBTable.Open;
   try
   finally
     DBTable.Close;
   end;
 finally
   StopWords.Free;
 end;
 Screen.Cursor := crDefault;
 MessageDlg('Aggiornamento degli archivi completato!', mtInformation,
   [mbOk], 0);
end;
Image