Friday, January 17, 2014

FreePascal/Lazarus book: Start programming using Object Pascal by Motaz Abdel Azeem

This is a free PDF English book about Free Pascal / Lazarus for beginners.
Introduction
This book is written for programmers whom want to learn Object Pascal Language. Also it is suitable as a first programming book for new students and non-programmers.
It illustrates programming techniques as general in addition to Object Pascal Language.
License:
License of this book is Creative Commons.
Chapters:
  1. Language Basics
  2. Structured Programming
  3. GUI
  4. Object Oriented Programing
License: Creative commons
By Motaz Abdel Azeem

How to start with FireBird database using FreePascal/Lazarus

This is a very easy and simple

1.Drop TIBConnection component from SQLdb page in a form or data module.

2.Drop a button, and write this code in button’s OnClick event:


procedure TForm1.Button1Click(Sender: TObject);
begin
  IBConnection1.DatabaseName:= '/home/motaz/firebird/newdb.fdb';
  IBConnection1.CharSet:= 'UTF8';
  IBConnection1.UserName:= 'sysdba';
  IBConnection1.Password:= 'masterkey';
  IBConnection1.CreateDB;
end;
This will create an empty FireBird database in the location you have specified in DatabaseName property, with UTF8 character set.

3.Later you can create tables, generators, indexes,  and constraints using SQLQuery component example:


create table BOOKS (
  BOOKID INTEGER not null ,
  BOOKNAME VARCHAR(52) ,
  CONTENTS BLOB,
  LOCATION VARCHAR(55)
  , constraint PK_BOOKS_1 primary key (BOOKID)
);

This will create a new table called Books. You need to put this DDL script in SQL property of SQLQuery component that linked to your IBConnection.