DBD-MaxDB

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use Config;
use ExtUtils::MakeMaker 5.16, qw(&WriteMakefile $Verbose);
use File::Basename;
use Getopt::Long;
use File::Spec;

use DBI 1.21;		
use DBI::DBD;
use strict;

sub getSQLDBCSDKFromIndepPath();
sub usageSQLDBCSDK;
sub checkSQLDBCSDKVersion;

my $dbi_dir      = dbd_dbi_dir();
my $dbi_arch_dir = dbd_dbi_arch_dir();

my %opts =
(
    NAME	=> 'DBD::MaxDB',
    VERSION_FROM => 'MaxDB.pm',

Makefile.PL  view on Meta::CPAN

	    print "MaxDB SQLDBC sdk! If it isn't already installed you can download\n";
	    print "it from the MaxDB homepage.\n\n";
	    print "You need also to set the path to the SQLDBC sdk directory.\n";
	    print "You can do this ether by setting the SQLDBCSDK environment variable\n";
	    print "or by runing 'perl Makefile.PL -o <sqldbc-sdk-dir>'.\n\n";
	    die "Makefile.PL aborted.\n";
  	}
  }
}

sub getSQLDBCSDKFromIndepPath(){
  my $indep=undef;
  if ($^O eq 'MSWin32') {
     eval {require Win32API::Registry; }; if ($@) {return undef};
     my ($key, $type);
     Win32API::Registry::RegOpenKeyEx( Win32API::Registry::HKEY_LOCAL_MACHINE(), "SOFTWARE\\SAP\\SAP DBTech", 0, Win32API::Registry::KEY_READ(), $key )
         or  return undef;
     Win32API::Registry::RegQueryValueEx( $key, "IndepPrograms", [], $type, $indep, [] )
         or  return undef;
     Win32API::Registry::RegCloseKey( $key );
  }else {

t/115quote.t  view on Meta::CPAN

MaxDBTest::endTest();

MaxDBTest::beginTest("create table with two columns (INTEGER, LONG ASCII)");
$dbh->do("CREATE TABLE GerosTestTable (i INTEGER, la LONG ASCII)") or die "CREATE TABLE failed $DBI::err $DBI::errstr\n";
MaxDBTest::endTest();


# run

my $index = 0;
sub checkStr($) {
    my $origstr = shift;
    MaxDBTest::loginfo(">>$origstr<< was quoted to >>" . $dbh->quote($origstr) . "<<");
    $dbh->do(qq{INSERT INTO GerosTestTable (i, la) VALUES ($index, } . $dbh->quote($origstr) . ")") or MaxDBTest::logerror(qq{do INSERT failed $DBI::err $DBI::errstr});
    my ($resstr) = $dbh->selectrow_array(qq{SELECT la FROM GerosTestTable WHERE i = $index});
    if ($origstr ne $resstr) {
        MaxDBTest::logerror(qq{wrong data returned: '$resstr'. Expected was '$origstr'});
    }
    $index++;
}

t/MaxDB.dbtest  view on Meta::CPAN

		   join(", ", @colDefs), $keyDef, $suffix);
}


#
#   This function generates a list of tables associated to a
#   given DSN.
#
#   the function _ListTables is not available in MaxDB  # GeroD, 26.03.04
#
sub ListTables(@) {
    my($dbh) = shift;
    my(@tables);

    @tables = $dbh->func('_ListTables');
    if ($dbh->errstr) {
	die "Cannot create table list: " . $dbh->errstr;
    }
    @tables;
}

t/MaxDB.dbtest  view on Meta::CPAN

#   host.
sub HostDsn ($$) {
    my($hostname, $dsn) = @_;
    "$dsn:$hostname";
}


#
#   Return a string for checking, whether a given column is NULL.
#
sub IsNull($) {
    my($var) = @_;

    "$var IS NULL";
}


#
#   Return TRUE, if database supports transactions
#
#   MaxDB has transactions...

t/mysql_10dsnlist.t  view on Meta::CPAN

    if ($mdriver ne '') {
	last;
    }
}
if ($mdriver eq 'pNET'  ||  $mdriver eq 'Adabas') {
    print "1..0\n";
    exit 0;
}
print "Driver is $mdriver\n";

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_20createdrop.t  view on Meta::CPAN

my $file;
foreach $file ("lib.pl", "t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_30insertfetch.t  view on Meta::CPAN

$mdriver = "";
foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_40bindparam.t  view on Meta::CPAN

		      }
    if ($mdriver ne '') {
	last;
    }
}
if ($mdriver eq 'pNET') {
    print "1..0\n";
    exit 0;
}

sub ServerError() {
    my $err = $DBI::errstr;  # Hate -w ...
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

t/mysql_40listfields.t  view on Meta::CPAN

	last;
    }
}


@table_def = (
	      ["id",   "INTEGER",  4, $COL_KEY],
	      ["name", "CHAR",    64, $COL_NULLABLE]
	     );

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_40nulls.t  view on Meta::CPAN

$mdriver = "";
foreach $file ("lib.pl", "t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_40numrows.t  view on Meta::CPAN

$mdriver = "";
foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}


sub TrueRows($) {
    my ($sth) = @_;
    my $count = 0;
    while ($sth->fetchrow_arrayref) {
	++$count;
    }
    $count;
}


#

t/mysql_50chopblanks.t  view on Meta::CPAN

    foreach $file ("lib.pl", "t/lib.pl") {
	do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			    exit 10;
			}
	if ($mdriver ne '') {
	    last;
	}
    }
}

sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}

#

t/mysql_50commit.t  view on Meta::CPAN

    exit 0;
}


use vars qw($gotWarning);
sub CatchWarning ($) {
    $gotWarning = 1;
}


sub NumRows($$$) {
    my($dbh, $table, $num) = @_;
    my($sth, $got);

    if (!($sth = $dbh->prepare("SELECT * FROM $table"))) {
	return "Failed to prepare: err " . $dbh->err . ", errstr "
	    . $dbh->errstr;
    }
    if (!$sth->execute) {
	return "Failed to execute: err " . $dbh->err . ", errstr "
	    . $dbh->errstr;

t/mysql_dbdadmin.t  view on Meta::CPAN

foreach $file ("lib.pl", "t/lib.pl", "DBD-mysql/t/lib.pl") {
    do $file; if ($@) { print STDERR "Error while executing lib.pl: $@\n";
			   exit 10;
		      }
    if ($mdriver ne '') {
	last;
    }
}


sub ServerError() {
    print STDERR ("Cannot connect: ", $DBI::errstr, "\n",
	"\tEither your server is not up and running or you have no\n",
	"\tpermissions for acessing the DSN $test_dsn.\n",
	"\tThis test requires a running server and write permissions.\n",
	"\tPlease make sure your server is running and you have\n",
	"\tpermissions, then retry.\n");
    exit 10;
}


sub InDsnList($@) {
    my($dsn, @dsnList) = @_;
    my($d);
    foreach $d (@dsnList) {
	if ($d =~ /^dbi:[^:]+:$dsn\b/i) {
	    return 1;
	}
    }
    0;
}

sub PathFor(@) {
    eval { require File::Spec; };
    my $haveFileSpec = $@ ? 0 : 1;
    foreach my $f (@_) {
	foreach my $dir ($haveFileSpec ?
		       File::Spec->path() :
			 split(/\:/, $ENV{PATH})) {
	    my $p = $haveFileSpec ?
	      File::Spec->catfile($dir, $f) : "$dir/$f";
	    return $p if -x $p;
	}



( run in 1.656 second using v1.01-cache-2.11-cpan-65fba6d93b7 )