Daniel Ruoso > Oak-Filer-DBI-1.8 > Oak::Filer::DBI

Download:
Oak-Filer-DBI-1.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

NAME ^

Oak::Filer::DBI - Filer to save/load data into/from DBI tables

DESCRIPTION ^

This module provides access for saving data into a DBI table, to be used by a Persistent descendant to save its data. Must pass table, and where

HIERARCHY ^

Oak::Object

Oak::Filer

Oak::Filer::DBI

PROPERTIES ^

io

Mandatory property. Defines the Oak::IO::DBI object that will be used to communicate with the database. This property contains a reference to the Oak::IO::DBI object, not the name.

table

Mandatory property. Defines the table that this filer will work on.

where

Optional. Contains a hashref with the following format {primarykey => value} This will be used to create the custom SQL when fetching data.

METHODS ^

load(FIELD,FIELD,...)

Loads one or more properties of the selected DBI table with the selected WHERE statement. Returns a hash with the properties.

see Oak::IO::DBI::do_sql for possible exceptions.

store(FIELD=>VALUE,FIELD=>VALUE,...)

Saves the data into the selected table with the selected WHERE statement.

see Oak::IO::DBI::do_sql for possible exceptions.

insert(FIELD=>VALUE,FIELD=>VALUE,...)

Insert a register in the selected table with the data in the parameters

see Oak::IO::DBI::do_sql for possible exceptions.

delete

Delete the entry from the table

see Oak::IO::DBI::do_sql for possible exceptions.

begin_work, commit, rollback

Calls the method with the same name at DBI.

EXAMPLES ^

  require Oak::Filer::DBI;

  my $filer = new Oak::Filer::DBI
   (
    io => $iodbiobj,            # mandatory, an Oak::IO::DBI object.
    table => "tablename",       # mandatory to enable load and store.
                                #   table to work in selects and updates
    where => {primary => value},# this is optional, once itsn't passed 
                                # you assumes that u're creating a new object
   )
    
  my $nome = $filer->load("nome");
  $filer->store(nome => lc($nome));

COPYRIGHT ^

Copyright (c) 2001 Daniel Ruoso <daniel@ruoso.com> and Rodolfo Sikora <rodolfo@trevas.net>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.