CodeProducer - v0.2 - 2007
by Marcello Esposito (supix[at]
Download Page:

1. What is CodeProducer?

CodeProducer is a frameword which, starting from abstract data type definitions,
produces the following code:

- SQL table creation statements;
- class definitions;
- a coherent interface for the persistence module;
- the persistence module implementation.

This way, it provides seamless persistence services, fully encapsulating the SQL

Currently, the only supported programming language is Delphi. Supported SQL engines
are Oracle and MySQL (soon MSSQL).

Differently from other similar products, CodeProducer does not create a layer capable of
building SQL statements on the fly, during application runtime, whenever a SQL statement
has to be issued. It generates all the necessary, ready-to-use, SQL statements only once,
at design time, and embeds them in the persistence module methods implementations.

2. How to use CodeProducer?

This is a very minimal version, just to demonstrate the approach.

If you want to start from a sample project file, choose File/Open and
select the project file "example.cpr" from the dialog box.
Then, choose Produce from the code menu.

You will see, on separate tabs:
-) SQL table creation statements;
-) Data structure definitions;
-) DB-FrontEnd module interface;
-) DB-FrontEnd module methods implementation.

Otherwise, if you want to start from scratch, then:

1) Try putting some entities on the working area.
2) Populate them with attributes (using popup menu on the entity windows).
3) Connect them by means of some master-detail relations
(relations can be established trough drag and drop; you
must start dragging from String attributes).
4) Choose Produce from the Code menu.

3. How to use produced code

Cut and paste the produced code into your (delphi?) project:
- SQL table creation statements must be copied into the component in
charge of creating the application database (e.g. TSQLScript);
- Data structure definitions must be copied into a commonly-used unit
(e.g. UTypes) in order to give all other units access to domain classes
- DB-FrontEnd interface is the programming interface of your
persistence module (e.g. TDataModule); it should be copied into the
public section of the class implementing the DB frontend;
- DB-FrontEnd methods implementation, to be copied in the implementation
section of the unit containing the DB frontend declaration. Method
implementation implicitly uses a Query component instance, whenever a SQL
statement is issued. So you have to define such a component according
to your DBMS connection implementation (e.g. place it onto the DataModule
acting as DB frontend).

Once done with this steps you have a fully working lowermost layer in your
n-tier application. With CodeProducer you get the benefits of a well modularized
software project without renouncing to the RAD approach.

4. Supported features

o Target programming code in Delphi
o Target SQL statements for Oracle, MySQL and (almost) MSSQL
o Storage, retrieval, deletion and records browsing
o Logical deletion of records
o Referential integrity
o Tables primary indexes managed trough GUIDs

5. To do list

o GUI can be (hugely) improved
o support for other programming languages (e.g. C++)
o support for other DBMS engines
o persistency module should contain more powerful methods for records filtering
o support for cursors
o managing concurrency in data access

6. How to contact the author

Comments are welcome: send an e-mail to mesposit[at] or supix[at]

7. License

CodeProducer is free software released under the GNU/GPL license; you can redistribute
CodeProducer and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License, or (at your option)
any later version.