📄 readme
字号:
README for CLISP Oracle interface module http://clisp.alma.com John Hinsdale, Alma Mater Software, Inc. hin@alma.com $Id: README,v 1.3 2002/09/29 12:00:35 hin Exp $This is the README for a low-level, but complete and functional modulefor CLISP that allows one to use CLISP to program Oracle databaseapplications. The interface is built on top of the Oracle CallInterface (OCI), which is Oracle's "C" language client library. Theremainder of this README is organized as follows: (1) Background and design goals (2) Features of the module (3) Files in the distribution (4) System Requirements (5) Building the module (6) Using the module (7) How you can help (8) About the author (9) AcknowledgementsEach section follows. (1) BACKGROUND AND DESIGN GOALS ---------------------------I decided to get back into Lisp after a 21-year hiatus since takingthe introductory Scheme course at MIT in 1981 (when Gerry Sussman andHal Abelson were still teaching it). I was getting sick of Java andperl. Since I make my living hacking Oracle databases, I wantedaccess to Oracle from the Lisp environment, which I chose CLISP due toit's ease of use, stability, availability under the GPL, and it'sbeing the choice of some fairly respectable Lisp hackers.The design goals of the library are, in order: - Simple and easy to use interface - Well tested and free of bugs - Well documented - Efficiency (2) FEATURES OF THE MODULE ----------------------The module provides a rich set of features that can be used for Oracleapplications both simple and sophisticated. The highlights are: - Source code avaiable under the GNU General Public License - Full access to most Oracle functionality, including all functions accessible via SQL - Complete error reporting, including pass-through of Oracle error messages and identification of the location of SQL parse errors - Support for transactions (WITH-TRANSACTION macro) - Auto-commit feature that commits database results to simplify applications that are not transaction intensive. - Automatic mapping of Oracle data types to and from Lisp data types (string, fixnum, bignum, NULL, etc.) - Convenient constructs for database inserts and updates - Constructs for looping over SELECT query results: a DO-ROWS macro, and a one-row lookahead buffer, useful for formatting reports at "breaks" in data streams. - Support for multiple, simultaneous connections to the same database or different databases - Connection caching, allowing re-used of previously established database connections, to minimize overheadMore details on these features can be got by doing(DESCRIBE 'ORACLE:<function>) on a particular function. (3) FILES IN THE DISTRIBUTION -------------------------The distribution consists of these files:README This fileoracle.lisp Lisp file defining the ORACLE packageorafns.c "C" interface to Oracleoiface.h Wrapper functions and structure definitionsoiface.c Wrapper functionsconfigure auto-conf generated script build MakefileMakefile.in Makefile directives to build the modulelink.sh Shell script to link moduleexamples.lisp Example functions (4) SYSTEM REQUIREMENTS -------------------Before you can use this module you need: - A working Oracle client environment, including the client OCI headers and libraries. As a quick check, make sure you have $ORACLE_HOME/rdbms/demo/oci.h - An Oracle server to connect to, and a userID and password on that server. - Oracle expertise, incl. knowledge of SQL and use of such tools as SQL*plus.It is beyond the scope of this module for me to teach you how ptoinstall and use Oracle itself. If you are not at least at a level ofproficiency where you can use SQL*Plus to connect to an Oracledatabase, then you need to learn and/or install Oracle on your owntime (and that of your DBA :) before coming to me for help. (5) BUILDING THE MODULE -------------------I've been advised by Sam Steingold, a CLISP maintainer, to build aseparate Lisp containing the Oracle module in a build other than thedefault "src" subdirctory. This is most easily accomplished byinstalling the distribution in under the "modules" subdirectory ofyour CLISP distribution, then running CLISP's "configure" script withthe --build option. To combine this module with your CLISP source: cd /path/to/clisp/ cp -p clisp-oracle-0.01.tar.gz . gunzip < clisp-oracle.tar.gz | tar xfThis module's tarball will expand into modules/oracle. Then, in theCLISP source directory, run "configure" with options to include theOracle module, and to build in a separate area. The command I use is:./configure \ --with-readline \ --with-dynamic-ffi \ --with-dynamic-modules \ --with-export-syscalls \ --with-module=wildcard \ --with-module=regexp \ --with-module=bindings/linuxlibc6 \ --with-module=oracle \ --build oralispIf all goes well, this will build a complete Lisp in /path/to/clisp/oralisp/fullFrom that directory, you can run ./lisp.run -M lispinit.memYou can test that you really have the Oracle-enabled Lisp byevaluating (describe 'oracle:connect)Test the module by editing "examples.lisp" to connect to yourparticular Oracle server, then loading that file to do some simpledatabase operations. (6) USING THE MODULE ---------------- The module implements a Lisp package "ORACLE" which exports thefunctions and macros below. Each function and macro has a completedocumentation string that can be viewed with DESCRIBE. E.g.:(describe 'oracle:connect)CONNECT Connect to Oracle serverDISCONNECT Disconnect from Oracle serverRUN-SQL Execute SQL statementDO-ROWS (Macro) Loop over SELECT resultFETCH Retrieve one row of SELECT resultFETCH-ALL Retrieve all/some rows of SELECT resultPEEK Look-ahead to next row of SELECT resultCOLUMNS Get name, type, size of SELECT columnsSQLCOL-* Accessor functions for COLUMNS itemsEOF Test if at end of SELECT resultINSERT-ROW Add a row to a tableUPDATE-ROW Update row(s) in a tableROW-COUNT Get count of rows affected by SQL statementWITH-TRANSACTION (Macro) Perform operations atomicallyCOMMIT Commit pending changesROLLBACK Abandon pending changesAUTO-COMMIT Enable or disable "auto-commit" mode (7) HOW YOU CAN HELP ----------------I would welcome those who can test this module on Unix platforms otherthan Linux, and would like someday to port it to Windows as well. Ofcourse, bug reports will be greatly appreciated.Please understand that this is my first attempt to program in Lisp inabout twenty years, and that some of my code in "oracle.lisp" may bepretty bad. I would welcome constructive comments on that code,perhaps as barter in return for whatever utility you may find in usingthis library. (8) ABOUT THE AUTHOR ----------------I am John Hinsdale <hin@alma.com>, a software consultant based inTarrytown, NY USA. I specialize in database applications, usuallyfronted by a Web server. My background is in Computer Science (MIT1986, Columbia 1995). I program in "C", Java, and mostly perl. LatelyI am getting back into Lisp. (9) ACKNOWLEDGEMENTS ----------------I would like to thank the creators and maintainers of CLISP: BrunoHaible and especially Sam Steingold for assistance on using CLISP'svery well documented "C" interface. Also, I've received helpfulcomments on the CLISP mailing lists from Joerg-Cyril Hoehle and DanStanger. * * *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -