commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef TODO samples/zipcode/pg_zip_code.sql...


From: James Thompson
Subject: gnue/gnuef TODO samples/zipcode/pg_zip_code.sql...
Date: Thu, 02 Nov 2000 21:18:49 -0800

CVSROOT:        /cvs
Module name:    gnue
Changes by:     James Thompson <address@hidden> 00/11/02 21:18:49

Modified files:
        gnuef          : TODO 
        gnuef/samples/zipcode: pg_zip_code.sql states.gfd zip_code.gfd 
        gnuef/src      : GFForm.py GFObjects.py 
        gnuef/src/drivers/geas: DBdriver.py 
        gnuef/src/drivers/postgresql: DBdriver.py 

Log message:
        added order_by to datasources
        (added dummy arg to geas driver - untested)
        fixed - if tip not defined on entry then previous tip still shown
        tried to improve status bar speed
        master/detail alterations (.gfd has changed)
        new zipcode demo w/ a state.gfd to show master/detail

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/TODO.diff?r1=1.17&r2=1.18
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/pg_zip_code.sql.diff?r1=1.4&r2=1.5
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/states.gfd.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/samples/zipcode/zip_code.gfd.diff?r1=1.14&r2=1.15
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.32&r2=1.33
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.29&r2=1.30
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/drivers/geas/DBdriver.py.diff?r1=1.5&r2=1.6
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/drivers/postgresql/DBdriver.py.diff?r1=1.5&r2=1.6

Patches:
Index: gnue/gnuef/TODO
diff -u gnue/gnuef/TODO:1.17 gnue/gnuef/TODO:1.18
--- gnue/gnuef/TODO:1.17        Wed Nov  1 18:57:30 2000
+++ gnue/gnuef/TODO     Thu Nov  2 21:18:48 2000
@@ -1,7 +1,6 @@
 Tasks that someone is working on have the persons email and/or 
 name in []
 
-
 **MUST HAVES for 0.1.0
 **  Create UI/Form event interactions for login
 **  debug master/detail
@@ -11,6 +10,13 @@
 **  make packages (RPM and deb) [jade]
 **  curses support up to date [arno]
 **  cvs cleanup[jamest]
+
+the x/y width units problem
+
+status bar speed is slow
+
+current detail/masta code bombs if masta doesn't have an entry widget
+defined for that field.
 
   creating a new record and marking for delete prior to any commit
     still causes record to commit
Index: gnue/gnuef/samples/zipcode/pg_zip_code.sql
diff -u gnue/gnuef/samples/zipcode/pg_zip_code.sql:1.4 
gnue/gnuef/samples/zipcode/pg_zip_code.sql:1.5
--- gnue/gnuef/samples/zipcode/pg_zip_code.sql:1.4      Tue Oct 31 21:06:33 2000
+++ gnue/gnuef/samples/zipcode/pg_zip_code.sql  Thu Nov  2 21:18:48 2000
@@ -1,71 +1,71 @@
-create table states
+create table state
 (
   state char(2)                PRIMARY KEY,
   description varchar(30)      NOT NULL
 );
 
 
-create table zip_code 
+create table zipcode 
 (
   zip char(5)      PRIMARY KEY, 
   city varchar(30) NOT NULL,
-  state char(2)    NOT NULL REFERENCES states
+  state_code char(2)    NOT NULL REFERENCES state
 );
 
