OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
bin
/
etl_odbc
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📄
-d
10 bytes
02/03/2023 07:34:13 AM
rw-r--r--
📁
..
-
02/03/2023 08:06:37 AM
rwxr-xr-x
📄
config.pl
7.61 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
cross2normal.pl
3.71 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
dataextract.sh
2.51 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
etl.pl
5.42 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
etlproc
9.99 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
func.pl
4.01 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
globvar.sh
127 bytes
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
initetl.pl
1.88 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
libawk.awk
3.07 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
makeXtab2NormalExcel.pl
5.73 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
process.pl
6.91 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
process_changed.pl
5.69 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
readwrite.pl
4.16 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxcsv.pl
7.94 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxdb.pl
11.06 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxfile.pl
4.68 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxsalesforce.pl
3.5 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxxml.pl
13.83 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
rxxml2.pl
4.18 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sendmail.pl
1.06 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sourcequery.pl
4.18 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
sql.pl
23.98 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
store.pl
7.97 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
tags
13.14 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
task.pl
33.48 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📁
test
-
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
userfunc.pl
5.05 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
valid.pl
3.64 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
workflow.pl
3.94 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
xform.pl
2.62 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
Editing: store.pl
Close
#!/usr/bin/perl # $wfnodes = SQL_wfdetails($wfid); # # foreach $node(@$wfnodes) { # ($nodeid, $nodetype) = @$node; #sub chk_stores{ # my $taskid = shift; # my $srcdest = shift; # # my $src_storegrp = SQL_taskstore($taskid, $srcdest); # my @src_storeids = getstorelist($src_storegrp); # if(validate_stores(@src_storeids) eq 'INV'){ # printlog("Invalid Store in Task id:$taskid\n"); # return 0; # } # return 1; # } sub validate_stores{ foreach my $storeid(@_) { if((open_store($storeid) eq 'INV')){ printlog($ERROR, "Validating Storeid $storeid :[ FAIL ]"); return 0; } printlog($INFO, "Validating Storeid $storeid :[ OK ]"); } return 1; } sub open_store{ my $storeid = shift; my $store=SQL_storemaster($storeid); ($storename, $storemode, $storetype, $storeip, $storevalid) = @$store; printlog($INFO, "Checking for store [Id:$storeid][Name:$storename]"); if(!isvalid($storevalid)){ printlog($ERROR, "Stopping Task [Id:$taskid]. Store [Id:$storeid] [Name:$storename] is invalid ($storevalid)"); return 'INV'; } $store; } sub get_storetype{ my $storeid = shift; my $store=SQL_storemaster($storeid); @$store[2]; #Store Type } sub getstorelist{ my $storegrp = shift; my @storeids = (); foreach $store(@$storegrp){ ($id, $tblfile, $col) = @$store; push(@storeids, $id); $metaid = $tblfile; } undef %saw; @saw{@storeids} = (); @storeids = sort keys %saw; @storeids; } sub getstore_mstinfo{ my ($storeid, $storename, $storemode, $storetype, $storeip) = @_; my $storemaster = SQL_storemaster($storeid); ($$storename, $$storemode, $$storetype, $$storeip) = @$storemaster; } #This Function Takes $taskid as i/p #It stores table/file name into $dest_tblfile & # sub getdest_coldtls{ my ($taskid, $hcols, $desttype) = @_; my $dest_colname = SQL_taskstore($taskid, 'dest'); #my $dest_colname = SQL_task_destcolname($taskid, $desttype); my $lastid, $lasttf; #lasttf : table or file name from task table my $cols; foreach my $colinfo(@$dest_colname){ if( ((@$colinfo[0] eq $lastid) && (@$colinfo[1] eq $lasttf)) ){ push(@cols, @$colinfo[2]); } else{ $$hcols{$lastid, $lasttf} = [@cols]; @cols = (); } if(@cols[0] eq '' ){ push(@cols, @$colinfo[2]); } $lastid = @$colinfo[0]; $lasttf = @$colinfo[1]; } $$hcols{$lastid, $lasttf} = [@cols]; # For last id and table add value in hash # while ( my ($key, $value) = each(%$hcols) ) { # printlog($MAX, "HASH OF COLUMNS $key => @$value"); # } } =head sub getdest_tbl_numcols{ my ($taskid, $hdest_numcols, $dest_tblfile, $dest_metaids, $dest_storeids) = @_; my $dest_colordergrp = SQL_task_destcol($taskid); my $totcol=0; foreach my $id_stname(@$dest_colordergrp){ $totcol = $totcol + @$id_stname[2]; push(@$dest_tblfile, @$id_stname[1]); push(@$dest_storeids, @$id_stname[0]); $$hdest_numcols{@$id_stname[0], @$id_stname[1]} = $totcol; } } =cut sub getdest_tblfiles{ my ($taskid, $hdest_tblfile_dtl, $hdest_finfo, $hdest_fwidth, $hdest_numcols, $dest_tblfile, $dest_metaids, $dest_storeids) = @_; my $dest_colordergrp = SQL_task_destcol($taskid); my $totcol=0; foreach my $id_stname(@$dest_colordergrp){ printlog($MAX, "id_stname : @$id_stname"); $totcol = $totcol + @$id_stname[2]; push(@$dest_tblfile, @$id_stname[1]); push(@$dest_storeids, @$id_stname[0]); $$hdest_numcols{@$id_stname[0], @$id_stname[1]} = $totcol; $destid = @$id_stname[0]; my $deststoremaster = SQL_storemaster($destid); my ($deststorename, $deststoremode, $deststoretype, $deststoreip) = @$deststoremaster; #these 2 stmt can be 1 $$hdest_tblfile_dtl{$destid} = [$deststorename, $deststoremode, $deststoretype, $deststoreip]; printlog($MAX, "deststoremaster : @$deststoremaster"); if($deststoretype eq 'T'){ my $destfinfo = SQL_fstore($destid); my ($fpath, $fgetcmd, $fnamefmt, $fname, $ftype, $fdelim, $fuser, $fpass, $fident, $fmetaid) = @{@$destfinfo[0]}; printlog($MAX, "@{@$destfinfo[0]} =========ftype: $ftype"); if($ftype eq 'D'){ $$hdest_finfo{$destid, $fmetaid} = [ @{@$destfinfo[0]} ]; printlog($MAX, "Storing = $destid-$fname [ @{$$hdest_finfo{$destid, $fmetaid}}[5] = [ @{@$destfinfo[0]} ] ]"); } else{ my $metainfo = SQL_fmetawdth($destid, $fmetaid); my @widtharr; $$hdest_finfo{$destid, $fname} = [@{@$destfinfo[0]} ];#($fpath, $fgetcmd, $fnamefmt, $fname, $ftype, $fdelim, $fuser, $fpass, $fident, $fmetaid); foreach $colwidth(@$metainfo){ push (@widtharr, @$colwidth); } $$hdest_fwidth{$destid, $fname} = [ @widtharr ] ; #Width Vals For Cols } } } } sub getdest_conns{ my ($dest_storeids, $hdestconn, $tblfilename, $taskincr, $taskid, $hdesterrlog) = @_; $G_chkpoint = ''; #Clearing Chk Point foreach my $destid(@$dest_storeids){ my ($deststorename, $deststoremode, $deststoretype, $deststoreip) = ''; getstore_mstinfo($destid, \$deststorename, \$deststoremode, \$deststoretype, \$deststoreip); my $mode = ($taskincr eq 'N')?'w':'a'; my $myconn = getconn($destid, $deststoretype, $deststoreip, $mode); if($myconn eq '' || $myconn eq 'ERR'){ return 'ERR'; } $$hdestconn{$destid} = $myconn; #This Will Create Err Log File Also [ logseq.taskid.destid.stg ] my $ERRF; my $errfile = ">$ETL_ERR_DIR/"."$G_logseq."."$taskid."."$destid.rxerr"; printlog($INFO, "Creating ErrorLog File for Task($taskid)->Dest($destid) : $errfile"); open($ERRF, $errfile) or printlog($ERROR, "Can not Create ErrorLog file : $!"); $G_chkpoint = $G_chkpoint.",".$errfile; $hdesterrlog{$destid} = $ERRF; if(($deststoretype eq 'D') && ($taskincr eq 'N')){ truncate_dest($destid, $deststoretype, $tblfilename, $myconn); } } } sub getdest_connstmt{ my ($dest_storeids, $hdestconn, $dest_qrygrp, $hdeststmt, $dest_tblfiles) = @_; my ($deststorename, $deststoremode, $deststoretype, $deststoreip) = ''; my $lastdestid; my $ctr = 0; printlog($MAX, "Table(s)/File(s) : @$dest_tblfiles"); foreach my $destid(@$dest_storeids){ getstore_mstinfo($destid, \$deststorename, \$deststoremode, \$deststoretype, \$deststoreip); foreach my $table(@$dest_tblfiles){ if($deststoretype eq 'D'){ my $destqry = get_qry($destid, $ctr, @$dest_qrygrp[0], @$dest_qrygrp[1]); printlog($MAX, "Query To Prepare : $destqry"); my $mystmt = getstmt($$hdestconn{$destid}, $destqry); $$hdeststmt{$destid, $table} = $mystmt; # DB : Creating Statement printlog($MAX, "Statement ...: $mystmt"); } else{ # my $meta = SQL_fmaster_metaid($destid, $table); # my $metaid = @$meta[0]; my $metaid = $table; printlog($MAX, " Conn--> $destid, $metaid = $$hdestconn{$destid}"); $$hdeststmt{$destid, $metaid} = $$hdestconn{$destid}; # FILE : Assigning File Conn Handle as Stmt } $ctr++; } $ctr=0; } } sub bind_srcfiledata{ my ($taskid, $hdestmap, $wrongdesttype, $srcid, $srctype) = @_; my $i=0; my $mapping = SQL_mapcol($taskid, $wrongdesttype, $srctype); printlog($MAX, "BIND LINE:226 ($taskid, $wrongdesttype, $srctype)"); my $mid; foreach my $node(@$mapping) { printlog($INFO, "GETTING NODE : @$node"); $mid = @$node[2]; last; } my $qry = "select efm_metaid , efm_storeid ,efm_colname , efm_coltype , efm_fwidth , efm_colorder from etl_fmetadata where efm_storeid = $srcid and efm_metaid = $mid"; my $newquery = "select count(1) as cnt from ($qry) tmptbl";#dont remove order by my $xn = doselectone($newquery); my $n = @$xn[0]; printlog($INFO, "AAAAAAAAAAAAAAAAa = $n ... @$xn"); if($n le 0){ return undef; } $qry = "select efm_metaid , efm_storeid ,efm_colname , efm_coltype , efm_fwidth , efm_colorder from etl_fmetadata where efm_storeid = $srcid and efm_metaid = $mid"; my $outres = doselectall2($n, $qry); my %hmdata; foreach my $res(@$outres){ $hmdata{@$res[0], @$res[1], @$res[2]} = @$res[5]; } $i = 0; foreach my $node(@$mapping) { $$hdestmap{ @$node[4], @$node[5], @$node[6]} = $hmdata{@$node[2], @$node[1], @$node[3]}; printlog($MAX, "Mapping-{@$node[4], @$node[5], @$node[6]} =[$i] $hmdata{@$node[2], @$node[1], @$node[3]} i.e(@$node[3] -> @$node[6])"); $i++; } 1;