1

In order to make an online compiler, I want to compile a piece of code and send back the result.

Instead of giving the path to the hard disk, can I call a query which in return compiles the code (not by giving any links to javac hard disk location) but the files located in DB (BLOB).

  • Is it possible?
  • Is it OK to follow this approach ?
  • What system online compilers does usually follow?
bwegs
  • 3,769
  • 2
  • 30
  • 33
Rohan Sethi
  • 115
  • 1
  • 2
  • 9
  • I cannot follow your use case, but in Oracke DB you have triggers (trigger an action when a row is inserted) and stored procedures, that may run a shell script that may compile source code from a blob column. – PeterMmm Sep 27 '14 at 15:24

1 Answers1

2

Most databases allow you to create user defined functions. You could define such a UDF taking source code as the input and returning object code as the output.

This seems kind of pointless though since you are pushing this non-analytical computation into the database which is not designed yo do such things, whereas pulling the source from the database and writing the object code back is likely as efficient and much easier to implement and maintain.

Simon Fischer
  • 1,154
  • 6
  • 22
  • yeah - kind of pointless ... i was seduced to ask why an DB is used anyway to remote-compile code... but thanks to your answer i didn't have to ^^ – Martin Frank Sep 27 '14 at 15:40