PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Execute Ruby code stored in database
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Execute Ruby code stored in database

Réponse
 
LinkBack Outils de la discussion
Vieux 06/01/2008, 13h01   #1
Petr Janda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Execute Ruby code stored in database

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-forum.com/.

  Réponse avec citation
Vieux 06/01/2008, 13h14   #2
hemant
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Execute Ruby code stored in database

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://gnufied.org

  Réponse avec citation
Vieux 08/01/2008, 12h54   #3
John Joyce
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Execute Ruby code stored in database


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-forum.com/.
>

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.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h09.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12496 seconds with 11 queries