=head1 NAME 

Kwiki::Users::Cookie::SQL - automatically set Kwiki user name from a SQL
lookup based on a cookie value

=head1 SYNOPSIS

 $ cd /path/to/kwiki
 $ echo "users_class: Kwiki::Users::Cookie::SQL" >> config.yaml
 $ echo "users_cookie_name: user_cookie"    >> config.yaml
 $ echo "users_sql_dsn: dbi:mysql:kwiki" >> config.yaml 
 $ echo "users_sql_db_user: sql_user" >> config.yaml 
 $ echo "users_sql_db_pass: sql_pass" >> config.yaml 
 $ echo "users_sql_table: users" >> config.yaml 
 $ echo "users_sql_return_value_column: username" >> config.yaml
 $ echo "users_sql_where_cookie_column: sid" >> config.yaml
 $ echo "users_sql_where_extra: AND active = 1" >> config.yaml
 $ echo "users_sql_order_by: created_date desc" >> config.yaml

This would query the data source "dbi:mysql:kwiki":

     SELECT username 
       FROM users 
      WHERE ( sid = $cookies{$user_cookie_name} ) 
            AND active = 1 
   ORDER BY created_date desc;
 
Optionally, to display the user name:

 $ cd /path/to/kwiki
 $ kwiki -add Kwiki::UserName::Cookie
 $ echo "login_url: /login.html"    >> config.yaml

=head1 DESCRIPTION

This module will set the user's name from a SQL lookup performed using a
cookie value as query condition.

You might also want to use L<Kwiki::UserName::Cookie>.

=head1 AUTHORS

John Cappiello <jcap@cpan.org>

=head1 SEE ALSO

L<Kwiki>, l<Kwiki::Users::Cookie>, L<Kwiki::UserName::Cookie>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2005 by John Cappiello

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
