How can I execute code stored in a database?

How can I store, for example, the body of a method in a database and later run it? (I'm using Delphi XE2, maybe RTTI will help.)

+5
source share
2 answers

RTTI is not a complete language translator. Delphi is a compiled language. You write it, compile and distribute only your binaries. If you are not Embarcadero, you do not have permission to distribute DCC32 (command line compiler).

However, the JVCL includes a delphi-like language subset wrapped in a very easy-to-use component called "JvInterpreter". You can write code (like pascal) and put it in a database. Then you can “run this code” (interpret, not compile) that you retrieve from the database. Usually these should be procedures that call methods in your code. You need to write some “wrappers” that expose the compiled APIs that you want to provide to the interpreter (provide access to live data or database connection objects or table / query objects). Do you think this sounds completely correct? Well, this is a trap.

, ". 9 , , . , , , " ", DSL .

, "DLL, blob field", , , . , - . YAGNI ( ) KISS (keep-it-simple-smartguy).

, - , , .

+6

, IMHO, .

dll dll . dll ram , , LoadLibrary, . dzlib. , - dll Windows, , .

+2

All Articles