Squile 1.0- GETTING SQUILE You can get the latest version of squile from ftp://tomato.nvgc.vt.edu/pub/squile INSTALLATION See the INSTALL file. USAGE Squile is a module for guile that allows guile to interact with sql databases. The guile interface is very simple, but (I hope) also powerful. There are only three commands: sql-create, sql-query, and sql-destroy. At this point, squile supports the MySQL and mSQL engines. If you actually use this thing and need other functionality, including more functions or support for other database, either let me know, and I'll see what I can do, or add it yourself and send me the changes ! ** syntax: (sql-create [] [] []) example: (sql-create "addresses") example: (sql-create "addresses" "address-server" "joe" "bonzo") sql-create creates a connection to the sql engine and selects the given database. The last three arguments are optional. sql-create returns a number that is the id of the newly created database. I know that creating new connections is relatively expensive in comparison to just selecting different databases, but I don't think that people switch between different databases with great frequency. For my use, at least, the small sacrifice in time is easily worth the increased simplicity of a single function to connect to the sql engine and select the db. Note from Monty of MySQL fame: > One can always change database with the query 'use new_databases' ** syntax: (sql-destroy ) example: (sql-destroy 0) example: (sql-destroy db) sql-destroy destroys a database created with sql-create. In addition to freeing up a small amount of memory, sql-destroy closes the connection to the database, so you really should be sure to call this where appropriate. If people actually use this package or if I get the gumption, I might look into making the sql database object collectable, so this destroy call would not be necessary anymore. ** syntax: (sql-query ) example: (sql-query 0 "select number from people where name = 'Sarah'") example: (sql-query db "show tables") example: (sql-query db "update people set number = '555-1234' where name = 'Sarah'") sql-query queries a database created with sql-create. db-id is a database id created by sql-create. query is the text of the query. sql-query returns either the number of rows affected (for update and insert queries and their ilk) or a vector matrix (a vector of vectors) that contains a vector of the field names followed by a vector for each row (for select queries and its ilk). One of the things that makes squile a nice interface to sql is that it translates the fields into their appropriate types, so numbers of all sorts become scheme numbers, blobs and *chars become strings, and dates become lists of numbers in the form of ( ). To get a better feel for what queries look like, just try a few queries and look at the results. ** That's it ! Just three little functions and you've got 95% of the functionality needed to connect to a SQL engine. Send me some email if you install this and use it or even just play around with it and think it's nifty. -Hal Roberts hroberts@alumni.princeton.edu 3/23/98