hi out there,
 
this is my first posting on this list. Right now I think
this is the right place to ask details about ZPatterns.
 
I think a ZPatterns-Mailinglist should be set up, where
people like me, working hard to get the "Zen of ZPatterns"
can discuss questions related to USING ZPatterns.
 
Here my first little problem:
 
I've a db_sequence specialist who serves the Framework with
db_id's for new Records like:
 
>>> newid = db_sequence.getItem('<sequence_name>').nextid
 
The Attribute nextid is provided by a Skinscript-Method:
________________________________________________
WITH getNextId(seq_name=self.id)
COMPUTE seq_name=seq_name,nextid=_.int(nextid)
________________________________________________
 
 
"getNextId()" is a PythonMethod and uses ZSQL-Methods to
compute the NextId while Locking the Table:
________________________________________________
PARAMETER:  self, seq_name
________________________________________________
self.sql_Lock()
nid = 1
for cur_id in self.sql_NextIdGet(seq_name=seq_name):
 nid = cur_id.nextid + 1
 self.sql_NextIdUpdate(seq_name=seq_name,nextid=nid)
 break
 
else:
 self.sql_NextIdCreate(seq_name=seq_name,nextid=1)
 
self.sql_Unlock()
 
return {'seq_name':seq_name, 'nextid':nid}     # HERE'S MY PROBLEM I THINK !!!!
________________________________________________
 
I tried to return nearly everything expect a certain instance of a
"special getNextId-Return-Object" e.g. return nid / return (seq_name,nid) ...
 
I tried serveral ways to reach my return values in the SSMethod:
... COMPUTE nextid=nextid or nextid=self.nextid or nextid=RESULT ...
 
Finally i tried to follow what happens during a get-call of an Attribute in the source ..
no success ..
 
except  when i use some Dummy ZSQL-Method which does the following and works (but this is not the way to do it ..)
"select <value> as nextid, <value> as seq_name"
 
 
can someone give some advice or enlighten me about the Namespace I'm in, at SSMethods Attribute providers
at execution-time ?!?
 
 
 
 
 
 
My Second "little" Problem:
 
i'm not the first one who had problems to manage data with rdbms and zpatterns. i can get Attributes through SSMethods
easily and now tried to setup ADD/CHANGE/DELETED Rules to manage data.
 
 
Here my SSMethod for this(getEventById/insertEvent/updateEvent are ZSQL-Methods):
 
WITH QUERY getEventById(id=self.id) COMPUTE sid=_.int(id),name,time_start
WHEN OBJECT ADDED CALL insertEvent(id=self.sid)
WHEN OBJECT ADDED,CHANGED STORE sid,name,time_start
USING updateEvent(id=self.sid,name=self.name,time_start=self.time_start)
 
 
I access the Item through loadAttribute: "sid"
I set up a ZClass derived from Dataskin which acts as Storage-Class.
 
I call  
 
<dtml-let ni="newItem(key=db.getItem('data_event').nextid)" nips="ni.propertysheets.get('Basic')">
<dtml-var "nips.manage_changeProperties(REQUEST=REQUEST)">
</dtml-let>
and get back an empty object without any attributes (propertysheet-problem??)
the record in the database is created (but only because I reduced the ZSQL-Insert Method to id-parm only)
this again seems to be a Problem of the namespace I'm in while the _objectAdded() ... method.
 
 
 
- Do I need a PropertySheet when I only want to access/change/create/delete Items/Attributes from a RDBMS ??
  If yes: Which one (CommonInterfaceProp/DataSkinProp)
  If no: how do i Access/Change my Properties ??
 
- and another Question related to this:
  Which object fires the Trigger-Event (ADDED/CHANGED/DELETED)  ..
  is it the PropertySheet itself ???
 
 
lots of questions still there but these are the points i really tried to get working .. but i did'nt..
 
hope that there is an answer ..
 
thanks in advance
 
Ulrich Eck
net-labs
 
 
 
 
 
 
 
 

Reply via email to