-INSERT INTO states (state, description) VALUES('AL','Alabama');
-INSERT INTO states (state, description) VALUES('AK','Alaska');
-INSERT INTO states (state, description) VALUES('AZ','Arizona'); 
-INSERT INTO states (state, description) VALUES('AR','Arkansas'); 
-INSERT INTO states (state, description) VALUES('CA','California'); 
-INSERT INTO states (state, description) VALUES('CO','Colorado'); 
-INSERT INTO states (state, description) VALUES('CT','Connecticut'); 
-INSERT INTO states (state, description) VALUES('DE','Delaware'); 
-INSERT INTO states (state, description) VALUES('DC','District of Columbia');
-INSERT INTO states (state, description) VALUES('FL','Flordia');
-INSERT INTO states (state, description) VALUES('GA','Georgia'); 
-INSERT INTO states (state, description) VALUES('GU','Guam');
-INSERT INTO states (state, description) VALUES('HI','Hawaii');
-INSERT INTO states (state, description) VALUES('ID','Idaho'); 
-INSERT INTO states (state, description) VALUES('IL','Illinois'); 
-INSERT INTO states (state, description) VALUES('IL','Indiana'); 
-INSERT INTO states (state, description) VALUES('IA','Iowa'); 
-INSERT INTO states (state, description) VALUES('KS','Kansas'); 
-INSERT INTO states (state, description) VALUES('KY','Kentucky'); 
-INSERT INTO states (state, description) VALUES('LA','Louisiana'); 
-INSERT INTO states (state, description) VALUES('ME','Maine'); 
-INSERT INTO states (state, description) VALUES('MD','Maryland'); 
-INSERT INTO states (state, description) VALUES('MA','Massachusetts'); 
-INSERT INTO states (state, description) VALUES('MI','Michigan'); 
-INSERT INTO states (state, description) VALUES('MN','Minnesota'); 
-INSERT INTO states (state, description) VALUES('MS','Mississippi'); 
-INSERT INTO states (state, description) VALUES('MO','Missouri'); 
-INSERT INTO states (state, description) VALUES('MT','Montana');
-INSERT INTO states (state, description) VALUES('NE','Nebraska'); 
-INSERT INTO states (state, description) VALUES('NV','Nevada'); 
-INSERT INTO states (state, description) VALUES('NH','New Hampshire'); 
-INSERT INTO states (state, description) VALUES('NJ','New Jersey'); 
-INSERT INTO states (state, description) VALUES('NM','New Mexico'); 
-INSERT INTO states (state, description) VALUES('NY','New York'); 
-INSERT INTO states (state, description) VALUES('NC','North Carolina'); 
-INSERT INTO states (state, description) VALUES('ND','North Dakota'); 
-INSERT INTO states (state, description) VALUES('OH','Ohio'); 
-INSERT INTO states (state, description) VALUES('OK','Oklahoma'); 
-INSERT INTO states (state, description) VALUES('OR','Oregon'); 
-INSERT INTO states (state, description) VALUES('PA','Pennsylvania'); 
-INSERT INTO states (state, description) VALUES('PR','Puerto Rico');
-INSERT INTO states (state, description) VALUES('RI','Rhode Island'); 
-INSERT INTO states (state, description) VALUES('SC','South Carolina'); 
-INSERT INTO states (state, description) VALUES('SD','South Dakota'); 
-INSERT INTO states (state, description) VALUES('TN','Tennessee'); 
-INSERT INTO states (state, description) VALUES('TX','Texas');
-INSERT INTO states (state, description) VALUES('UT','Utah'); 
-INSERT INTO states (state, description) VALUES('VT','Vermont'); 
-INSERT INTO states (state, description) VALUES('VA','Virginia'); 
-INSERT INTO states (state, description) VALUES('VI','Virgin Islands');
-INSERT INTO states (state, description) VALUES('WA','Washington'); 
-INSERT INTO states (state, description) VALUES('WV','West Virginia'); 
-INSERT INTO states (state, description) VALUES('WI','Wisconsin');
-INSERT INTO states (state, description) VALUES('WY','Wyoming'); 
+INSERT INTO state (state, description) VALUES('AL','Alabama');
+INSERT INTO state (state, description) VALUES('AK','Alaska');
+INSERT INTO state (state, description) VALUES('AZ','Arizona'); 
+INSERT INTO state (state, description) VALUES('AR','Arkansas'); 
+INSERT INTO state (state, description) VALUES('CA','California'); 
+INSERT INTO state (state, description) VALUES('CO','Colorado'); 
+INSERT INTO state (state, description) VALUES('CT','Connecticut'); 
+INSERT INTO state (state, description) VALUES('DE','Delaware'); 
+INSERT INTO state (state, description) VALUES('DC','District of Columbia');
+INSERT INTO state (state, description) VALUES('FL','Flordia');
+INSERT INTO state (state, description) VALUES('GA','Georgia'); 
+INSERT INTO state (state, description) VALUES('GU','Guam');
+INSERT INTO state (state, description) VALUES('HI','Hawaii');
+INSERT INTO state (state, description) VALUES('ID','Idaho'); 
+INSERT INTO state (state, description) VALUES('IL','Illinois'); 
+INSERT INTO state (state, description) VALUES('IL','Indiana'); 
+INSERT INTO state (state, description) VALUES('IA','Iowa'); 
+INSERT INTO state (state, description) VALUES('KS','Kansas'); 
+INSERT INTO state (state, description) VALUES('KY','Kentucky'); 
+INSERT INTO state (state, description) VALUES('LA','Louisiana'); 
+INSERT INTO state (state, description) VALUES('ME','Maine'); 
+INSERT INTO state (state, description) VALUES('MD','Maryland'); 
+INSERT INTO state (state, description) VALUES('MA','Massachusetts'); 
+INSERT INTO state (state, description) VALUES('MI','Michigan'); 
+INSERT INTO state (state, description) VALUES('MN','Minnesota'); 
+INSERT INTO state (state, description) VALUES('MS','Mississippi'); 
+INSERT INTO state (state, description) VALUES('MO','Missouri'); 
+INSERT INTO state (state, description) VALUES('MT','Montana');
+INSERT INTO state (state, description) VALUES('NE','Nebraska'); 
+INSERT INTO state (state, description) VALUES('NV','Nevada'); 
+INSERT INTO state (state, description) VALUES('NH','New Hampshire'); 
+INSERT INTO state (state, description) VALUES('NJ','New Jersey'); 
+INSERT INTO state (state, description) VALUES('NM','New Mexico'); 
+INSERT INTO state (state, description) VALUES('NY','New York'); 
+INSERT INTO state (state, description) VALUES('NC','North Carolina'); 
+INSERT INTO state (state, description) VALUES('ND','North Dakota'); 
+INSERT INTO state (state, description) VALUES('OH','Ohio'); 
+INSERT INTO state (state, description) VALUES('OK','Oklahoma'); 
+INSERT INTO state (state, description) VALUES('OR','Oregon'); 
+INSERT INTO state (state, description) VALUES('PA','Pennsylvania'); 
+INSERT INTO state (state, description) VALUES('PR','Puerto Rico');
+INSERT INTO state (state, description) VALUES('RI','Rhode Island'); 
+INSERT INTO state (state, description) VALUES('SC','South Carolina'); 
+INSERT INTO state (state, description) VALUES('SD','South Dakota'); 
+INSERT INTO state (state, description) VALUES('TN','Tennessee'); 
+INSERT INTO state (state, description) VALUES('TX','Texas');
+INSERT INTO state (state, description) VALUES('UT','Utah'); 
+INSERT INTO state (state, description) VALUES('VT','Vermont'); 
+INSERT INTO state (state, description) VALUES('VA','Virginia'); 
+INSERT INTO state (state, description) VALUES('VI','Virgin Islands');
+INSERT INTO state (state, description) VALUES('WA','Washington'); 
+INSERT INTO state (state, description) VALUES('WV','West Virginia'); 
+INSERT INTO state (state, description) VALUES('WI','Wisconsin');
+INSERT INTO state (state, description) VALUES('WY','Wyoming'); 
 
 
 
