PostgreSQL module

Started by jeremyc, March 09, 2007, 06:35:33 AM

Previous topic - Next topic

jeremyc

I have created pgsql.lsp that accesses PostgreSQL from newLISP.  I am planning on doing some more work on it this weekend. I have not officially released the code, but I would like if those interested would review the code and offer any suggestions. I am a new newLISP programmer and in many ways, a new LISP programmer as well, so I am sure some things will stick right out and grab you that I may not find for a while.



The code is located at: http://jeremy.cowgar.com/index.cgi?page=newLispAndPostgreSQL">http://jeremy.cowgar.com/index.cgi?page ... PostgreSQL">http://jeremy.cowgar.com/index.cgi?page=newLispAndPostgreSQL



Any input would be greatly appriciated. Please post your comments here.



Thansk,



Jeremy

cormullion

#1
I don't know anything about PostgreSQL, but I like to make comments if possible, so...



Have you seen Lutz' clever library detection routine, in crypto.lsp?


(set 'files '(
"/usr/lib/libcrypto.so"
"/usr/lib/libcrypto.so.0.9.8"
"/usr/lib/libcrypto.so.0.9.7"
"/usr/lib/libcrypto.so.0.9.6"
"/usr/lib/libcrypto.so.4"
"/usr/lib/libcrypto.dylib"
))

(set 'library (files (or
(find true (map file? files))
(begin (println "cannot find crypto library") (exit)))))


I thought it was a clever way to specify libraries by name rather than platform...



Also, I haven't checked your date-time stuff closely (not knowing what it's doing) but I noticed that you're using int without specifying the number base. I've documented my own troubles with this (http://newlisper.blogspot.com/2006/09/my-mistake.html">//http://newlisper.blogspot.com/2006/09/my-mistake.html), so I hope you don't have similar problems. You could test the routines for a time every hour for a year...

Lutz

#2
... and regarding the date-to-ts and datetime-to-ts routines, look into the new:



http://newlisp.org/downloads/newlisp_manual.html#parse-date">http://newlisp.org/downloads/newlisp_ma ... parse-date">http://newlisp.org/downloads/newlisp_manual.html#parse-date



just like 'date', 'parse-date' can take formatting characters and make those last two conversion functions as simple as the previous two.



Lutz