Recent

Author Topic: [solved] Sqlite Index is not created  (Read 1334 times)

ratmalwer

  • Jr. Member
  • **
  • Posts: 57
[solved] Sqlite Index is not created
« on: January 24, 2022, 01:56:37 am »
Hi all

I have this script witch does not affect the Creation of an Index.

Code: Pascal  [Select][+][-]
  1. function TDataModul.Create_Index_Displayname(): string;
  2. begin
  3.      Result := 'ok';
  4.      if not DBConnectSQLite() then begin
  5.        exit;
  6.      end;
  7.      Try
  8.          SQLQuery5.close;
  9.          SQLQuery5.sql.Clear;
  10.          SQLQuery5.SQL.Text := 'CREATE INDEX "IDISPLAYNAME" ON "ZIMAGE" ("ZDISPLAYNAME" ASC)';
  11.          SQLQuery5.ExecSql;
  12.      except
  13.          on E: ESQLDatabaseError do begin
  14.              Result := E.Message;
  15.          end;
  16.      end;
  17.      DBCloseSQLite;
  18. end;    

The Code is executed and the Result is 'ok'. - But no Index is present.

When I insert the Index (same Synthax) in the DB-Browser the Index is inserted.

Then executing the script in Lazarus again I get the expected Error (Index already exists).

What do I miss?



I missed the commit !!!!! >:(
« Last Edit: January 24, 2022, 02:10:11 am by ratmalwer »

Zvoni

  • Hero Member
  • *****
  • Posts: 1185
Re: [solved] Sqlite Index is not created
« Reply #1 on: January 24, 2022, 08:49:12 am »
There is a reason, why i use the Connection-Object for all DDL-Statements ("ExecuteDirect").....
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018