Index: gnue/gnuef/samples/zipcode/states.gfd
diff -u gnue/gnuef/samples/zipcode/states.gfd:1.1 
gnue/gnuef/samples/zipcode/states.gfd:1.2
--- gnue/gnuef/samples/zipcode/states.gfd:1.1   Tue Oct 24 20:35:01 2000
+++ gnue/gnuef/samples/zipcode/states.gfd       Thu Nov  2 21:18:48 2000
@@ -1,22 +1,49 @@
 <?xml version="1.0" ?>
 
-<form height="80" width="250" title="State Maintenance">
+<form>
+  <options>
+    <title>Master/Detail Demo</title>
+    <version>0.0.1</version>
+    <height>480</height>
+    <width>540</width>
+  </options>
 
-<options>
-  <name>State Maintenance</name>
-  <version>0.0.1</version>
-  <height>80</height>
-  <width>250</width>
-</options>
+  <database name="gnue" provider="postgresql" dbname="gnue" host="gnue"/>
+  <datasource name="state" database="gnue" table="state" cache="5" 
order_by="state"/>
+  <datasource name="cities" database="gnue" table="zipcode" cache="5" 
order_by="city"/> 
 
-  <database name="dtbsgnue" provider="postgresql" dbname="gnue" 
host="localhost"/>
-  <datasource name="dtsrcstates" database="dtbsgnue" table="states" cache="5"/>
   <page>
-    <block name="blckdtsrcstates" datasource="dtsrcstates">
-      <label text="state" x="5" y="5"/>
-      <entry name="ntrystate" field="state" x="5" y="15" width="200" 
height="20"/>
-      <label text="description" x="5" y="30"/>
-      <entry name="ntrydescription" field="description" x="5" y="40" 
width="200" height="20"/>
+    <block name="state" datasource="state">
+      <label text="State Code" x="5" y="10"/>
+      <entry name="state" field="state" x="5" y="20" width="40" height="20" 
visibleCount="5"/>
+      <label text="Description" x="50" y="10"/>
+      <entry name="state" field="description" x="50" y="20" width="150" 
height="20" visibleCount="5"/>
     </block>
