NAME

DynGig::Util::EZDB - Interface to a single-schema SQLite DB

SCHEMA

key TEXT NOT NULL,
value TEXT,
PRIMARY KEY ( key )

SYNOPSIS

use DynGig::Util::EZDB;

my $file = '/db/file/path';
my @table = qw( table1 table2 .. );

my $db = DynGig::Util::EZDB->new( $file, table => \@table );
my $db_existing = DynGig::Util::EZDB->new( $file );

$db->set( 'table1', 'key1', 'value1' );

my %keyval = $db->dump( 'table2' );

map { $db->delete( $_, key => 'key1', val => 'value2' ) } $db->table();

$db->truncate( 'table2' );

my $quoted = $db->quote( "bob loblaw's law blog" )

METHODS

set( table, @key, @value )

INSERT or UPDATE keys and values into table. Returns status of operation.

dump( table )

Dump all records from a table into a HASH. Returns HASH reference in scalar context. Returns flattened HASH in list context.

delete( table, delete_key => key, delete_val => value )

Deletes by key, or by value, or by key or value from a table.

create( table )

create a table

drop( table )

drop a table from the database

truncate( table )

Deletes all records from a table.

quote( string )

See DBI::quote().

table()

Returns a list of all tables. Returns ARRAY reference in scalar context.

stat()

Stat of database file. Also see stat(). Returns ARRAY reference in scalar context.

SEE ALSO

DBI

NOTE

See DynGig::Util