Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Databases
»
SOLVED SQLite vacuum
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Hello! Anything new?
by
440bx
[
Today
at 05:14:43 pm]
could Ardour's YTK be use...
by
Fred vS
[
Today
at 04:59:52 pm]
Debian releases a Gtk3 La...
by
PascalDragon
[
Today
at 04:23:48 pm]
[SOLVED] GTK3 : Icons hav...
by
zeljko
[
Today
at 02:59:43 pm]
Any way to "embed" Window...
by
myisjwj
[
Today
at 02:50:41 pm]
Problem with drawing orde...
by
VisualLab
[
Today
at 02:03:37 pm]
mORMot again (HttpServer/...
by
ttomas
[
Today
at 12:45:49 pm]
Getting results from sql ...
by
Zvoni
[
Today
at 11:51:41 am]
Is it me or is there some...
by
Martin_fr
[
Today
at 11:48:04 am]
Exiting HeapTrace dump
by
jamie
[
Today
at 11:34:49 am]
CONCAT formula
by
Zvoni
[
Today
at 08:17:21 am]
emuloader: help to resurr...
by
arcadegamer
[March 15, 2026, 08:30:31 pm]
AutoSize TMemo.Height?
by
wp
[March 15, 2026, 05:55:05 pm]
Initialization & finaliza...
by
Martin_fr
[March 15, 2026, 05:24:36 pm]
Possible Enhancement to t...
by
jamie
[March 15, 2026, 04:10:38 pm]
lazarus 4.99 and missing ...
by
wp
[March 15, 2026, 03:11:43 pm]
Questions about TFuncSeri...
by
hedgehog
[March 15, 2026, 06:58:29 am]
CryptoLib4Pascal
by
Xor-el
[March 14, 2026, 06:17:32 pm]
Extended Module Player
by
Gigatron
[March 14, 2026, 05:32:06 pm]
[AGGPas] Difference betwe...
by
Roland57
[March 14, 2026, 04:36:02 pm]
declaring Array
by
Thaddy
[March 14, 2026, 01:24:11 pm]
TChart: Wrong default val...
by
wp
[March 14, 2026, 11:30:54 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: SOLVED SQLite vacuum (Read 26062 times)
xinyiman
Hero Member
Posts: 2261
SOLVED SQLite vacuum
«
on:
January 13, 2011, 05:16:43 pm »
How do I implement the command in sqlite vacuum? Thanks
«
Last Edit: January 19, 2011, 04:05:43 pm by xinyiman
»
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #1 on:
January 14, 2011, 01:44:10 pm »
I can not believe no one has ever hit upon the problem of having to compress the sqlite database to clean it and reduce it in size. Can anyone tell me how?
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
DirkS
Sr. Member
Posts: 251
Re: SQLite vacuum
«
Reply #2 on:
January 14, 2011, 01:51:21 pm »
AFAIK you just execute 'VACUUM' as any other SQL statement...
Gr.
Dirk.
Logged
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #3 on:
January 14, 2011, 01:52:50 pm »
Using a TSqlQuery? Make me an example?
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #4 on:
January 14, 2011, 02:34:49 pm »
Q_Vacuum.SQL.Text:='vacuum';
Q_Vacuum.ExecSQL;
Errore:
cannot vacuum from within a transaction.
Why?
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #5 on:
January 14, 2011, 03:03:08 pm »
I have solved my problem by removing the CommitRetaining because both use the SQLite database in my program as a support to close the program so he does not write data to the db and are in place. But I want to know how to fix it for possible future projects. Thanks
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
garlar27
Hero Member
Posts: 652
Re: SQLite vacuum
«
Reply #6 on:
January 14, 2011, 03:05:10 pm »
Have you read
http://www.sqlite.org/lang_vacuum.html
?
Maybe, you have a connection opened, or have something that prevents you from doing that.
If I need to do a vacuum, I would do it like this:
Code: Pascal
[Select]
[+]
[-]
SQLite3Connection1
.
ExecuteDirect
(
'VACUUM'
)
;
Logged
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #7 on:
January 14, 2011, 03:16:16 pm »
Well of course I have an open connection, how can I send the command sql otherwise?
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
garlar27
Hero Member
Posts: 652
Re: SQLite vacuum
«
Reply #8 on:
January 14, 2011, 08:14:15 pm »
You're right
Logged
JanRoza
Hero Member
Posts: 739
Re: SQLite vacuum
«
Reply #9 on:
January 14, 2011, 11:56:12 pm »
Using SQLitedataset I compress my database via
Code:
[Select]
tblVluchten.ExecSQL('VACUUM');
Executing this SQL on just one table of the database compresses the whole database.
Just my 5 cents of advice.
Logged
OS: Windows 11 / Linux Mint 22.3
Lazarus 4.6 RC FPC 3.2.2
CodeTyphon 8.90 FPC 3.3.1
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #10 on:
January 19, 2011, 11:29:35 am »
Please write a function that opens the connection to run the sqlite vacuum and closes the connection to the db. Assume that the db is called richard and is located in the executable.
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
xinyiman
Hero Member
Posts: 2261
Re: SQLite vacuum
«
Reply #11 on:
January 19, 2011, 04:05:28 pm »
Solved,
uses ..., sqlite3ds;
procedure TForm1.MyVacuum();
var
dsLite : TSqlite3Dataset;
begin
dsLite := TSqlite3Dataset.Create(nil);
dsLite.FileName:='db' + SepDir + 'settaggi.s3db';
dsLite.ExecSQL('VACUUM;');
dsLite.Free;
end;
Thank you
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Databases
»
SOLVED SQLite vacuum
TinyPortal
© 2005-2018