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
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
···············@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/
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.