commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5619 - in trunk: gnue-appserver/samples gnue-appserver/src/classrep gnu


From: reinhard
Subject: r5619 - in trunk: gnue-appserver/samples gnue-appserver/src/classrep gnue-common/src/schema
Date: Fri, 2 Apr 2004 13:28:48 -0600 (CST)

Author: reinhard
Date: 2004-04-02 13:28:47 -0600 (Fri, 02 Apr 2004)
New Revision: 5619

Modified:
   trunk/gnue-appserver/samples/gnue_useraccess.gfd
   trunk/gnue-appserver/samples/sample.gfd
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
   trunk/gnue-common/src/schema/GSData.py
   trunk/gnue-common/src/schema/Objects.py
Log:
Fixed non-integer numeric fields.


Modified: trunk/gnue-appserver/samples/gnue_useraccess.gfd
===================================================================
--- trunk/gnue-appserver/samples/gnue_useraccess.gfd    2004-04-02 15:45:58 UTC 
(rev 5618)
+++ trunk/gnue-appserver/samples/gnue_useraccess.gfd    2004-04-02 19:28:47 UTC 
(rev 5619)
@@ -5,7 +5,7 @@
 
 <form title="GNUe Useraccess">
   <options/>
-  <datasource name="dtsGnue_useraccess" connection="appserver"
+  <datasource name="dtsGnue_useraccess" connection="hotline"
               table="gnue_useraccess"/>
   <logic>
     <block name="blkGnue_useraccess" datasource="dtsgnue_useraccess">

Modified: trunk/gnue-appserver/samples/sample.gfd
===================================================================
--- trunk/gnue-appserver/samples/sample.gfd     2004-04-02 15:45:58 UTC (rev 
5618)
+++ trunk/gnue-appserver/samples/sample.gfd     2004-04-02 19:28:47 UTC (rev 
5619)
@@ -6,7 +6,7 @@
     cache="250"/>
   <datasource name="dtsMCountry" connection="appserver" 
table="address_country"/>
   <trigger name="showRecord" type="NAMED"><![CDATA[
-    retval = dtsPerson.call("address_show", {'aValue': 'fred'})
+    retval = dtsPerson.call("address_show", {})
     if retval is not None:
       print "retval =", retval
   ]]></trigger>

Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-04-02 15:45:58 UTC 
(rev 5618)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-04-02 19:28:47 UTC 
(rev 5619)
@@ -231,7 +231,7 @@
       if cProp.dbLength:
         field.length    = cProp.dbLength
       if cProp.dbScale:
-        field.scale     = cProp.dbScale
+        field.precision = cProp.dbScale
       if not cProp.gnue_nullable is None and not cProp.gnue_nullable:
         field.nullable  = False
 

Modified: trunk/gnue-common/src/schema/GSData.py
===================================================================
--- trunk/gnue-common/src/schema/GSData.py      2004-04-02 15:45:58 UTC (rev 
5618)
+++ trunk/gnue-common/src/schema/GSData.py      2004-04-02 19:28:47 UTC (rev 
5619)
@@ -95,13 +95,13 @@
   This exception is raised if a fieldvalue is out of range, e.g. a string
   exceeds it's length or a number exceeds it's numeric bounds.
   """
-  def __init__ (self, gsValue, fieldValue, length, scale = None):
+  def __init__ (self, gsValue, fieldValue, length, precision = None):
     fName = ""
     if hasattr (gsValue, "field"):
       fName = "%s: " % gsValue.field
 
-    if scale is not None:
-      rDef = "%d.%d" % (length, scale)
+    if precision is not None:
+      rDef = "%d.%d" % (length, precision)
     else:
       rDef = "%d" % length
 
@@ -135,8 +135,8 @@
   """
   This exception is raised if a string cannot be converted to a number.
   """
-  def __init__ (self, gsValue, value, length, scale):
-    fmt = _("is not a number (%d.%d)") % (length, scale)
+  def __init__ (self, gsValue, value, length, precision):
+    fmt = _("is not a number (%d.%d)") % (length, precision)
     EInvalidFormat.__init__ (self, gsValue, value, fmt)
 
 
@@ -201,7 +201,7 @@
   """
   This function checks if the @gsColumn instance has a vaild type attribute.
   If the datatype is valid, this function creates a tuple of '(typename, 