+
+
+    <!-- Block of cities -->
+    <block name="cities" datasource="cities" master="state.state" 
detail="state_code">
+      <label text="City" x="5" y="100"/>
+      <entry name="city" field="city" x="5" y="110" width="150" height="20" 
visibleCount="5" readonly=""/>
+
+      <label text="State" x="65" y="100"/>
+      <entry name="state" field="state_code" x="65" y="110" width="150" 
height="20" visibleCount="5" readonly=""/>
+
+      <label text="Zip" x="125" y="100"/>
+      <entry name="zip" field="zip" x="125" y="110" width="150" height="20" 
visibleCount="5" readonly=""/>
+    </block>
+
   </page>
+
 </form>
+
+
+
+
+
+
+
+
+
+
+
Index: gnue/gnuef/samples/zipcode/zip_code.gfd
diff -u gnue/gnuef/samples/zipcode/zip_code.gfd:1.14 
gnue/gnuef/samples/zipcode/zip_code.gfd:1.15
--- gnue/gnuef/samples/zipcode/zip_code.gfd:1.14        Tue Oct 31 21:06:33 2000
+++ gnue/gnuef/samples/zipcode/zip_code.gfd     Thu Nov  2 21:18:48 2000
@@ -9,30 +9,29 @@
   </options>
 
   <database name="gnue" provider="postgresql" dbname="gnue" host="gnue"/>
-  <datasource name="zips" database="gnue" table="zip_code" cache="5"/> 
-  <datasource name="validator" database="gnue" table="states" prequery="" />
+  <datasource name="zips" database="gnue" table="zipcode" cache="5" 
order_by="state_code,city"/> 
+  <datasource name="validator" database="gnue" table="state" prequery="" 
order_by="description"/>
 
-
   <page>
     <block name="zip" datasource="zips">
       <label text="City" x="5" y="10"/>
-      <entry name="city" field="city" x="5" y="20" width="150" height="20" 
visibleCount="10" uppercase="">
+      <entry name="city" field="city" x="5" y="20" width="150" height="20" 
visibleCount="15" uppercase="">
        <options>
-         <tip>Don't eat yellow snow</tip>
+         <tip>Full name of city</tip>
        </options>
       </entry>
 
       <label text="State" x="65" y="10"/>
-      <entry name="state" field="state" x="65" y="20" width="150" height="20" 
visibleCount="10" uppercase="" foreign_key="validator.state" 
foreign_key_description="description" style="dropdown">
+      <entry name="state" field="state_code" x="65" y="20" width="150" 
height="20" visibleCount="15" uppercase="" foreign_key="validator.state" 
foreign_key_description="description" style="dropdown">
        <options>
-         <tip>Don't accept rides from strainger</tip>
+         <tip>State</tip>
        </options>
       </entry>
 
       <label text="Zip" x="125" y="10"/>
-      <entry name="zip" field="zip" x="125" y="20" width="150" height="20" 
visibleCount="10" numeric="" max_length="5">
+      <entry name="zip" field="zip" x="125" y="20" width="150" height="20" 
visibleCount="15" numeric="" max_length="5">
        <options>
-         <tip>Don't ask, just back away</tip>
+         <tip>US Postal Zip Code</tip>
        </options>
       </entry>
 
@@ -40,3 +39,4 @@
   </page>
 
 </form>
+
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.32 gnue/gnuef/src/GFForm.py:1.33
--- gnue/gnuef/src/GFForm.py:1.32       Wed Nov  1 18:57:30 2000
+++ gnue/gnuef/src/GFForm.py    Thu Nov  2 21:18:48 2000
@@ -160,20 +160,35 @@
   def initTriggers(self, object):
     if object.getObjectType() == "GFTrigger":
       object.triggerns.update( self.triggerns )
+
   #
   # end of routines made for walking
   #
-
   def updateStatus(self):
+    self.updateTip()
+    self.updateInsertMode()
+    self.updateRecordCounter()
+    self.updateRecordStatus()
+    
+
+  def updateInsertMode(self):
+    
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,None,self.insertMode,None,None]))
+    
+  def updateRecordCounter(self):
+    
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,None,None,self.currentBlock.currentRecord+1,self.currentBlock.recordCount+1]))
+    
+  def updateTip(self):
     if hasattr(self.currentEntry,'tip'):
       tip = self.currentEntry.tip
     else:
