SQLdb Tutorial4

From Free Pascal wiki
Revision as of 05:59, 4 May 2013 by Pascalvr (talk | contribs)
Jump to navigationJump to search


INTRODUCTION

This tutorial is an attempt to demonstrate the use of Lazarus DataModules to isolate the Data Access components of a project from the program logic associated with the access. Such isolation makes program maintenance and debugging easier. This tutorial was developed using Windows 7 and SQLite3 as the database, with Lazarus 1.0.8 with FPC 2.6.2, however it should work with earlier versions. Similarly, other DBMS and Operating Systems should require minimal change.

WHAT IS A DATAMODULE?

A DataModule allows the collection of any NON-VISUAL components. Datamodules cannot contain visual components, such as TEDIT. TSTRINGGrid. DBGrid, etc - but can contain non-visual components like DBConnect, DBTransaction, etc.


WHY USE DATAMODULES?

Simple - after following the Lazarus Tutorials: Tut1 Tut2 Tut3

Developing a 'real' application becomes harder. 'Form1' grows to an exponential size handling the different Events and Database Queries. By isolating each Table access into a single DataModule makes debugging and maintenance so much easier