On 10.05 19:58, Matus UHLAR - fantomas wrote:
> I just triet do implement (successfully) lastlog procedure on
> proftpd-1.2.10 in SQL:
>
> SQLNamedQuery savelog UPDATE "last=now(),lastfrom='%h',lastserv='%v' where userid='%u'" users
> SQLLog PASS savelog
> SQLNamedQuery showlast SELECT "last from users where userid='%u'"
> SQLNamedQuery showfrom SELECT "lastfrom from users where userid='%u'"
> SQLNamedQuery showserv SELECT "lastserv from users where userid='%u'"
> SQLShowInfo PASS "230" "Last login at %{showlast} from %{showfrom} to %{showserv}"


I was thinking about joining showlast, showfrom and showserv to one query,
if SQLShowInfo could handle query returning more columns:

SQLNamedQuery lastlog SELECT "last,lastfrom,lastserv from users where userid='%u'"
SQLShowInfo PASS 230 "Last login %{lastlog[0]} from %{lastlog[1]} to %{lastlog[2]}"

However as this is (at least currently) not possible, I changed the query to
ask mysql to join them:

SQLNamedQuery lastlog SELECT "concat('Last login ',last,' from ',lastfrom,' to ',lastserv) from users where userid='%u'"
SQLShowInfo PASS "230" "%{lastlog}"

works good with MySQL

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
WinError #99999: Out of error messages.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
ProFTPD Users List
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html