-      tip = None
+      tip = ''
 
+    self.dispatchEvent(GFEvent('uiUPDATESTATUS',[tip,None,None,None,None]))
+    
+  def updateRecordStatus(self):
     status = 
self.currentBlock.dataSourceLink.resultSetStatus[self.currentBlock.currentRecord]
+    self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,status,None,None,None]))
     
-    
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[tip,status,self.insertMode,self.currentBlock.currentRecord+1,self.currentBlock.recordCount+1]))
-
   def findValue(self, blockname, fieldname):
     for block in self.blockList:
       if block.name == blockname:
@@ -187,7 +202,7 @@
       
   def toggleInsertMode(self,event):
     self.insertMode = not self.insertMode
-    self.updateStatus()
+    self.updateInsertMode()
 
   #
   # Incomming Event handlers
@@ -201,25 +216,33 @@
     self.dispatchEvent(GFEvent('uiNEXTRECORD',self.currentEntry))
     self.dispatchEvent(GFEvent('nextRECORD',self.currentBlock))
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+    self.updateRecordCounter()
+    self.updateRecordStatus()
+    self.updateTip()
 
   def prevRecord(self, event):
     self.dispatchEvent(GFEvent('uiPREVRECORD',self.currentEntry))
     self.dispatchEvent(GFEvent('prevRECORD',self.currentBlock))
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+    self.updateRecordCounter()
+    self.updateRecordStatus()
+    self.updateTip()
 
   def newRecord(self, event):
     if not hasattr(self,'readonly'):
       self.dispatchEvent(GFEvent('newRECORD',self.currentBlock))
-      self.updateStatus()
+      self.updateRecordStatus()
+      self.updateRecordCounter()
+#      self.updateTip()
+
+        
     else:
       self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
 
   def deleteRecord(self, event):
     if not hasattr(self,'readonly'):
       self.dispatchEvent(GFEvent('deleteRECORD',self.currentBlock))
-      self.updateStatus()
+      self.updateRecordStatus()
     else:
       self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
       
@@ -235,17 +258,19 @@
   def executeCommit(self, event):
     if not hasattr(self,'readonly'):
       self.dispatchEvent(GFEvent('processCOMMIT',self.currentBlock))
+      self.updateRecordStatus()
+      self.updateRecordCounter()
     else:
       self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
 
                                
   def recordSwitched(self, event):
     self.dispatchEvent(GFEvent('updateENTRY',event.data))
-    self.updateStatus()
+    self.updateRecordStatus()
+    self.updateTip()
 
   def notifyDetailBlocks(self, event):
-#    if self.mode == 'normal':
-      self.dispatchEvent(GFEvent('updateDETAILBLOCK',event.data))
+    self.dispatchEvent(GFEvent('updateDETAILBLOCK',event.data))
 
   #
   # nextEntry
@@ -278,8 +303,12 @@
     nextEntry.processTrigger('Post-FocusIn')
 
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+    self.updateRecordStatus()
+    self.updateTip()
 
+        
+#    self.updateStatus()
+
   #
   # previousEntry
   #
@@ -309,8 +338,12 @@
     nextEntry.processTrigger('Post-FocusIn')
 
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+    self.updateRecordStatus()
+    self.updateTip()
 
+        
+#    self.updateStatus()
+
   #
   # changeFocus
   #
@@ -327,7 +360,9 @@
     event.data.processTrigger('Post-FocusIn')
 
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+    self.updateRecordStatus()
+    self.updateTip()
+#    self.updateStatus()
                         
   #
   # nextBlock
@@ -365,7 +400,7 @@
 
     self.dispatchEvent(GFEvent('gotoPAGE',self.currentPage));
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+#    self.updateStatus()
 
   #
   # previousBlock
@@ -400,7 +435,7 @@
 
     self.dispatchEvent(GFEvent('gotoPAGE',self.currentPage));
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-    self.updateStatus()
+#    self.updateStatus()
 
   #
   # cursorMove
@@ -470,7 +505,7 @@
       self.currentEntry.cursorPosition = self.currentEntry.cursorPosition + 1
       self.dispatchEvent(GFEvent('updateENTRY',self.currentEntry));
     else:
-      self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
+      self.dispatchEvent(GFEvent('formALERT','Field is readonly'))
 
                                
   #
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.29 gnue/gnuef/src/GFObjects.py:1.30
--- gnue/gnuef/src/GFObjects.py:1.29    Wed Nov  1 18:57:30 2000
+++ gnue/gnuef/src/GFObjects.py Thu Nov  2 21:18:48 2000
@@ -220,15 +220,17 @@
   # 
 
   def updateDetail(self,event):