lenght,
-  scale)', otherwise an EInvalidType exception will be raised.
+  precision)', otherwise an EInvalidType exception will be raised.
   """
   fieldType = gsColumn.type.lower ().strip ()
   tpMatch   = re.compile ('^(\w+)').match (fieldType)
@@ -216,10 +216,10 @@
   if _TRANS_TYPES.has_key (typename):
     typename = _TRANS_TYPES [typename]
 
-  flength = 0
-  fscale  = 0
+  flength    = 0
+  fprecision = 0
 
-  # try to extract length and scale from fieldType
+  # try to extract length and precision from fieldType
   lsMatch = _LENGTH_SCALE.match (fieldType)
   if lsMatch is not None:
     (lstr, sstr) = lsMatch.groups ()
@@ -227,9 +227,9 @@
     if len (lstr):
       flength = int (lstr)
     if len (sstr):
-      fscale  = int (sstr)
+      fprecision = int (sstr)
 
-  return (typename, flength, fscale)
+  return (typename, flength, fprecision)
 
   
 
@@ -254,15 +254,15 @@
 
   # if we have a gsColumn instance supplied, we use it's datatype definition
   if gsColumn is not None:
-    gsValue.dataType = gsColumn.typename
-    gsValue.length   = gsColumn.length
-    gsValue.scale    = gsColumn.scale
+    gsValue.dataType  = gsColumn.typename
+    gsValue.length    = gsColumn.length
+    gsValue.precision = gsColumn.precision
 
   else:
-    (fieldType, length, scale) = verifyDataType (gsValue)
-    gsValue.dataType = fieldType
-    gsValue.length   = length
-    gsValue.scale    = scale
+    (fieldType, length, precision) = verifyDataType (gsValue)
+    gsValue.dataType  = fieldType
+    gsValue.length    = length
+    gsValue.precision = precision
 
 
   # a string type must stay in it's bounds (if known)
@@ -272,22 +272,22 @@
 
     return fieldValue
 
-  # create a number according to length and scale
+  # create a number according to length and precision
   elif gsValue.dataType == "number":
     value = fieldValue.strip ()
 
-    if gsValue.length or gsValue.scale:
+    if gsValue.length or gsValue.precision:
       vmatch = re.compile ('^([+-]{0,1})(\d+)[\.]{0,1}(\d*)$').match (value)
       if vmatch is None:
-        raise EInvalidNumber (gsValue, value, gsValue.length, gsValue.scale)
+        raise EInvalidNumber (gsValue, value, gsValue.length, 
gsValue.precision)
 
       sign = vmatch.groups () [0]
       pre  = vmatch.groups () [1]
       frac = vmatch.groups () [2]
 
-      if len (pre) > (gsValue.length - gsValue.scale) or \
-         len (frac) > gsValue.scale:
-        raise EOutOfRange (gsValue, value, gsValue.length, gsValue.scale)
+      if len (pre) > (gsValue.length - gsValue.precision) or \
+         len (frac) > gsValue.precision:
+        raise EOutOfRange (gsValue, value, gsValue.length, gsValue.precision)
 
       if len (frac):
         return float ("%s%s.%s" % (sign, pre, frac))

Modified: trunk/gnue-common/src/schema/Objects.py
===================================================================
--- trunk/gnue-common/src/schema/Objects.py     2004-04-02 15:45:58 UTC (rev 
5618)
+++ trunk/gnue-common/src/schema/Objects.py     2004-04-02 19:28:47 UTC (rev 
5619)
@@ -257,10 +257,10 @@
   """
   def __init__(self, parent):
     GSObject.__init__(self, parent, type='GSValue')
-    self.dataType = None
-    self.lenght   = None
-    self.scale    = None
-    self.value    = None
+    self.dataType  = None
+    self.lenght    = None
+    self.precision = None
+    self.value     = None
 
     self._inits.append (self._validate)
 
@@ -371,17 +371,17 @@
   """
   This class implements a column definition. Phase-I-init verifies the datatype
   of the column definition and set's the properties 'typename', 'length' and
-  'scale'.
+  'precision'.
   """
   def __init__ (self, parent):
     GSObject.__init__ (self, parent, type = "GSColumn")
-    self.typename = None
-    self.length   = None
-    self.scale    = None
+    self.typename  = None
+    self.length    = None
+    self.precision = None
     self._inits.append (self._validate)
 
   def _validate (self):
-    (self.typename, self.length, self.scale) = verifyDataType (self)
+    (self.typename, self.length, self.precision) = verifyDataType (self)
 
 
 # -----------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]