Page 1 of 1

PostgreSQL module

Posted: Fri Mar 09, 2007 2:35 pm
by 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 ... PostgreSQL

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

Thansk,

Jeremy

Posted: Sat Mar 10, 2007 3:07 pm
by cormullion
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?

Code: Select all

(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), so I hope you don't have similar problems. You could test the routines for a time every hour for a year...

Posted: Sat Mar 10, 2007 3:53 pm
by Lutz
... and regarding the date-to-ts and datetime-to-ts routines, look into the new:

http://newlisp.org/downloads/newlisp_ma ... 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