-    if hasattr(self,'masterBlock'):
-      if self.masterBlock == event.data.name:
-        fieldValue = self.form.findValue(self.masterBlock, self.masterField)
+
+    if hasattr(self,'master'):
+      masterBlock,masterField = string.split(self.master,'.')
+      if masterBlock == event.data.name:
+        fieldValue = self.form.findValue(masterBlock, masterField)
         self.dataSourceLink.clear()
         if len(fieldValue) > 0:
           if GFOptions.DEBUG:
             print "Master Field value is %s" % (fieldValue)
           ## clear the link
-          self.dataSourceLink.setField(0,self.masterField,fieldValue)
+          self.dataSourceLink.setField(0,self.detail,fieldValue)
           self.dataSourceLink.query()
         
         self.recordCount = 
self.form.datasourceDictionary[self.datasource].getLastRecordNumber()
@@ -519,7 +521,10 @@
             mask[key]=self.resultSet[0][key]
 
       self.clear()
-      self.resultSet = self.dataConnection.query(self.table, len(mask) and 
mask or None)
+      if not hasattr(self,'order_by'):
+        self.order_by = None
+        
+      self.resultSet = self.dataConnection.query(self.table, len(mask) and 
mask or None, self.order_by)
       for count in range(len(self.resultSet)):
         self.resultSetStatus.append('saved')
       
@@ -650,8 +655,8 @@
     self.link = self.factory.create(self.provider).DBdriver()
     self.link.connect(self.host,self.dbname,user,passwd)
 
-  def query(self, table, mask):
-    results = self.link.query(table,mask)
+  def query(self, table, mask, order_by):
+    results = self.link.query(table,mask,order_by)
     return results
 
   def commit(self):
Index: gnue/gnuef/src/drivers/geas/DBdriver.py
diff -u gnue/gnuef/src/drivers/geas/DBdriver.py:1.5 
gnue/gnuef/src/drivers/geas/DBdriver.py:1.6
--- gnue/gnuef/src/drivers/geas/DBdriver.py:1.5 Mon Oct 30 20:43:02 2000
+++ gnue/gnuef/src/drivers/geas/DBdriver.py     Thu Nov  2 21:18:48 2000
@@ -1,7 +1,7 @@
 #
 # GEAS database driver
 #
-# $Id: DBdriver.py,v 1.5 2000/10/31 04:43:02 jmeskill Exp $
+# $Id: DBdriver.py,v 1.6 2000/11/03 05:18:48 jamest Exp $
 #
 
 import sys
@@ -49,7 +49,7 @@
         self.database.disconnect();
        self.database.release();
 
-    def query(self, table, mask = None):
+    def query(self, table, mask = None, order_by=None):
         (objectID, mask) = self.filterMask(mask)
         rs = []
         
Index: gnue/gnuef/src/drivers/postgresql/DBdriver.py
diff -u gnue/gnuef/src/drivers/postgresql/DBdriver.py:1.5 
gnue/gnuef/src/drivers/postgresql/DBdriver.py:1.6
--- gnue/gnuef/src/drivers/postgresql/DBdriver.py:1.5   Wed Nov  1 18:57:30 2000
+++ gnue/gnuef/src/drivers/postgresql/DBdriver.py       Thu Nov  2 21:18:49 2000
@@ -57,15 +57,16 @@
   # be offered back to PyGreSql maintainer for inclusion
   # in that package (if they want it :)
   #
-  def query(self,table,mask):
-    command = self.constructSQL('query',table, mask)
+  def query(self,table,mask,order_by=None):
+    command = self.constructSQL('query',table, mask,order_by)
     resultset = self.connection.query(command).dictresult()
     return resultset
   
-  def constructSQL(self, style, table, mask = None):
+  def constructSQL(self, style, table, mask = None, order_by=None):
     sql = None
     fields = None
     qualifier = None
+    
 
     if style == 'query':
       action = "SELECT "
@@ -82,9 +83,13 @@
               qualifier = "%s AND %s LIKE  '%s'" % (qualifier, 
fieldname,mask[fieldname])
       
       sql = action + fields + location + (qualifier and qualifier or "")
-      
+      if order_by != None:
+        sql = sql + ' order by ' + order_by
+              
     else:
       print "constructSQL: unsupport SQL statement type"
+
+
 
     if GFOptions.DEBUG > 50:
       print sql



reply via email to

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