1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
The code in this package is
Copyright (c) 1994-1997 Andreas Knig <a.koenig@mind.de>
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
<bambi@Hughes.com.au>. 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 knig <a.koenig@mind.de>
|