SlideShare a Scribd company logo
Perl DBI usage at report building Joe Jiang [email_address]
Perl Language Practical Extraction and ... Reporting Language
Perl Programmer Laziness Impatience Hubris (Boldness)
DBMS Database Management (descide) System
DBI.pm The gate to Management level programming
Back to reporting The man in breau The game they played The suggestion I once made on OLAP
Chemical Perl (Gas-ware) PHP for website Python for architecture Ruby for rails Perl for what?
Reports again DMBS is the container SQL is for query Perl is the formater
Give me Excel Copy HTML table into Excel Or, name HTML as .xls Use some IDE tool?
Toolset basic $ echo 'select SESSION_ID, HIT_ID from hit where USERNAME=? and ACCESS_TIME between to_date(?,?) and to_date(?,?)' > session.sql ↵
It worked $ bofc < session.sql user-123 201106122345 YYYYMMDDHH24MI 201106122357 YYYYMMDDHH24MI | wc -l  ↵ SESSION_ID  HIT_ID 12
And ... $ bofc < session.sql user-123 201106122345 YYYYMMDDHH24MI 201106122357 YYYYMMDDHH24MI | sort ↵ SESSION_ID  HIT_ID 20110612234046  1772475805 20110612234046  1772475807 20110612234046  1772475809 20110612234046  1772475811 20110612234046  1772475813 ...
Highlights works with wc -l & sort (Laziness)
works with parameter binding (Boldness)
purify the SQL with limited punctuaction (Impatience)
Camel coding PERL5LIB=/proj/Web/EMIS/Modules perl -MEMIS::Database -le '($s= do{$d=EMIS::Database::gethandle(q(CDB)); $d->do(q(begin; nls_format_setting; end;)); $d}->prepare_cached(join q(),<STDIN>))->execute(@ARGV); $,=qq(\t); print STDERR @{$s->{NAME}}; print @r while @r=$s->fetchrow_array; $d->disconnect' $*
Hints PERL5LIB=/proj/Web/EMIS/Modules -MEMIS::Database
-le ' ... '
$s = do { $d=...; ...; $d } -> prepare_cached( join q(),<STDIN>)
( $s = ... ) -> excute ( @ARGV );
$, = qq( \t );
print STDERR @{$s->{NAME}};
print @r while @r=$s->fetchrow_array;
emp #!/usr/bin/perl -l use  DBI; $s  =  do  { DBI-> connect ( q(DBI:mysql:database=employees) ,  q() ,  q() ); }->prepare_cached(  join ( q() ,<>) ); $s->execute ( @ARGV ); $, = qq( \t ) ; print   STDERR   @{$s->{ NAME }} ; print   @r   while   @r = $s->fetchrow_array ;
Work Horse But I want query more than one DB ... Can you send me another column? Make a comma seperated list in one column ...
Report Driven Report binding variables no longer in @ARGV
SQL no longer in STDIN
Here comes loop
Running faster by prepare $s=$d->prepare_cached(do { open(SQL, q(<), shift); join(q(),<SQL>) });
$s->execute(@F);
@r=$s->fetchrow_array;
@x = map {q()} @r unless @x;
IO::Handle::autoflush STDOUT 1;

More Related Content

What's hot (20)

PPTX
Bioinformatics p1-perl-introduction v2013
Prof. Wim Van Criekinge
 
PPT
LPW: Beginners Perl
Dave Cross
 
PDF
Improving Dev Assistant
Dave Cross
 
PPT
Perl Basics with Examples
Nithin Kumar Singani
 
PPT
Perl 101 - The Basics of Perl Programming
Utkarsh Sengar
 
ODP
Introducing Modern Perl
Dave Cross
 
PDF
Perl.Hacks.On.Vim
Lin Yo-An
 
ODP
Introduction to Perl
Dave Cross
 
PDF
Introduction to Perl and BioPerl
Bioinformatics and Computational Biosciences Branch
 
ODP
Advanced Perl Techniques
Dave Cross
 
ODP
Intermediate Perl
Dave Cross
 
KEY
Introduction to Perl Best Practices
José Castro
 
PDF
Perl Programming - 02 Regular Expression
Danairat Thanabodithammachari
 
PPTX
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
ODP
Beginning Perl
Dave Cross
 
ODP
PHP Web Programming
Muthuselvam RS
 
Bioinformatics p1-perl-introduction v2013
Prof. Wim Van Criekinge
 
LPW: Beginners Perl
Dave Cross
 
Improving Dev Assistant
Dave Cross
 
Perl Basics with Examples
Nithin Kumar Singani
 
Perl 101 - The Basics of Perl Programming
Utkarsh Sengar
 
Introducing Modern Perl
Dave Cross
 
Perl.Hacks.On.Vim
Lin Yo-An
 
Introduction to Perl
Dave Cross
 
Introduction to Perl and BioPerl
Bioinformatics and Computational Biosciences Branch
 
Advanced Perl Techniques
Dave Cross
 
Intermediate Perl
Dave Cross
 
Introduction to Perl Best Practices
José Castro
 
Perl Programming - 02 Regular Expression
Danairat Thanabodithammachari
 
PHP Powerpoint -- Teach PHP with this
Ian Macali
 
Beginning Perl
Dave Cross
 
PHP Web Programming
Muthuselvam RS
 

Similar to perl usage at database applications (20)

PDF
R57shell
ady36
 
PDF
How to write code you won't hate tomorrow
Pete McFarlane
 
PPTX
Views notwithstanding
Srikanth Bangalore
 
PPT
Working with databases in Perl
Laurent Dami
 
PDF
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
 
PPT
Framework
Nguyen Linh
 
PPT
Advance Techniques In Php
Kumar S
 
PPT
DBIx-DataModel v2.0 in detail
Laurent Dami
 
PDF
Good Evils In Perl
Kang-min Liu
 
PPTX
Groovy
Zen Urban
 
ODP
Functional perl
Errorific
 
PDF
2013 - Benjamin Eberlei - Doctrine 2
PHP Conference Argentina
 
PDF
PHP and Rich Internet Applications
elliando dias
 
PPT
Php Reusing Code And Writing Functions
mussawir20
 
ODP
Mysqlppt
Reka
 
PDF
Camping
Gregor Schmidt
 
PPT
PHP POWERPOINT SLIDES
Ismail Mukiibi
 
PPT
Pxb For Yapc2008
maximgrp
 
ODP
Scala 2 + 2 > 4
Emil Vladev
 
PPT
Go OO! - Real-life Design Patterns in PHP 5
Stephan Schmidt
 
R57shell
ady36
 
How to write code you won't hate tomorrow
Pete McFarlane
 
Views notwithstanding
Srikanth Bangalore
 
Working with databases in Perl
Laurent Dami
 
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
 
Framework
Nguyen Linh
 
Advance Techniques In Php
Kumar S
 
DBIx-DataModel v2.0 in detail
Laurent Dami
 
Good Evils In Perl
Kang-min Liu
 
Groovy
Zen Urban
 
Functional perl
Errorific
 
2013 - Benjamin Eberlei - Doctrine 2
PHP Conference Argentina
 
PHP and Rich Internet Applications
elliando dias
 
Php Reusing Code And Writing Functions
mussawir20
 
Mysqlppt
Reka
 
PHP POWERPOINT SLIDES
Ismail Mukiibi
 
Pxb For Yapc2008
maximgrp
 
Scala 2 + 2 > 4
Emil Vladev
 
Go OO! - Real-life Design Patterns in PHP 5
Stephan Schmidt
 
Ad

Recently uploaded (20)

PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
July Patch Tuesday
Ivanti
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Ad

perl usage at database applications