PureBasic SQLite Database: A Quick Tutorial

Share your advanced PureBasic knowledge/code with the community.
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

jacdelad wrote: Mon Aug 12, 2024 5:24 pm This would a great addition to the help.
Thanks for your kind endorsement, jacdelad. :D

Or at the very least a sticky, perhaps. :lol:

+1
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: PureBasic SQLite Database: A Quick Tutorial

Post by Kiffi »

TI-994A wrote: Tue Aug 13, 2024 6:52 amOr at the very least a sticky, perhaps.
[X] Done
Hygge
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

Kiffi wrote: Tue Aug 13, 2024 10:39 am
TI-994A wrote: Tue Aug 13, 2024 6:52 amOr at the very least a sticky, perhaps.
[X] Done
Hi Kiffi. In all honesty, I was simply jesting. :lol:

Nevertheless, I'm glad it's helpful. Thank you, kindly. :D
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by Fred »

Your second topic at the top :D. Well deserved !
User avatar
jacdelad
Addict
Addict
Posts: 1992
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: PureBasic SQLite Database: A Quick Tutorial

Post by jacdelad »

It is well written and touches all the basics. The only thing that could be added, at least in my eyes, is how to use a database which is not written to a file, but into memory (for temporary usage).
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

Fred wrote: Tue Aug 13, 2024 12:09 pmYour second topic at the top :D. Well deserved !
jacdelad wrote: Tue Aug 13, 2024 12:28 pmIt is well written and touches all the basics. ...
Very kind words, both of you. I'm truly obliged. :D
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

jacdelad wrote: Tue Aug 13, 2024 12:28 pm...how to use a database which is not written to a file, but into memory (for temporary usage).
Hi jacdelad. An in-memory database works exactly like a normal file-based one. The only difference is, like you said, it's temporary. All the processed data will be lost when the program terminates unless it's saved to file.

To use an in-memory database, simply replace the database file name with the :memory: directive - that's all! Everything else works exactly the same way.

Code: Select all

OpenDatabase(#sqLite, ":memory:", "", "")

Here's a simple, working example which I had posted a few years ago, demonstrating an in-memory database in action:

> In-Memory SQLite Example

I hope it's helpful. :D
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: PureBasic SQLite Database: A Quick Tutorial

Post by Fangbeast »

Good stuff TI-994A, nicely done examples.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

Fangbeast wrote: Thu Aug 15, 2024 1:32 pm Good stuff TI-994A, nicely done examples.
Hi Miki. Trust you are well, dear friend.

I'm glad you think so; thank you. Just sharing all that I've learned here. :D
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
jacdelad
Addict
Addict
Posts: 1992
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: PureBasic SQLite Database: A Quick Tutorial

Post by jacdelad »

TI-994A wrote: Thu Aug 15, 2024 11:12 am
jacdelad wrote: Tue Aug 13, 2024 12:28 pm...how to use a database which is not written to a file, but into memory (for temporary usage).
Hi jacdelad. An in-memory database works exactly like a normal file-based one. The only difference is, like you said, it's temporary. All the processed data will be lost when the program terminates unless it's saved to file.

To use an in-memory database, simply replace the database file name with the :memory: directive - that's all! Everything else works exactly the same way.

Code: Select all

OpenDatabase(#sqLite, ":memory:", "", "")

Here's a simple, working example which I had posted a few years ago, demonstrating an in-memory database in action:

> In-Memory SQLite Example

I hope it's helpful. :D
Hi TI-994A,
I already knew that. :wink: I just thought this would be a great addendum to your tutorial, like a last chapter with some tipps and tricks.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
User avatar
TI-994A
Addict
Addict
Posts: 2699
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PureBasic SQLite Database: A Quick Tutorial

Post by TI-994A »

jacdelad wrote: Thu Aug 15, 2024 3:09 pm... I just thought this would be a great addendum to your tutorial, like a last chapter with some tipps and tricks.
That makes more sense. Great suggestion! Thank you, jacdelad.

Done! :D
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Post Reply