[SQL-CVS] SQLObject/SQLObject SQLBuilder.py,1.3,1.4
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-04-18 08:20:57
|
Update of /cvsroot/sqlobject/SQLObject/SQLObject In directory sc8-pr-cvs1:/tmp/cvs-serv8744/SQLObject Modified Files: SQLBuilder.py Log Message: * Added ISNULL and ISNOTNULL to SQLBuilder * Made == aware of None/NULL, so that it translates it to a ISNULL or ISNOTNULL Index: SQLBuilder.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/SQLObject/SQLBuilder.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SQLBuilder.py 7 Apr 2003 01:13:54 -0000 1.3 --- SQLBuilder.py 18 Apr 2003 08:20:53 -0000 1.4 *************** *** 183,189 **** return SQLOp(">=", self, other) def __eq__(self, other): ! return SQLOp("=", self, other) def __ne__(self, other): ! return SQLOp("<>", self, other) def __and__(self, other): --- 183,195 ---- return SQLOp(">=", self, other) def __eq__(self, other): ! if other is None: ! return ISNULL(self) ! else: ! return SQLOp("=", self, other) def __ne__(self, other): ! if other is None: ! return ISNOTNULL(self) ! else: ! return SQLOp("<>", self, other) def __and__(self, other): *************** *** 539,542 **** --- 545,554 ---- def CONTAINSSTRING(expr, string): return SQLOp("LIKE", expr, '%' + _likeQuote(string) + '%') + + def ISNULL(expr): + return SQLOp("IS", expr, None) + + def ISNOTNULL(expr): + return SQLOp("IS NOT", expr, None) def _likeQuote(s): |