The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

BTRIEVE::FileIO - Btrieve file I/O operations

SYNOPSIS

  use BTRIEVE::FileIO();

  my $B = BTRIEVE::FileIO->Open('TEST.BTR');

  $B->{Size} = 13;

  for ( $B->StepFirst; $B->IsOk; $B->StepNext )
  {
    print join(':', unpack('A3A10', $B->{Data} ) ), "\n";
  }

  $B->{Key} = 103;

  for ( $B->GetEqual; $B->IsOk; $B->GetNext )
  {
    print join(':', unpack('A3A10', $B->{Data} ) ), "\n";
  }

DESCRIPTION

This module provides methods for common Btrieve operations.

Methods

Create( $FileName, $FileSpec, $KeySpecs )

Creates a Btrieve file. This is a constructor method and returns an BTRIEVE::FileIO object.

$FileSpec is a hash reference with the following defaults:

  LogicalRecordLength                => 128
  PageSize                           => 512
  FileFlags                          => 0
  NumberOfDuplicatePointersToReserve => 0
  Allocation                         => 0

$KeySpecs is an array reference of hash references with the following defaults:

  KeyPosition               => 1
  KeyLength                 => 1
  KeyFlags                  => 0
  ExtendedDataType          => 0
  NullValue                 => 0
  ManuallyAssignedKeyNumber => 0
Open( $FileName )

Opens a Btrieve file. This is a constructor method and returns an BTRIEVE::FileIO object.

Close

Closes a Btrieve file associated with an BTRIEVE::FileIO object. This method is called automatically from within DESTROY.

IsOk

Tests the Status property. It returns true if Status indicates success and false if Status indicates an error.

Insert( $Data )

Inserts $Data into the Btrieve file. If $Data is omitted, the Data property is used instead.

StepFirst

Retrieves the physical first record of the file.

StepLast

Retrieves the physical last record of the file.

StepNext

Retrieves the physical next record of the file.

StepPrevious

Retrieves the physical previous record of the file.

GetFirst

Retrieves the logical first record of the file, based on the KeyNum property.

GetLast

Retrieves the logical last record of the file, based on the KeyNum property.

GetEqual

Retrieves a record which key is equal to the one specified by the Key/KeyNum properties.

GetGreater

Retrieves a record which key is greater than the one specified by the Key/KeyNum properties.

GetNext

Retrieves the logical next record of the file.

GetPrevious

Retrieves the logical previous record of the file.

Properties

Data

The data buffer used to transfer data from and to the Btrieve file.

Size

The size of the data buffer. Default is 255.

KeyNum

The number of the key used for logical (key based) data retrieval operations. Default is 0.

Key

The buffer of the key used for logical (key based) data retrieval operations.

Status

The status code. This is the return value of the native Btrieve call. It contains 0 for success or a native error code.

AUTHOR

Steffen Goeldner <sgoeldner@cpan.org>

COPYRIGHT

Copyright (c) 2004 Steffen Goeldner. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl, BTRIEVE::Native.