DBD-Unify

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

	-r "$UNITOP/$f" && -s _ && (-x _ || $f !~ m/^bin/) and return;
	die "I can't find $f\n".
	    "Is your Unify ($UNITOP) set up correctly??\n";
	} # Check
    Check ("bin/SQL");
    Check ("bin/EPP");
    if ($try_shared) {
	Check ("lib/lib${_}.$dlext") for @ulibs;
	}
    else {
	Check ($_) for split m/ u/ => $ULIBS;
	}

    splice @sqlv, -2, 2;
    print "System:           perl$] $^O\n",
	  "UNIFY:            $UNITOP\n",
	  @sqlv,
	  "\n";

    $UNITOP;
    } # CheckUnify

examples/describe.pl  view on Meta::CPAN

my $table = shift or usage (1);

my $dbh = DBI->connect ("dbi:Unify:");

my $dd = $dbh->func ("db_dict");

$table =~ m/^\d+$/ && exists $dd->{TABLE}[$table] and
    $table = join "." => $dd->{TABLE}[$table]{ANAME},
			 $dd->{TABLE}[$table]{NAME};

my ($sch, $tbl) = split m/\./ => $table;
$tbl or ($tbl, $sch) = ($sch, $ENV{USCHEMA} || die "No (explicit) schema\n");

my       @a = grep { $_ and    $_->{NAME} eq     $sch    } @{$dd->{AUTH}};
   @a or @a = grep { $_ and lc $_->{NAME} eq  lc $sch    } @{$dd->{AUTH}};
   @a or @a = grep { $_ and    $_->{NAME} =~  m/^$sch$/  } @{$dd->{AUTH}};
   @a or @a = grep { $_ and    $_->{NAME} =~   m/$sch/   } @{$dd->{AUTH}};
   @a or @a = grep { $_ and    $_->{NAME} =~  m/^$sch$/i } @{$dd->{AUTH}};
   @a or @a = grep { $_ and    $_->{NAME} =~   m/$sch/i  } @{$dd->{AUTH}};
   @a or die "Cannot find an accessible schema matchin $sch\n";

examples/row_counts  view on Meta::CPAN

sub usage {
    my $err = shift and select STDERR;
    print "usage: vol [-1] [-a] [-e] [-s schema] [tbl]\n";
    exit $err;
    } # usage

use Getopt::Long qw(:config nopermute bundling);
my $opt_a  = 0;
my $opt_e  = 0;
my $opt_1  = 0;
my $opt_s  = (split m{/}, $ENV{DBUSER}//"")[0] || "PRO\U$ENV{PROD}";
GetOptions (
    "help|?" => sub { usage (0); },
    "a"      => \$opt_a,
    "e"      => \$opt_e,
    "1"      => \$opt_1,
    "s=s"    => \$opt_s,
    ) or usage (1);

my $opt_t = @ARGV ? lc (shift @ARGV) : "^";
   $opt_t = qr/$opt_t/;

examples/row_counts  view on Meta::CPAN

my $col = ($ENV{COLUMNS} || 80) - 1;
my $w = $opt_1 ? 30 : int (($col - 39) / 3);
my $x = 0;

# For all accessable tables (in the current SCHEMA if $USCHEMA is set),
# show the number of records in it
foreach (sort $dbh->tables (undef, $ENV{USCHEMA} || undef, undef, "T")) {
    # As of DBI-1.38, quotes suddenly appeared. It was a BIG mistake to do so!
    s/["'`]//g;

    my ($sch, $tbl) = split m/\./;
    $tbl = lc $tbl;
    $opt_s and $sch ne $opt_s and next;
    $opt_t and $tbl !~ $opt_t and next;

    my ($cnt, $sth) = (0);
    unless ($sth = $dbh->prepare ("select count (*) from $tbl") and
	    $sth->execute and
	    $sth->bind_columns (\$cnt) and
	    $sth->fetch) {
	print STDERR "Cannot select count (*) from $sch.$tbl\n";

lib/DBD/Unify.pm  view on Meta::CPAN

    } # ping

sub prepare {
    my ($dbh, $statement, @attribs) = @_;

    # Strip comments
    $statement = join "" => map {
	my $s = $_;
	$s =~ m/^'.*'$/ or $s =~ s/(--.*)$//m;
	$s;
	} split m/('[^']*')/ => $statement;
    # create a 'blank' sth
    my $sth = DBI::_new_sth ($dbh, {
	Statement => $statement,
	});

    # Setup module specific data
#   $sth->STORE ("driver_params" => []);
#   $sth->STORE ("NUM_OF_PARAMS" => ($statement =~ tr/?//));

    DBD::Unify::st::_prepare ($sth, $statement, @attribs) or return;

lib/DBD/Unify/GetInfo.pm  view on Meta::CPAN

use warnings;

use DBD::Unify;

# Beware: not officially documented interfaces...
# use DBI::Const::GetInfoType qw(%GetInfoType);
# use DBI::Const::GetInfoReturn qw(%GetInfoReturnTypes %GetInfoReturnValues);

my $sql_driver     = "Unify";
my $sql_ver_fmt    = "%02d.%02d.0000";   # ODBC version string: ##.##.#####
my $sql_driver_ver = sprintf $sql_ver_fmt, split m/\./, $DBD::Unify::VERSION;

my @Keywords = qw(
    ACCESS AMOUNT ANSI AUTO
    BASE BINARY BTREE BUFFER BYTE
    COBOL COLUMNS CONFIGURATION CONST CONTIGUOUS CURAID CURRENCY
    DATA DATABASE DATETIME DBA DEFER DEMOTING DESCRIPTION DEVICE DIRECT DISPLAY
	DOUBLE_PRECISION
    EDIT ESTIMATED EXTERN
    FILEFIXED FORCE
    HASH HELP HUGE



( run in 1.416 second using v1.01-cache-2.11-cpan-71847e10f99 )