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
FpDebug: Bugs and API gap...
by
MattBradford
[
Today
at 05:46:43 pm]
Lazarus Bugfix Release 4....
by
wp
[
Today
at 04:47:58 pm]
LRS Explorer
by
wp
[
Today
at 04:02:45 pm]
Which Linux version
by
cdbc
[
Today
at 03:47:53 pm]
Cross platform DirectoryW...
by
LemonParty
[
Today
at 03:45:45 pm]
TDWEdit
by
docno
[
Today
at 03:35:02 pm]
BS Controls – Silly Compo...
by
Xenno
[
Today
at 02:30:43 pm]
Separators in the compone...
by
JuhaManninen
[
Today
at 01:28:05 pm]
Lazarus, Ubuntu Pi 4 and ...
by
Thaddy
[
Today
at 12:07:04 pm]
Clean up and build
by
CM630
[
Today
at 11:20:21 am]
Unleashed Pascal (async/a...
by
creaothceann
[
Today
at 11:11:47 am]
AsyncProcess not firing O...
by
Martin_fr
[
Today
at 11:05:52 am]
Is it possible to communi...
by
Xor-el
[
Today
at 10:28:59 am]
[Qt5/Qt6] JPSupport-Qt: J...
by
shortcut
[
Today
at 09:10:24 am]
How to avoid duplicates i...
by
mig-31
[August 13, 2026, 05:35:46 pm]
QGradientTrackPanel: A Fu...
by
Ed78z
[August 13, 2026, 04:49:24 pm]
Memory location
by
Thaddy
[August 13, 2026, 04:01:56 pm]
TurboBird IBX
by
laguna
[August 13, 2026, 03:55:51 pm]
TlsLib4Pascal
by
Xor-el
[August 13, 2026, 03:06:13 pm]
MR - DebuggerIntf for ter...
by
Martin_fr
[August 13, 2026, 12:54:22 pm]
var vs out (including "co...
by
kupferstecher
[August 13, 2026, 12:49:22 pm]
AArch64, load a constant ...
by
LemonParty
[August 13, 2026, 12:31:06 pm]
Lazarus undead repository...
by
Dankan1890
[August 13, 2026, 10:28:54 am]
[RE-SOLVED] Splitting an ...
by
paweld
[August 13, 2026, 09:52:15 am]
Why does Free Pascal use ...
by
MarkMLl
[August 13, 2026, 09:30:40 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: SOLVED SQLite vacuum (Read 26290 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: 755
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