Pages: 1/6 First page 1 2 3 4 5 6 Next page Final page [ View by Articles | List ]

use perl to get timestamp

[不指定 2009/10/30 08:48 | by askwan ]
in different  context have different value
eg:
saclar context
print scalar (localtime);

then output :
Thu Oct 29 18:50:01 2009

but in list context ;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
$sec    0 ~ 59
$min    0 ~ 59
$hour  0 ~ 23
$mday   1~31
$mon     0 ~ 11
$year   after 1900,it passed years
$wday    0 ~ 6
$yday    0 ~365
$isdst   insignificant for me

can use this to get timestamp

output:
2009-10-29 19:2:40

have some defect ablove,use this

output:
2009-10-29 19:02:45

you can also use POSIX functions:
eg


output:
2009-10-29 11:10:44
2009-10-29 19:10:44
first, install  DBI and DBD::Pg module

come next two example I have writen for testing:

example one:


example two:
output :
datname             blks_read           blks_hit            
------------------------------------------------------------
template1           0                   0                  
template0           0                   0                  
postgres            136                 5955                
askwan              124                 7396
        
the first way:


the second way:


----------END-----------
Tags: , ,

perl连oracle取BLOB字段值

[不指定 2009/09/09 15:00 | by askwan ]
oracle数据库中有一字表字段类型为BLOB,存储的pdf,doc文档等的二进制文件数据,现在要拿出来这些文件来




------------end----------
Tags: , ,
Pages: 1/6 First page 1 2 3 4 5 6 Next page Final page [ View by Articles | List ]