• Accessing pervasive with Perl

    From Luuk@21:1/5 to All on Sat Dec 16 17:56:22 2017
    i found this article:
    http://www.support4omega.co.uk/PSQL_Scripting/index.html

    It's about 'Accessing Pervasive.SQL With Perl'


    Below is one simple example on how it works:
    use strict;
    use warnings;
    use 5.010;
    use Win32::API;

    # old parameter format
    my $funchandle = new Win32::API("w3btrv7.dll", "BTRCALL", "IPPPPCc", "I");

    if (defined $funchandle)
    {
    say "funchandle set";
    my $operation = 26; # get version information
    my $posBlock = " " x 128;
    my $dataBuffer = " " x 255; # maximum buffer size is 255 bytes
    my $dataLength = 15; # ...we need to specify >= 15 bytes to
    get full version info
    my $keyBuffer = " " x 255; # actually no need to set key buffer info
    for this example...
    my $keyLength = 255; # ...because none of it is used
    my $keyNumber = 0;

    say "Calling function...";
    my $return = $funchandle->Call($operation, $posBlock, $dataBuffer, $dataLength, $keyBuffer, $keyLength, $keyNumber);

    say "return = $return";
    say "data buffer = $dataBuffer";

    my($version1, $revision1, $type1, $version2, $revision2, $type2,
    $version3, $revision3, $type3) = unpack('SSCSSCSSC', $dataBuffer);

    say "Client: version = $version1, revision = $revision1, type =
    $type1 (".chr($type1).")";
    say "Workgroup engine: version = $version2, revision = $revision2,
    type = $type2 (".chr($type2).")";
    say "Server engine: version = $version3, revision = $revision3, type
    = $type3 (".chr($type3).")";
    }
    else
    {
    say "funchandle not set";
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)