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

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', value => 'value2' ) } $db->table();

 $db->truncate( 'table2' );

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

METHODS

schema( @schema )

Set or get schema. In get mode, returns ARRAY ref in scalar context, returns ARRAY in list context.

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 => value )

Deletes by attribute 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.

reload()

reload table names form DB files.

stat()

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

SEE ALSO

DBI

NOTE

See DynGig::Util