Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Execute Ruby code stored in database
Petr Janda
1/6/2008 1:02:00 PM
Hi,
I've got a hypothetical question, and im hoping someone can answer it.
Let's say ive got a MySql server and I store some Ruby code inside a
column/table/database. Is there anyway I can load this data from a Ruby
program and execute the code as if it was a part of the program?
Cheers,
Petr
--
Posted via
http://www.ruby-...
.
2 Answers
hemant
1/6/2008 1:14:00 PM
0
On Jan 6, 2008 6:31 PM, Petr Janda <petr@punchyouremployer.com> wrote:
> Hi,
> I've got a hypothetical question, and im hoping someone can answer it.
> Let's say ive got a MySql server and I store some Ruby code inside a
> column/table/database. Is there anyway I can load this data from a Ruby
> program and execute the code as if it was a part of the program?
>
One obvious way is to use 'eval'
--
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.
http://g...
John Joyce
1/8/2008 12:54:00 PM
0
On Jan 6, 2008, at 7:01 AM, Petr Janda wrote:
> Hi,
> I've got a hypothetical question, and im hoping someone can answer it.
> Let's say ive got a MySql server and I store some Ruby code inside a
> column/table/database. Is there anyway I can load this data from a
> Ruby
> program and execute the code as if it was a part of the program?
>
> Cheers,
> Petr
> --
> Posted via
http://www.ruby-...
.
>
There could be a few ways to do this.
One method would be actually loading that text to a string, and the
string having a file name like name. Then use try to "load
that_string.rb"
No idea if that would work.
The method that would work for sure, get data from DB, save it as
a .rb text file, "load" the file. Of course, that's pointless if you
have to do all of that.
If you just want snippets of code, use eval on the snippets loaded
from DB.
Generally speaking, the file system of the OS is going to be faster
than any DB.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Execute Ruby code stored in database
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password