Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

PascalHelloLazarusDatabase

Hello World For Lazarus Pascal IDE with SQLite3 database access

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

PascalHelloLazarus

This is a "Hello World" for an SQLite3 database coded using the free, opensource Lazurus, which includes the Free Pascal Compiler included. with the Free Pascal Compiler (see FreePascal.org. I undertook this project for two reasons:

  1. Because I was interviewing for a job requiring the use of Pascal (in 2023!)
  2. I wanted to review SQL databases.

Features Demonstrated

  • Basic CRUD use of a relational SQL Database, including auto-create database file from a .sql resource file
  • Use of Lazarus IDE forms and database aware components
  • Basics of the Object Pascal Language including multiple units, classes, interfaces

Design Specifications

This is designed to be the simplest possible SQL database. There are three relational tables: People, PhoneNumbers, and PhoneTypes. You can Add, Edit, and Delete People and Phone Numbers.

The full design is available in the "Hello Contacts Database Design" repo. (TBD)

Screenshot

What I Learned

Although the IDE was sometimes glitchy, requiring restarts in order to create new form event methods, overall it was a decent programming experience. Cross-platform support is present, such as resource files for images, and ability to create the database file in an OS-Recommended location

The Pascal Language is a capable object oriented languge, and the "drag and drop" design experience is Familiar to anyone that has used Borland programming environments (Turbo-C anyone?) or Windows Forms.

While these environments are fun to program in, they tend to mash together UI code and core logic unless care is taken. I approached this as follows

  • Minimize USE of SQL in the component designer and form files
  • Instead, place most SQL in a separate "Utils" module

Attributions