Author: tack
Date: Sat Apr 22 00:54:04 2006
New Revision: 1444

Modified:
   trunk/base/src/db.py

Log:
Coerce string of digits into numeric type; fix typo in _query_keywords
__doc__


Modified: trunk/base/src/db.py
==============================================================================
--- trunk/base/src/db.py        (original)
+++ trunk/base/src/db.py        Sat Apr 22 00:54:04 2006
@@ -813,8 +813,13 @@
                 if type(value) != QExpr:
                     value = QExpr("=", value)
 
-                if type(value._operand) in (int, long, float) and attr_type in 
(int, long, float):
+                # Coerce between numeric types; also coerce a string of digits 
into a numeric
+                # type.
+                if attr_type in (int, long, float) and (type(value._operand) 
in (int, long, float) or \
+                    isinstance(value._operand, basestring) and 
value._operand.isdigit()):
                     value._operand = attr_type(value._operand)
+
+                # Verify expression operand type is correct for this attribute.
                 if value._operator not in ("range", "in", "not in") and \
                    type(value._operand) != attr_type:
                     raise ValueError, "Type mismatch in query: '%s' (%s) is 
not a %s" % \
@@ -1091,7 +1096,7 @@
 
         The worst case scenario is given two search terms, each term matches
         50% of all rows but there is only one intersection row.  (Or, more
-        generally, given N rows, each term matches (1/N)*100 percent rows with
+        generally, given N terms, each term matches (1/N)*100 percent rows with
         only 1 row intersection between all N terms.)   This could be improved
         by avoiding the OFFSET/LIMIT technique as described above, but that
         approach provides a big performance win in more common cases.  This


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to