Re: cli in sql?
От | Greg Sabino Mullane |
---|---|
Тема | Re: cli in sql? |
Дата | |
Msg-id | 1bb9fe33ef04362819dae06d5326b2ac@biglumber.com обсуждение исходный текст |
Ответ на | cli in sql? (Frank Bax <fbax@sympatico.ca>) |
Ответы |
Re: cli in sql?
|
Список | pgsql-sql |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message > If my database has column containing a filename, can I use sql to present > this filename and datemodified (as output from 'ls -l' or from mtime() > fuction) or *must* it be done after the query in interface such as php or perl? Neither. You can do it inside the db with a "pl" language such as plperlu: CREATE OR REPLACE FUNCTION filemodtime(TEXT) RETURNS TEXT LANGUAGE plperlu AS $$ my $filename = shift; -e $filename or elog(ERROR, qq{The file "$filename" does not exist\n}); return localtime($^T - (60*60*24* -M _)); $$; SELECT filemodtime('/var/log/messages'); SELECT filemodtime('/dark/matter'); -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200511111457 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFDdPkRvJuQZxSWSsgRAufUAJ9f4/IaYrJDMi3Yg74x0tkN4tmUcQCgmlu9 wAkqRHgYQY9DtdIIfH/g7xY= =n/J7 -----END PGP SIGNATURE-----
В списке pgsql-sql по дате отправления: