By publishing this post I try to help people who want to get access to popular and simple database engine sqlite through perl script. I use sqlite to store e-mails statistics at small mail server in order to retrieve information about users’ mail activity like average response time, sent and received messages and etc. There is perl script that is used to get this data per every user or get summary statistics. This script is to be run by web server (I use Apache) and has name index.cgi in my case.

Here is part of it:

#!/usr/bin/perl
use DBI;
print “Content-type: text/html\n\n”;
print “<html><head><title>perl and sqlite example script</title></head><body>”;
$dbh = DBI->connect( “dbi:SQLite:dbname=/tmp/mail_data.db”,”", “”, { RaiseError => 1, AutoCommit => 0 });

my $fst = $dbh->selectall_arrayref(“SELECT min(time_1),max(time_1) FROM mail_data”);
foreach my $row (@$fst) {
my ($fst_pr,$lst_pr) = @$row;
print “oldest entry in database: “.gmtime($fst_pr).” gmt<br>newest entry in database: “.gmtime($lst_pr);
}

print “</body>”;
print “</html>”;
$dbh->disconnect;

After you load this example through any web browser (please read your web server’s manual on how to allow cgi/perl script exec, for example here), script will read sqlite database that is located at /tmp/mail_data.db and display minimal and maximal values of field time_1 from mail_data table.

In order to run this script it’s necessary to install perl, sqlite3 and perl-DBI-SQLite cpan module.

You may also be interested in:
CGI Perl scripts debugging (solve 500 Internal Server Error)

 

103 Comments

 

  1. May 7, 2011  5:37 pm by crimeaubk.ru Reply

    ????????? ??????? ??? ? ?????? 3 ?????, 700 ??.?. ??????????? ?????? ????? ?
    ????????. ???????? ?? ????. ?? ???? 500 ??????. ??? ????????? ????????????: ????, ????, ???, ???????????, ?????????? ??????? ?????.
    500 000 usd
    ?????? ???????????? ?? ???

  2. May 27, 2011  2:23 am by Allena Celmer Reply

    Merely wish to say your article is as tonishing. The clearness in your put up is just spectacular and i can assume you might be an knowledgeable on this subject. Well together with your permission permit me to seize your rss feed to keep up to date with forthcoming post. Thanks 1,000,000 and please sustain the gratifying work.

  3. June 10, 2011  9:41 pm by ViaMurka Reply

    ?????? ????????? ?????????????????????? ?????? ?????? ??????? ? ???????????????????? ? ?????? ??????????????? ??? ????? ???????? ??? ????????? ? ?????????????? ??????? ??? ??????????????? ????????????.?????? ?.????? ??? ????? ????????? ??????? ??? ???????????? ??? ????????? ?? ???????? ???????????????? ????? ????????????? ??? ???????? ??????????? ? ????????????????????????? ??????????? ?????? ? ???????????? ??? ?????????? ?????????? ???????? ???????? ??? ????? 159 ?? ? ???? 54????? ???????? ????????????????????? ???????? ? ??????????? ?????????????????????? ????? ??? ???????? ?????????????? ????????? ???????? ??? ??? ??????? ????? ?? ?????????

  4. June 11, 2011  7:45 pm by distesutrinna Reply

    hi there amazing post we have going here.

  5. June 12, 2011  7:20 pm by distesutrinna Reply

    Hi nice thread we have going here.

  6. June 14, 2011  12:53 am by distesutrinna Reply

    Hi amazing topic you have going here!

  7. January 12, 2012  7:19 am by DriveDRmet Reply

    ???????? ??? Windows Xp ??????? usb ??????? ??? ???????? samsung 3650. ??????? usb ??????? ??? ???????? samsung c100, ??????? usb ??????? ??? ???????? samsung c110.
    ??????? usb ??????? ??? ???????? samsung sgh e250. ??????? usb ??????? ??? ???????? samsung sgh e360, ??????? usb ??????? ??? ???????? samsung sgh x510. ???????? ??? ??????? ?????

  8. January 12, 2012  2:53 pm by bennickado Reply

    Among the Air Jordan Line, Jordan 4 (IV), Jordan 5 (V) and Jordan 6 (VI) were outstanding fashions and amidst the highest commerce. During the shoes designs, Michael Jordan played an Noted role as well.
    The Air Jordan IV was made public in 1989, which was the ahead in the line that had an surplus-molded mesh. The mesh was coated in a soft plastic and blew wind in and out it to clear out the plastic mesh in the seam. This brought about the shoes Outstanding
    for breath out the high temperature during baskeball matches. Although people disfavor the shoes and thought they were ignoble when it was released, Jordan 4 grew on a lot of people supplementary. Succeeding Air Jordan 4 Laser package was also most loved by the people.
    The Air Jordan 5 was released in February 1990 to the citizens. Two models which were the Black/Black-Metallic Silver and White/Fire Red-Black had MJs number “23? on the edge. The Air Jordan V was the first off in the Air Jordan array to have a transparent rubber sole. They had bright molding which allowed light to come through. Also the AJ 5 was the first time anyone had ever molded foam into a shoe upper and the flames on the side, which indicated the fire Michael Jordan delighted in NBA matches.
    Came out in 1991, Air Jordan VI was doubtless Triumphant . Michael Jordan wanted a precise toe. So it was designed to have backup around the toe. The Air Jordan 6 was the next model to retain the clear rubber sole. The sole was affixed a higher solid rubber later as public complained on it. The shoes were also desired by Michael to locate his heel. So it was the ahead shoes to have molded arrangement on the aback. Surely a 23 number was also on the shoes to remark it as one of the shoes for Michael Jordan.
    The Air Jordan Lines carried out great success. It should be victorious as they have in hand great designers and also the a-1 basketball player, who state the designers what he desired and what was not agreeable after he tried the shoes.

  9. February 10, 2012  6:51 am by Coral Reply

    Coral StoneUSA is an creator and importer of Coral Stone. Our stone is selected from the subdue quarries in the Dominican Republic and we submit gold coral stone as well as milky coral stone. Its color and weave makes it a darned facile concrete as a service to interiors and exteriors.
    Coral Stone - http://www.coralstonepavers.com/
    Coral Stone Pavers, Coral Tiles, Coral Stone Copings, Coral Stone Bullnose Copings, Coral Stone Columns, Coral Stone Slabs. Coral Stone Columns, Coral Stone balustrades, Coral Stone handrails, Coral Stone moldings, Coral Stone corbels, Coral Stone fountains and more.

  10. March 5, 2012  2:20 am by bstflmsdetst Reply

    Hi,
    do you know where i can download this movie : http://download-kino.de/24-twenty-four-400-p-m-500-p-m/
    Links in this site is broken. Need movie in German

    For german members:

    Hallo zusammen,
    weisst du, wo ich diesen Film zum Download(Link oben) oder diese :http://download-kino.de/30-rock-sandwich-day/
    Links auf dieser Seite ist gebrochen. Brauchen Film in deutscher Sprache

  11. March 20, 2012  1:53 am by MackMillions Reply

    Hi Everyone,
    Thank you for providing this great community.
    I've been looking for a community like this for a while now.
    It's great to find a place with like minded users who are entrepreneurs online.
    I hope we can all help each other by providing information and all have great success

    -Mack

  12. April 25, 2012  11:27 pm by itockicons Reply

    Yes... Likely... The easier, the better... All ingenipus is simlpe.

  13. April 26, 2012  1:30 am by metatradex Reply

    I can not participate now in discussion - there is no free time. uBt I will be released - I will necessarily write that I think.

  14. April 26, 2012  5:03 am by macdacmmnn Reply

    What charming idea

  15. April 26, 2012  5:44 am by steveborman Reply

    I will not begin to speak on this theme.

  16. June 6, 2012  12:17 am by Tanusree Reply

    Your Great Mom! Posted on I really msiesd you! Don't do that to me again. You have posted some great stuff and I will continue to check your site at least a couple of times each week.

  17. June 11, 2012  11:57 am by Dontarrious Reply

    best credit cards 1480 free auto insurance quotes webg

  18. August 2, 2012  6:45 am by carpinteyrozkz Reply

    Welcome to NHL Heaven! MLB is a professional baseball league, consisting of teams that play in the American League and the National League. As of the 2012 season, NFL is divided into the American League 14 teams and the National League 16 teams. Currently, each league is further subdivided into three divisions - labeled East, Central, and West.
    The NBA All-Star Game, also known as the "Midsummer Classic", is an annual game between players from the National League and the American League, currently selected by a combination of fans, players, coaches, and managers. From the first All-Star Game, players have worn their regular team uniforms and caps. NHL caps are popular among the fans. The 2011 All-Star Game was played at Chase Field in Phoenix, Arizona, home of the Arizona Diamondbacks; the 2012 All-Star Game will be played at Kauffman Stadium in Kansas City, Missouri, home of the Kansas City Royals. It has been officially announced that the 2013 All-Star Game will be played at Citi Field in Queens, New York, home of the the New York Mets. NFL caps are like hot cakes all over the world.
    Our company are ready to offer you the latest fashion mlb caps. They have been highly speaking of by the fans. With its special design and style, mlb hats has stepped out of sport series,and have widely welcomed by the hip-hop lovers and sports leisure travelers. It has been the fashion forward index and tide symbol. If you like the perfect combination of fashion trends and sports, what are you waiting for? New Era MLB hats are looking forward to your discovery. If you are big fans of the NHL, you are here the right place——the NHL Heaven, buy mlb hats to support your favorite teams.

    http://www.mlbrundown.com/blogs/5/

  19. August 30, 2012  7:31 am by abtechtes Reply

    http://www.abtechtest.com


    test and measurement equipment , spectrum analyzer, oscilloscope, network analyzer

  20. September 11, 2012  2:33 am by royaltyfreeh icons Reply

    You are mistaken. Let's discuss it. Write to me in PM, we will talk.

    P.S. Please review our icons for Windows 8

  21. September 12, 2012  5:52 pm by icon album Reply

    I recommend to you to visit a site on which there are many articles on this question.

    P.S. Please review our iconalbum.com site.

  22. September 12, 2012  6:54 pm by ikonzes Reply

    It agree, it is an amusing phrase


    P.S. Please review our ikonzes site.

  23. September 12, 2012  8:13 pm by icon-design Reply

    It is very a pity to me, that I can help nothing to you. But it is assured, that you will find the correct decision. Do not despair.


    By the way, what do you think about this icons site?

  24. September 26, 2012  4:54 pm by TopMoica Reply

    ??????????? ???????? «??????????? ?????????» ???? ??????? ? 2012 ???? ? ???????????? ????? ???????????????? ?????????? ????????, ??? ?????? ??????? ? ?????????? ?????? ??????????????? ??????????? ???????????? – ??????????? ????????, ?????????, ?????? ?? ?????, ?????????????????? ??????????, ????????????? ???????????? ?????????? ?? ?????????????????, ?????????????? ? ??.

    ??????????? ??????

Leave a reply

 

Your email address will not be published.