PostgreSQL module

Notices and updates
Locked
jeremyc
Posts: 33
Joined: Wed Dec 06, 2006 3:33 am

PostgreSQL module

Post 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

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post 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...

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Locked