Γιώργος Μπούρας > FastDB > FastDB::Delete

Download:
FastDB-2.0.2.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

FastDB::Delete - Delete selected data from FastDB database

SYNOPSIS ^

        use FastDB::Delete;

        my $obj = Delete->new(
        'Schema file'                      => $SchemaFile,
        'Allow deletion with no filters'   => yes|no     ,
        'Show activity at standard output' => yes|no     );

        $obj->delete( col1 => 'Perl code1' , col2 => 'Perl code2', ... );

EXAMPLE ^

        my $obj = Delete->new(
        'Schema file'                      => '/work/FastDB test/db/Export cargo.schema',
        'Allow deletion with no filters'   => 'No',
        'Show activity at standard output' => 'yes'  );

        $obj->delete(
        'WEIGHT'     => '(DATA > 2000) and (DATA <= 100000) and ( DATA % 2 == 0)' ,
        'EXTRA_YEAR' => 'DATA == 2011' );

DESCRIPTION ^

Delete selected data from FastDB databases. You can select data for deletion using Filters. Only rows that all their column Filters are true can be deleted.

You can have multiple Filters. Every Filter is assigned only to one column. The Filter's order is not important. Every Filter is simple Perl code. The last returned value of your code is examined if it is TRUE or FALSE. The special string DATA is replaced with column values.

Functions ^

my $obj = Delete->new( %hash );

Creates a new FastDB::Delete object. %hash must have the keys

Schema file

This is where your schema File is. The schema file is a unique file for every database, and it is created at first data load, inside data directory. Its name is "$DatabaseName.schema"

Allow deletion with no filters

Yes or No. If it is No, you are not allowed to delete data if you do not specify any Filters. If it yes and you do not define any Filters, then all your database data will be deleted.

Show activity at standard output

Yes or No. If it is yes it displays at standard output short information of its activity.

$load->delete( %Filters );

delete deletes the data. Accepts a hash with columns as keys and generic Perl code as values. Every filter evaluate only the data of its column. That means at Perl code you can not write column names . The special string DATA is replaced with current column value.

NOTES ^

This module is written with pure perl, so it can run on all operating systems. It is designed to work as fast your disk and operating system is.

INSTALL ^

Because this module is implemented with pure Perl it is enough to copy FastDB directory somewhere at your @INC or where your script is. For your convenient you can use the following commands to install/uninstall the module

        Install:     setup_module.pl –-install   --module=FastDB

        Uninstall:   setup_module.pl –-uninstall --module=FastDB

AUTHORS ^

Author: gravitalsun@hotmail.com (George Mpouras)

COPYRIGHT ^

Copyright (c) 2011, George Mpouras, gravitalsun@hotmail.com All rights reserved.

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

syntax highlighting: