[CalendarServer-changes] [7115] CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test /test_sqlsyntax.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 7 18:59:54 PST 2011


Revision: 7115
          http://trac.macosforge.org/projects/calendarserver/changeset/7115
Author:   glyph at apple.com
Date:     2011-03-07 18:59:54 -0800 (Mon, 07 Mar 2011)
Log Message:
-----------
Explicitly test for use of None to mean NULL in an Update.  Already passing but want to make sure this stays true with any refactoring, as distinct from the behavior in an == ("is NULL") comparison.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py

Modified: CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py	2011-03-08 02:59:43 UTC (rev 7114)
+++ CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py	2011-03-08 02:59:54 UTC (rev 7115)
@@ -702,6 +702,20 @@
                         "(BAR = ? or BAZ = ?)", [7, 8, 8, 0]))
 
 
+    def test_updateWithNULL(self):
+        """
+        As per the DB-API specification, "SQL NULL values are represented by the
+        Python None singleton on input and output."  When a C{None} is provided
+        as a value to an L{Update}, it will be relayed to the database as a
+        parameter.
+        """
+        self.assertEquals(
+            Update({self.schema.BOZ.QUX: None},
+                   Where=self.schema.BOZ.QUX == 7).toSQL(),
+            SQLFragment("update BOZ set QUX = ? where QUX = ?", [None, 7])
+        )
+
+
     def test_subSelectComparison(self):
         """
         A comparison of a column to a sub-select in a where clause will result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110307/9165a9c2/attachment.html>


More information about the calendarserver-changes mailing list