Recent

Author Topic: Question about database with source code examples  (Read 836 times)

Conrad_404

  • Newbie
  • Posts: 3
Question about database with source code examples
« on: November 02, 2024, 12:35:44 pm »
Hi,
I am a new Lazarus user. I am mainly interested in programming for Windows (WinAPI mainly). I previously used TMT Pascal for years, and was very happy about it, but it is no longer supported and currently lacks many modern components. However, switching requires knowing the differences between both environments. I would like to ask if there is anywhere a database with source code of simple programs for learning purposes.
Best Regards
Conrad

Handoko

  • Hero Member
  • *****
  • Posts: 5374
  • My goal: build my own game engine using Lazarus
Re: Question about database with source code examples
« Reply #1 on: November 02, 2024, 01:15:33 pm »
Hello Conrad_404,
Welcome to the forum.

If you haven't used any database, you probably can start with TDbf. TDbf probably is the easiest for beginners, unfortunately it is lack of several modern features like multi client connections, poor/no support for mutibyte characters, transaction concept, etc. TDbf is installed by default Lazarus installation, but you have to manually enable it.

To enable TDbf in Lazarus:
Lazarus main menu > Package > Install/Uninstall Packages > in the right pane, select "DBFLaz 0.0.1" > Install selected > Save and rebuild IDE > wait and then your Lazarus will be restarted

If you want to learn/use TDbf, you should download the documentation tdbf.pdf, which can be easily found and downloaded from the Internet.

If you already have some knowledge in database programming, you may want to try SQLite or Firebird, which support Structured Query Language. Each database has their own advantages and disadvantages. I recommend SQLite and Firebird for beginners because they are relatively easy to start with. If you want to learn and use SQL-based database, I recommend this link:
https://www.w3schools.com/sql/

This is a list of all databases supported by Lazarus:
https://wiki.freepascal.org/Databases#Supported_databases

For new user in Lazarus/Pascal, I recommend this link, which has plenty of demos for doing simple tasks:
https://wiki.freepascal.org/Portal:HowTo_Demos

And here are demos for TDbf:
https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249361.html#msg249361
https://forum.lazarus.freepascal.org/index.php/topic,37181.msg249208.html#msg249208

And these SQLite demos:
https://forum.lazarus.freepascal.org/index.php/topic,65185.msg496461.html#msg496461
« Last Edit: November 02, 2024, 01:22:06 pm by Handoko »

silvercoder70

  • Jr. Member
  • **
  • Posts: 88
    • Tim Coates
Re: Question about database with source code examples
« Reply #2 on: November 02, 2024, 01:30:37 pm »
You could also have a look at my video here ...

https://www.youtube.com/watch?v=mPvTyTbX2Ko

It uses SqLite but also talks about the component used.
Explore the beauty of modern Pascal programming with Delphi & Free Pascal - https://www.youtube.com/@silvercoder70

Conrad_404

  • Newbie
  • Posts: 3
Re: Question about database with source code examples
« Reply #3 on: November 02, 2024, 03:33:54 pm »
Thank you for your reply! One more question: is there any repository with sample fpc/lazarus code sources (various topics)?

cdbc

  • Hero Member
  • *****
  • Posts: 1644
    • http://www.cdbc.dk
Re: Question about database with source code examples
« Reply #4 on: November 02, 2024, 03:41:39 pm »
Hi
Yes, have a look in the 'Examples' directory under 'Lazarus' install-dir...
Regards benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

Handoko

  • Hero Member
  • *****
  • Posts: 5374
  • My goal: build my own game engine using Lazarus
Re: Question about database with source code examples
« Reply #5 on: November 02, 2024, 05:55:52 pm »
Thank you for your reply! One more question: is there any repository with sample fpc/lazarus code sources (various topics)?

I already gave you the link.

Conrad_404

  • Newbie
  • Posts: 3
Re: Question about database with source code examples
« Reply #6 on: November 02, 2024, 10:11:11 pm »
Thanks again!

Zvoni

  • Hero Member
  • *****
  • Posts: 2737
Re: Question about database with source code examples
« Reply #7 on: November 04, 2024, 08:18:08 am »
If you haven't used any database, you probably can start with TDbf. TDbf probably is the easiest for beginners, unfortunately it is lack of several modern features like multi client connections, poor/no support for mutibyte characters, transaction concept, etc. TDbf is installed by default Lazarus installation, but you have to manually enable it.
DBF is NOT a Database. Period.
DBF is a ... "storage system".... for lack of a better description.

Go with SQLite. Parallel learning of SQL is.... "advised"....
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

CharlyTango

  • Jr. Member
  • **
  • Posts: 90
Re: Question about database with source code examples
« Reply #8 on: November 06, 2024, 10:12:48 am »
I agree with @Zvoni

If you are new to programming database frontends don't waste time for DBF.
This type of data storage derives from a time where real databases could not be managed on personal computers and DBF was the answer or a workaround.

Nowadays SQLite ist a very easy and convenient was to be used as a data storage system.
The learning curve is a bit steeper than DBF but has the advantage that you learn and use a modern way.
Lazarus stable, Win32/64

 

TinyPortal © 2005-2018