README 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. Squee! Simple PostgeSQL bindings for Guile!
  2. ============================================
  3. What's Squee? Squee is a library for connecting to the excellent
  4. PostgreSQL database using Guile. It uses Guile's "foreign function
  5. interface" support, which means you don't need to compile
  6. anything... it all happens through the magic of dynamic linking!
  7. The project is released under the GNU Lesser Public License, version 3
  8. or later (as published by the FSF), just like Guile itself.
  9. Using
  10. -----
  11. ;; Make a connection to the database
  12. (define conn (connect-to-postgres-paramstring "dbname=sandbox"))
  13. ;; Select some stuff from the database
  14. (exec-query conn "SELECT * FROM animals")
  15. ; -> (("1" "monkey" "Almost a human" "ooh ooh") ("3" "parrot" "pretty noisy" "ba-kwaw"))
  16. ;; Select, but substitute in a variable
  17. (exec-query conn "SELECT * FROM animals where NAME = $1" '("monkey"))
  18. ; -> (("1" "monkey" "Almost a human" "ooh ooh"))
  19. Technically these functions return multiple values, so if you
  20. "receive" the second parameter, you also can get metadata about your
  21. query.
  22. Queries that don't return rows (as in CREATE or DELETE statements)
  23. will simply return #t, so keep that in mind!
  24. That's about it for now, more to come soon.