Issue Details (XML | Word | Printable)

Key: CORE-3571
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: JimBeam
Votes: 6
Watchers: 7

If you were logged in you would be able to see more operations.
Firebird Core

FreePascal as an embedded language in Firebird

Created: 09/Aug/11 02:22 PM   Updated: 09/Aug/11 02:27 PM
Component/s: Engine, ISQL, Security
Affects Version/s: 3.0 RC2
Fix Version/s: None

 Description  « Hide
0. Background
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).
Firebird is an open source relational database derived from Interbase.

1. FreePascal as an embedded language in Firebird
For Firebird, FreePascal could be a good embedded language (for writing stored procedures/functions/triggers) next to e.g. Java.

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
library. This will have obvious security implications; on the Firebird dev
mailing list just trusting the code, sandboxes, restriction of used units,
different levels of trust as implemented in PostgreSQL, code signing
was discussed.

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
this helps.

4. More information/collaboration
Please see further discussion following from my 27 July 2011 post to the
fpc mailing list
and Firebird development list:
(Mostly on the Firebird list).

Firebird issue/feature/request:
FreePascal issue/feature request:

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.