version 0.02
Net::LDAP::Filter::SQL - LDAP filter to SQL clause transformer
my $ldapfilter = new Net::LDAP::Filter( '(&(name=Homer)(city=Springfield))' ); my $sqlfilter = new Net::LDAP::Filter::SQL( '(&(name=Marge)(city=Springfield))' ); my $sqlfilter2 = Net::LDAP::Filter::SQL->new_from_data({ 'equalityMatch' => { 'assertionValue' => 'bar', 'attributeDesc' => 'foo' } }); my $sqlfilter3 = bless($ldapfilter,'Net::LDAP::Filter::SQL'); print Data::Dumper({ clause => $sqlfilter->sql_clause, values => $sqlfilter->sql_values }); # ... $dbh->selectall_arrayref('select * from sometable where '.$sqlfilter->sql_clause, undef, $sqlfilter->sql_values)
This module allows you to transform a Net::LDAP::Filter object into an SQL clause string containing '?' placeholders. The corresponding values can be accessed as a list, and thus can be used inside a dbh prepare or select call.
Create a new LDAP Filter
Creates a new LDAP Filter from an existing data set. i.e. a Net::LDAP::Filter structure
returns an sql where clause in string format with '?' placeholders
returns a list of values associated with the filter
my $filter = new Net::LDAP::Filter::SQL('(&(name=Marge)(city=Springfield))'); print Dumper({ clause => $filter->sql_clause, values => $filter->sql_values }); # $VAR1 = { # 'clause' => '(name = ?) and (city = ?)', # 'values' => [ # 'Marge', # 'Springfield' # ] # };
probably lots, please send patches
figure out what approxMatch should do. e.g. soundex?
send me an e-mail
Net::LDAP::Filter
Net::LDAP::Server
My mother, for raising me and my brother the way she did. Thanks mom!
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org.
Tim Esselens <tim.esselens@gmail.com>
This software is copyright (c) 2010 by Tim Esselens.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::LDAP::Filter::SQL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::LDAP::Filter::SQL
CPAN shell
perl -MCPAN -e shell install Net::LDAP::Filter::SQL
For more information on module installation, please visit the detailed CPAN module installation guide.