[fpc-pascal] Data persistance in CGI projects

Luciano de Souza luchyanus at gmail.com
Sun Feb 26 17:19:10 CET 2012


Hello all,

For desktop environments, there are mature projects on data persistance. 
Press Objects, TiOPF... desktop developers can be proud of the tools 
they have.

What about CGI environments? Is there something already developed? Yes, 
we can use SQLDB. It's really a very good component. However, we need to 
write lots of SQL. The dream would be something like:

user := TUser.create;
user.name := 'Luciano';
user.age := 36;
user.insert;


I can hide all the SQL statements behind a custom TUser class. I can 
implement it. However, before writing this clear code, I will have to 
type a set of SQL statements. In other words, to simplify, it would be 
necessary to create a mother clas whose properties and methods would be 
use for my custom TUser class.

Of course, it is only a possible approach. I believe this pattern is 
called ActiveRecord. I confess I know little about persistance patterns. 
There is also the DAO pattern. Well, there are certainly several patterns.

My questions concerns exactly to it:

1. What are the alternatives for a CGI environment using a productive 
data persistance? What are your suggestions in terms of units, class or 
either strategies, including the model, the view and the controller?
2. If CGI with Frepascal is still starting and consequently, there 
aren't powerful tools and, therefore, code needs to be implemented, 
which pattern do you recommend? ActiveRecord? DAO? Another?

Well, before starting something, the first step is to listen and I am 
sure, here there is people with a significant higher background than me!

Luciano



More information about the fpc-pascal mailing list