Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > save object reference in db?

Reply
Thread Tools

save object reference in db?

 
 
Jamal Soueidan
Guest
Posts: n/a
 
      10-27-2008
Hi everyone,

I want to ask if it's possible to save object reference in database for
later use?

Regards,
Jamal
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      10-27-2008
2008/10/27 Jamal Soueidan <(E-Mail Removed)>:
> I want to ask if it's possible to save object reference in database for
> later use?


No, not directly. How should that work?

You either need an OR mapper (for example ActiveRecord) or you store
complete object graphs serialized (via Marshal in a BLOB or YAML in a
CLOB).

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      10-27-2008
Robert Klemme wrote:
> 2008/10/27 Jamal Soueidan <(E-Mail Removed)>:
>> I want to ask if it's possible to save object reference in database for
>> later use?

>
> No, not directly. How should that work?


Well, technically it *is* possible to save object references - see
weakref.rb for an implementation.

But this is almost certainly not what the OP wants (since those object
references won't survive garbage collection, or application restart)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Robert Klemme
Guest
Posts: n/a
 
      10-27-2008
2008/10/27 Brian Candler <(E-Mail Removed)>:
> Robert Klemme wrote:
>> 2008/10/27 Jamal Soueidan <(E-Mail Removed)>:
>>> I want to ask if it's possible to save object reference in database for
>>> later use?

>>
>> No, not directly. How should that work?

>
> Well, technically it *is* possible to save object references - see
> weakref.rb for an implementation.


Hey, normally *I* am supposed to be the nitpick! What's the point in
storing something that you cannot reasonably retrieve? This is only
useful for a WOM. *gg*

> But this is almost certainly not what the OP wants (since those object
> references won't survive garbage collection, or application restart)


Exactly!

Kind regards

robert


--
remember.guy do |as, often| as.you_can - without end

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save an object Reference to DOM poldo Javascript 1 02-20-2008 03:02 PM
"Object reference not set to an instance of an object" Weird thing happens with reference a link nguyentrongkha@gmail.com ASP .Net 1 09-20-2007 09:46 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
How to save reference to an native-object (c++) Cengiz Java 2 07-26-2003 01:20 AM
How to save reference to an native-object (c++) Cengiz Java 0 07-25-2003 12:11 PM



Advertisments