MonetDB::CLI - MonetDB Call Level Interface


MonetDB-CLI documentation Contained in the MonetDB-CLI distribution.

Index


Code Index:

NAME

Top

MonetDB::CLI - MonetDB Call Level Interface

SYNOPSIS

Top

  use MonetDB::CLI();

  my $cxn = MonetDB::CLI->connect( $host, $port, $user, $pass, $lang );

  my $req = $cxn->query('select * from env');
  while ( my $cnt = $req->fetch ) {
    print $req->field( $_ ) for 0 .. $cnt-1;
  }

DESCRIPTION

Top

MonetDB::CLI is a call level interface for MonetDB, somewhat similar to SQL/CLI, ODBC, JDBC or DBI.

Note: In its current incarnation, this interface resembles the MonetDB Application Programming Interface. In the future, MAPI will be replaced by the MonetDB/Five Communication Layer (MCL). It is not guaranteed that this call level interface stays the same!

The connect() method

  my $cxn = MonetDB::CLI->connect( $host, $port, $user, $pass, $lang );

This method tries to load an implementation module from @Modules and delegates to the connect() method of the first successful loaded module. Otherwise, an exception is raised.

The default list of implementation modules can be changed with the PERL_MONETDB_CLI_MODULES environment variable. A semicolon-separated list of module names is expected.

Connection object methods

It's up to the implementation modules to provide the methods for the connection object:

  my $req = $cxn->query( $statement );  # request object

Request object methods

It's up to the implementation modules to provide the methods for the request object:

  print $req->querytype;
  print $req->id;
  print $req->rows_affected;
  print $req->columncount;

  for ( 0 .. $req->columncount - 1 ) {
    print $req->name  ( $_ );
    print $req->type  ( $_ );
    print $req->length( $_ );
  }
  while ( my $cnt = $req->fetch ) {
    print $req->field( $_ ) for 0 .. $cnt-1;
  }

AUTHORS

Top

Steffen Goeldner <sgoeldner@cpan.org>.

COPYRIGHT AND LICENCE

Top

SEE ALSO

Top

MonetDB

  Homepage    : http://monetdb.cwi.nl
  SourceForge : http://sourceforge.net/projects/monetdb

Perl modules

MonetDB::CLI::MapiLib, MonetDB::CLI::MapiXS, MonetDB::CLI::MapiPP


MonetDB-CLI documentation Contained in the MonetDB-CLI distribution.

package MonetDB::CLI;

our $VERSION = '0.03';

our @Modules = split /;/, $ENV{PERL_MONETDB_CLI_MODULES}
  || 'MonetDB::CLI::MapiLib;MonetDB::CLI::MapiXS;MonetDB::CLI::MapiPP';

sub connect
{
  my $class = shift;

  eval "require( $_ )" and return $_->connect( @_ ) for @Modules;

  chomp $@; die "No MonetDB::CLI implementation found: $@";
}

__PACKAGE__;