[fpc-pascal] FreePascal as an embedded language in Firebird: possible and desirable?
hakkie42 at gmail.com
Wed Jul 27 09:10:12 CEST 2011
Hi FreePascal and Firebird people,
(Cross-posted to the FPC and Firebird Development mailing lists)
For the upcoming Firebird 3.0 database server release, developers are
working on allowing external languages (at first Java) for writing
stored procedures and functions.
I found this, rather old, reference:
FreePascal (FPC) is an object oriented variant of Pascal that looks very
much like Delphi (in fact, there's a Delphi compatibility switch so you
can port your existing code).
Would it be possible and desirable to have FreePascal as an embedded
stored procedure/trigger language in some future release of Firebird? (I
can't recall this having been brought up before, so I just start the
2. End user considerations
2.1 A lot of developers that use Firebird program in Delphi. As
FreePascal syntax is (almost) identical, these developers can easily
port their code between the database and the application.
2.2 FreePascal may be easier to learn than Java for some people and
would make a nice alternative as opposed to e.g. including C or C++
2.3 FreePascal might not run/is not supported for some platforms that
Firebird 3 will be released for. Perhaps HP-UX? Firebird 2.5 runs on
Windows (x86/x64), Linux versions (x86/x64), Solaris (Sparc and Intel),
HP-UX (PA-Risc) and Mac OSX.
3. Development considerations
I only know enough to make wild guesses... that doesn't stop me from
making them, though.
3.1 Obviously, Firebird must allow running compiled code (as opposed to
running code in a Java Virtual Machine), presumably in a form of dynamic
3.2 Firebird must be modified to include (a stripped down version of?)
the FPC compiler (or store the location of the compiler) and call it
whenever the FreePascal source code in a procedure is changed.
This might not be necessary for production servers as long as embedded
Pascal code is compiled on developer machines and the resulting object
code is loaded into the production database.
3.3 FreePascal will need to have some way to access, manipulate and
return the data in the database and call other Firebird stored
procedures, functions, etc. FPC already has good database access,
including Interbase/Firebird support, but some kind of interface unit
for direct access will need to be added.
3.4 FreePascal will need to use the Firebird memory manager. Using
various memory managers is fortunately already possible in FPC.
3.5 Most importantlY: it will probably require a lot of work on both
ends to get this done. Fortunately, both Firebird and FPC have an active
developer community with good communication and bug tracker systems, so
More information about the fpc-pascal