[Dbix-class] applying sql not function in where clause

mohanprasad mohan at thebizmo.com
Wed Sep 2 10:08:39 GMT 2009


Hi,

I am trying to prepare the below where clause
where not(status ='deleted' and created < $timestamp)

in the above where clause status is varchar data type and created is
timestamp data type.

I am trying to achieve the same in my catalyst application using below code.
my $sql = SQL::Abstract->new;
my ($sub_stmt, @sub_bind) = $sql->where({status => 'deleted', created =>
{"<" => $timestamp}});
$sub_stmt =~ s/^ where //i;
$c->model('Database::Product')->search({ \["NOT ($sub_stmt)" => @sub_bind]
});

i tried to use the example provided in
http://search.cpan.org/~ribasushi/SQL-Abstract-1.56/lib/SQL/Abstract.pm
section "Literal SQL with placeholders and bind values (subqueries)"

Its giving error in where condition.
could any one please let me know where i am doing wrong?

Best Regards,
Mohan
-- 
View this message in context: http://n2.nabble.com/applying-sql-not-function-in-where-clause-tp3565854p3565854.html
Sent from the DBIx-Class mailing list archive at Nabble.com.



More information about the DBIx-Class mailing list