From: Raghuram
Subject: How to store a hash table into  blob data type column.....
Date: 
Message-ID: <c08bb3ef.0310310529.5f1e9f11@posting.google.com>
hi,

  I have a problem with storing a hash table in to blob data type
column and then retreiving hash table back.,..


Could any one please help me.... in storing a hash table into
database...........


Thank you in advance..............

-Raghuram

From: Kenny Tilton
Subject: Re: How to store a hash table into  blob data type column.....
Date: 
Message-ID: <7juob.25847$Gq.7101052@twister.nyc.rr.com>
Raghuram wrote:

> hi,
> 
>   I have a problem with storing a hash table in to blob data type
> column and then retreiving hash table back.,..
> 
> 
> Could any one please help me.... in storing a hash table into
> database...........

What DB are you using? Lisp implementation? OS? etc

kenny

-- 
http://tilton-technology.com

Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film

Your Project Here! http://alu.cliki.net/Industry%20Application
From: Pascal Bourguignon
Subject: Re: How to store a hash table into  blob data type column.....
Date: 
Message-ID: <87ism578ja.fsf@thalassa.informatimago.com>
···············@yahoo.com (Raghuram) writes:

> hi,
> 
>   I have a problem with storing a hash table in to blob data type
> column and then retreiving hash table back.,..
> 
> 
> Could any one please help me.... in storing a hash table into
> database...........
> 
> 
> Thank you in advance..............

Store in the blob column this string:

(format nil "~S" 
    (let ((h (make-hash-table)))
       (setf (gethash :a h) "one")
       (setf (gethash :b h) "two")
      h))

Retrieve it with (read blob-data).


That's the basic principle. Now if you store in the hash table complex
data, you may have to  write addition PRINT-OBJECT methods and perhaps
implement some reader macro. 

Obviously, such a hash table as:

    (let ((h (make-hash-table)))
       (setf (gethash :a h) (lambda (x) (gethash x h)))
       (setf (gethash :b h) "two")
      h)

containing a closure could not be stored this way.

-- 
__Pascal_Bourguignon__
http://www.informatimago.com/
From: Henrik Motakef
Subject: Re: How to store a hash table into  blob data type column.....
Date: 
Message-ID: <868yn1zal9.fsf@pokey.internal.henrik-motakef.de>
Pascal Bourguignon <····@thalassa.informatimago.com> writes:

> >   I have a problem with storing a hash table in to blob data type
> > column and then retreiving hash table back.,..

> Store in the blob column this string:
> 
> (format nil "~S" 
>     (let ((h (make-hash-table)))
>        (setf (gethash :a h) "one")
>        (setf (gethash :b h) "two")
>       h))
> 
> Retrieve it with (read blob-data).

But hash-tables don't neccessarily have a READable representation by
default, so you'd have to provide a PRINT-OBJECT method or some other
way to serialize the hash-table itself (MAKE-LOAD-FORM comes to mind,
but according to the hyperspec, conforming programs may only use it on
standard-objects, structure-objects and conditions) as well to be
portable.