How do I insert a list into a single field of a single record in the database? Trying to insert (A B C) yields type errors if database type is set to text or varchar.
Is there another data type I should use? Does the list need to be modified somehow?
I need to be able to store and retrieve a list as easily as possible.
Thanks.
Mark Slamin
Hi Mark,
Attila's idea works, or you could create a specific table mapping keys to multiple elements (which stores sets, not lists), or you could try Postgres' array types -- but that would require writing some extra code, since Postmodern doesn't come with readers and writers for those.
Cheers, Marijn
2008/9/24 Mark Slamin mslamin@gmail.com:
How do I insert a list into a single field of a single record in the database? Trying to insert (A B C) yields type errors if database type is set to text or varchar. Is there another data type I should use? Does the list need to be modified somehow? I need to be able to store and retrieve a list as easily as possible. Thanks. Mark Slamin _______________________________________________ postmodern-devel mailing list postmodern-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
On Tue, 23 Sep 2008 17:19:21 -0500, mslamin@gmail.com wrote:
How do I insert a list into a single field of a single record in the database?
Besides the other mentioned solutions, declare a blob field and insert it as a string. That way it is simple to read when using any SQL tool to view the database.
select tm,runs from mlb where tm="DET" order by key desc limit 1;
+-----+---------------------+ | tm | runs | +-----+---------------------+ | DET | (0 0 0 0 0 0 0 0 0) | +-----+---------------------+
later, read-from-string fixes you up.
Thanks to all for the ideas. Ends up GP Lisper's was the easiest for me to implement.
I'm new to postgreSQL and Postmodern, and semi-new to Lisp, so I really appreciate the help.
Thanks again,
Mark
postmodern-devel@common-lisp.net