NAME

FormValidator::Simple::Plugin::CDBI::Unique - unique check for CDBI

SYNOPSIS

use FormValidator::Simple qw/CDBI::Unique/;

# check single column
FormValidator::Simple->check( $q => [
    name => [ [qw/CDBI_UNIQUE TableClass name/] ],
] );

# check multiple columns
FormValidator::Simple->check( $q => [
    { unique => [qw/name email/] } => [ [qw/CDBI_UNIQUE TableClass name mail/] ],
] );

# check multiple columns including '!=' check
# set "!" as prefix for key-name
FormValidator::Simple->check( $q => [
    { unique => [qw/id name email/] } => [ [qw/CDBI_UNIQUE Table !id name mail/] ]
] );


# when the class name is too long...
FormValidator::Simple->check( $q => [
    name => [ [qw/CDBI_UNIQUE MyProj::Model::User name/] ],
] );

# you can set cdbi_base_class in option.
FormValidator::Simple->set_option( cdbi_base_class => 'MyProj::Model' );
FormValidator::Simple->check( $q => [
    name => [ [qw/CDBI_UNIQUE User name/] ],
] );

DESCRIPTION

This module is a plugin for FormValidator::Simple. This provides you a validation for unique check with CDBI table class.

SEE ALSO

FormValidator::Simple

AUTHOR

Lyo Kato <lyo.kato@gmail.com>

Basic Idea: Masahiro Nagano <kazeburo@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Lyo Kato

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