Recent

Author Topic: SQLite vacuum statement  (Read 9056 times)

JanRoza

  • Hero Member
  • *****
  • Posts: 618
    • http://www.silentwings.nl
SQLite vacuum statement
« on: July 05, 2010, 12:14:53 am »
On the SQLite website I read that you can use the vacuum statement on a SQLite database.
Can anyone give me an example of how to do this?
In my application I have only TSQLite3Datatsets, so how to perform an Vacuum statement on a whole database?
I know there is the auto-vacuum option but I did not knew that when the database was created and it can only be set at creation time, so that's why I want to use the vacuum statement. Unfortunately i have been unable to find an example.

Any help is welcome.

Jan
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.12 FPC 3.2.0
       CodeTyphon 7.4 FPC 3.3.1

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 458
Re: SQLite vacuum statement
« Reply #1 on: July 05, 2010, 02:38:30 am »
Dataset.ExecSQL('VACUUM');

JanRoza

  • Hero Member
  • *****
  • Posts: 618
    • http://www.silentwings.nl
Re: SQLite vacuum statement
« Reply #2 on: July 05, 2010, 10:52:29 am »
Thanks Luiz.
As a dataset is connected to just one table in the SQLite database, does this mean you can perform this on any dataset and the result will be the whole SQLite database that has been vacuumed?
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.12 FPC 3.2.0
       CodeTyphon 7.4 FPC 3.3.1

JanRoza

  • Hero Member
  • *****
  • Posts: 618
    • http://www.silentwings.nl
Re: SQLite vacuum statement
« Reply #3 on: July 06, 2010, 11:43:20 pm »
Problem solved!
dataset.execsql('VACUUM') indeed compacts not just that dataset but the whole database.
It's easy, once you know it.

 :D
Jan
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.12 FPC 3.2.0
       CodeTyphon 7.4 FPC 3.3.1

 

TinyPortal © 2005-2018