This is an extension to iterate facility.
This extensions adds ability to iterate over results of queries to databases via CLSQL.
Code is in public domain.
The following two clauses are added to iterate:
(for vars in-clsql-query query-expression &optional (on-database clsql:*default-database*))
(generate vars in-clsql-query query-expression &optional (on-database clsql:*default-database*))
The for clause binds vars to values of columns of each successive row in result set of the query-expression.
(iter (for (id name) in-clsql-query "select id, name from users" on-database *users-database*) (format t "User with ID of ~A has name ~A.~%" id name))
(iter (for columns in-clsql-query "select id, name from users" on-database *users-database*) (for (id name) = columns) (format t "User with ID of ~A has name ~A.~%" id name))
(let ((id 11)) (iter (for (x) in-clsql-query [select [id] :from :users :where [< [id] id]]) (collecting x)))
To use this extensions, asdf-load the iterate-clsql system:
(asdf:oos 'asdf:load-op :iterate-clsql)
or add it to dependencies list of a system.
Download the tarball iterate-clsql-0.2.tar.gz and unpack it; make sure that it is loadable by ASDF. This means that the symlink to iterate-clsql.asd should be made into the directory that is in asdf:*central-registry*.
Written by Dmitry Kalyanov. Contact by e-mail or by jabber (email@example.com).
Send bug reports to iterate-clsql-devel mailing list.
Announcements of new version are made to iterate-clsql-announce mailing list.
Back to Common-lisp.net.