Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Boolean comparisons in Predicates (WHERE clause)...
 

Pages: 1
LLBLGen Pro Runtime Framework
Boolean comparisons in Predicates (WHERE clause)...
Page:1/1 

  Print all messages in this thread  
Poster Message
JSobell
User



Location:

Joined on:
07-Jan-2006 06:44:46
Posted:
89 posts
# Posted on: 16-Apr-2008 06:46:09.  
Hi,
I know similar questions to this have been asked before, but I can't find a solution mentioned in the forums.

We have a requirement to restrict the results of a query based on a boolean mask (for a security implementation) under MS SQL Server.

A simplified query might be:
"SELECT * FROM myTable WHERE (permission & 8) <> 0"

How is this expressed in a predicate expression in LLBLGen? I understand that Oracle doesn't support the bitwise commands, and that's fine; we only need an MS-SQL solution Regular Smiley

Cheers,
Jason
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14584 posts
# Posted on: 16-Apr-2008 11:51:26.  
The filter should look like the following (un-tested code):

Code:
PredicateExpression filter = new PredicateExpression();
int attributes = 8;    

IExpression myExpression = new Expression(MyTableFields.Permission, ExOp.BitwiseAnd, attributes);
IEntityField2 myField = MyTableFields.Permission.SetExpression(myExpression);

filter.Add(myField != 0);


  Top
JSobell
User



Location:

Joined on:
07-Jan-2006 06:44:46
Posted:
89 posts
# Posted on: 18-Apr-2008 02:34:41.  
With a little modification this works nicely, thanks.

Cheers,
Jason
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.