File Coverage

blib/lib/MonetDB/CLI.pm
Criterion Covered Total %
statement 4 4 100.0
branch n/a
condition 1 2 50.0
subroutine 1 1 100.0
pod 1 1 100.0
total 7 8 87.5


line stmt bran cond sub pod time code
1             package MonetDB::CLI;
2              
3             our $VERSION = '0.03';
4              
5             our @Modules = split /;/, $ENV{PERL_MONETDB_CLI_MODULES}
6             || 'MonetDB::CLI::MapiLib;MonetDB::CLI::MapiXS;MonetDB::CLI::MapiPP';
7              
8             sub connect
9             {
10 2     2 1 824 my $class = shift;
11              
12 2   50     152 eval "require( $_ )" and return $_->connect( @_ ) for @Modules;
13              
14 2         8 chomp $@; die "No MonetDB::CLI implementation found: $@";
  2         17  
15             }
16              
17             __PACKAGE__;
18              
19             =head1 NAME
20              
21             MonetDB::CLI - MonetDB Call Level Interface
22              
23             =head1 SYNOPSIS
24              
25             use MonetDB::CLI();
26              
27             my $cxn = MonetDB::CLI->connect( $host, $port, $user, $pass, $lang );
28              
29             my $req = $cxn->query('select * from env');
30             while ( my $cnt = $req->fetch ) {
31             print $req->field( $_ ) for 0 .. $cnt-1;
32             }
33              
34             =head1 DESCRIPTION
35              
36             MonetDB::CLI is a call level interface for MonetDB, somewhat similar
37             to SQL/CLI, ODBC, JDBC or DBI.
38              
39             B In its current incarnation, this interface resembles the MonetDB
40             Application Programming Interface.
41             In the future, MAPI will be replaced by the MonetDB/Five Communication Layer
42             (MCL).
43             It is not guaranteed that this call level interface stays the same!
44              
45             =head2 The C method
46              
47             my $cxn = MonetDB::CLI->connect( $host, $port, $user, $pass, $lang );
48              
49             This method tries to load an implementation module from C<@Modules> and
50             delegates to the C method of the first successful loaded module.
51             Otherwise, an exception is raised.
52              
53             The default list of implementation modules can be changed with the
54             C environment variable.
55             A semicolon-separated list of module names is expected.
56              
57             =head2 Connection object methods
58              
59             It's up to the implementation modules to provide the methods for the
60             connection object:
61              
62             my $req = $cxn->query( $statement ); # request object
63              
64             =head2 Request object methods
65              
66             It's up to the implementation modules to provide the methods for the
67             request object:
68              
69             print $req->querytype;
70             print $req->id;
71             print $req->rows_affected;
72             print $req->columncount;
73              
74             for ( 0 .. $req->columncount - 1 ) {
75             print $req->name ( $_ );
76             print $req->type ( $_ );
77             print $req->length( $_ );
78             }
79             while ( my $cnt = $req->fetch ) {
80             print $req->field( $_ ) for 0 .. $cnt-1;
81             }
82              
83             =head1 AUTHORS
84              
85             Steffen Goeldner Esgoeldner@cpan.orgE.
86              
87             =head1 COPYRIGHT AND LICENCE
88              
89             The contents of this file are subject to the MonetDB Public License
90             Version 1.1 (the "License"); you may not use this file except in
91             compliance with the License. You may obtain a copy of the License at
92             http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
93              
94             Software distributed under the License is distributed on an "AS IS"
95             basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
96             License for the specific language governing rights and limitations
97             under the License.
98              
99             The Original Code is the MonetDB Database System.
100              
101             The Initial Developer of the Original Code is CWI.
102             Portions created by CWI are Copyright (C) 1997-2006 CWI.
103             All Rights Reserved.
104              
105             =head1 SEE ALSO
106              
107             =head2 MonetDB
108              
109             Homepage : http://monetdb.cwi.nl
110             SourceForge : http://sourceforge.net/projects/monetdb
111              
112             =head2 Perl modules
113              
114             L, L, L
115              
116             =cut