NAME

CGI::AppBuilder::TaskLoads - Loading files to a database

SYNOPSIS

use CGI::AppBuilder::TaskLoads;

my $sec = CGI::AppBuilder::TaskLoads->new();
my ($sta, $msg) = $sec->exe_sql($ar);

DESCRIPTION

This class provides methods for reading and parsing configuration files.

new (ifn => 'file.cfg', opt => 'hvS:')

This is a inherited method from CGI::AppBuilder. See the same method in CGI::AppBuilder for more details.

get_ldrcfg ($ar)

Input variables:

$ar	- array ref containing the following variables:

Variables used or routines called:

None

How to use:

Return: array/hash array or its ref {$k}{$e} where $k = [v|1|..|study_id]; $e contains

rdr - relative directory
mfn - meta file name, i.e., the xls contains domain and variable metadata
dfn - domain file name containing domain metadata
vfn - variable file name containing variable metadata
ofd - output file directory
dml - data manipulation act: A|D|I|U
var - hash array ref containing variables

ld_mdrstd($q,$ar)

Input variables:

$q	- CGI class
$ar	- array ref containing the following variables:

Variables used or routines called:

None

Return: $pr will contain the parameters adn output from running the PL/SQL.

build_dml($rr, $rf, $ar)

Input variables:

$rr	- array ([$i]{$k}) with new data
$rf   - hash array with the following elements
  tbn - table name: 		cc_domains
  kcn - key column name: 	dn_id
  scn - select column name:	study_id
  scv - select column value: 1
  act - DML type: A-auto, D-delete, I-insert, U-update
$ar   - hash array for system wide parameters

Variables used or routines called:

None

Return: This procedure returns an array containing DML SQL statements and populate the $rf with the following new elements:

c1_crf  - column definition array [$i]{$k} for the table where $k=
          column_name,data_type,data_length
c1_vars - a list of column names separated by comma in the table
c2_crf  - column definition array [$i]{$k} for the new data where $k=
          column_name,data_type,data_length
c2_vars - a list of column names separated by comma in the data

cvt_ar2list($cr)

Input variables:

$cr	- array ref containing column definitions ([$i]{$k}) where $k is
        column_name, data_type, and data_length

Variables used or routines called:

None

Return: a list containing column names separated by comma

fmt_list2sel ($cns)

Input variables:

$cns	- column names separated by comma

Variables used or routines called:

None

Return: a formated list to be used in SELECT statement.

cvt_ar2hr($ar, $vars)

Input variables:

$ar	- array ref containing two dimensional data elements in an array
$vars - variable names sparated by comma

Variables used or routines called:

None

Return: an array with hash elements $r->[$i]{$k}.

coding

sub prt_txt_file { my ($s, $fn,$ar) = @_; my ($fname, $path, $sfx) = fileparse($fn,qr{\..*}); my $t1 = "<center><b>$fname$sfx</b></center>\n<hr>\n<pre>\n"; my $typ = my $w = my $st = my $t = ""; my $n = $w; open FILE, "<$fn" or die "ERR: could not open $fn: $!\n"; while (<FILE>) { s/</\&lt;/g; s/>/\&gt;/g; s/ /^L/g; # change the non-printable char to printable char if ($st) { s/($st)/<font color=red>$1<\/font>/ig; } my ($tt, $i) = ($_, -1); if (length($tt) < $n || !$w ) { $t .= $tt; next; } while (length($tt) >= $n) { ++$i; if ($i) { # the second line $t .= " "x4 . substr($tt, 0, $n) . "\n"; } else { # first line $t .= substr($tt, 0, $n) . "\n"; } $tt = substr($tt, $n); } $t .= " "x4 . $tt; } close FILE; return $t if $typ; print "$t1$t</pre><br>\n"; }

HISTORY

  • Version 0.10

    This version was started on 09/28/2011.

SEE ALSO (some of docs that I check often)

Oracle::Loader, Oracle::Trigger, CGI::AppBuilder, File::Xcopy, CGI::AppBuilder::Message

AUTHOR

Copyright (c) 2009 Hanming Tu. All rights reserved.

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 805:

You forgot a '=back' before '=head1'