The code in this package is Copyright (c) 1994-1997 Andreas König and may be used, copied and redistributed under the same terms as perl (see the files README, Copying and Artistic in the perl distribution). Prerequisites ------------- mSQL is a database server and an API library written by David Hughes . You get that library and the database engine from http://Hughes.com.au Please follow the links there. ########################################################### ########################################################### ## ## ## Both mSQL-1 and mSQL-2 are supported ## ## with both Msql.pm and DBD::mSQL. ## ## ## ########################################################### ########################################################### To use the perl modules you definitely have to install the database and the library first. From the perl side perl5.003 is required. What is in this package ----------------------- Msql.pm and DBD::mSQL implement two different approaches to communicate with an mSQL server. DBD::mSQL is built upon the DBI, the generic Perl Database Interface. It brings you an identical interface to a broad variety of databases and is in this regard comparable to ODBC. The advantage of the DBI approach is portability and interoperability. Msql.pm is the elder species. It was written before DBI was available but it was inspired by an early draft of the DBI specification. As it has been circulating longer it is more mature and pretty stable. It's also more complete than DBD::mSQL. Some day in the future DBD::mSQL will probably be the clearly superior competitor in this package. Today you have to decide on your own about the trade-offs. What you achieve with Msql.pm ----------------------------- Msql.pm is an interface between the perl programming language and the mSQL programming API that comes with the mSQL relational database management system. All functions provided by the mSQL programming API are supported. From perl you activate the interface with the statement use Msql; After that you can connect to multiple msql database servers and send multiple queries to any of them via an simple object oriented interface. Two types of objects are available: database handles and statement handles. Perl returns a database handle to the Connect method like so: $dbh = Msql->connect($hostname,$databasename); Once you have connected to a database, you get a statement handle with: $sth = $dbh->query("select foo from bar"); You can open as many queries as you like simultaneously by selecting a different scalar to hold the object: $another_sth = $dbh->query("select bar from foo"); The statement handle allows you to step through the virtual table returned from the database with the FetchRow method: @row = $sth->fetchrow; or %hash = $sth->fetchhash; You can access all metadata that mSQL supplies for a given table. To find out the number of rows or the number of fields returned by a query you simply say: $numrows = $sth->numrows; $numfields = $sth->numfields; To find out the size in bytes for the field with the offset 0 (the first field of a query), you say: $length = $sth->length->[0]; The list of the names for each column is returned by @list => $sth->name; As for other metadata available, consult the manpage that comes with MsqlPerl and study the examples in the file t/msql.t, which is the extensive testscript to test your installation, but is heavily commented, so you may use it as a tutorial. Installing The Adaptor ---------------------- Unpack in any directory anywhere on your filesystem and run perl Makefile.PL make make test The latter will give you some instructions if msqld is not running or if a database "test" is not available. Rest assured, that no existing data in this database will be overwritten. If the tests finish with `ok', give it a try to make install If anything fails, check the documentation of the ExtUtils::MakeMaker module. Especially if you're facing problems with dynamic loading, set the environment variable PERL_DL_DEBUG to some value greater 0 to get some more information from the DynaLoader. Documentation ------------- Documentation is available in pod format within the file Msql.pm. During installation this should be turned into a manpage. Try 'man Msql', and if this doesn't work on your system, try 'perldoc Msql'. The tutorial that may be helpful for you is in the file t/msql.t. This file is the test program for this package and illustrates all basic operations that are available. pmsql ----- This package comes with a small standalone program, pmsql. It is a lightweight shell for your interactive communication needs with your mSQL server(s). Try 'man pmsql' or 'perldoc pmsql' after installation to get at the documention embedded in the program. pmsql is similar to both the msql monitor and the relshow program. The main advantage over those is that if you have Term::ReadKey and Term::ReadLine::Perl installed on your system, you have access to a readline clone, entirely written in perl with command line editor, a basic completion and history, and you get the output of any select query piped into your favorite pager program. Mailing list ------------ Please direct your questions to the mailing list devoted to the support of the package: msqlperl@franz.ww.tu-berlin.de. Do not send them to me. If you do, I'll eventually forward your mail to the mailing list. So please be prepared to have your question exposed to hundreds of msqlperl users. Before you post your questions have a look at the archive of the mailing list at http://franz.ww.tu-berlin.de/msqlperl It would be kind if you would subscribe to the mailing list yourself, so you can answer the same questions later that you have asked yourself before. Subscribe to the list by sending mail to msqlperl-request@franz.ww.tu-berlin.de with the word "subscribe" in the body of the message. Announcements of new versions of major importance will usually be made on comp.lang.perl.announce. Smaller updates will be announced on the mailing list. andreas könig