[Zope-dev] ZPatterns - help!
bens@killersite.com
bens@killersite.com
Thu, 23 Nov 2000 13:58:57 -0500
I am trying to create 'virtual' DataSkins that totally live in a
SQL database. How do I create a new item in a rack without
providing an initial ID for the object?
Here's what I've been doing so far...
1. I have Storage set to "loaded by accessing attribute 'id'".
2. I have an ADD trigger that creates a MySql row and returns the
LAST_INSERT_ID() as "id" ("Keeping:id=RESULT.new_obj").
3. I have a CHANGE trigger that updates the MySql row with
attributes.
4. I have a CatalogTrigger.
Now it almost works when I try to add an object with key=random()
by:
<dtml-let ni="newItem(key)"
nips="ni.propertysheets.get('Basic')">
<dtml-call "nips.manage_changeProperties(REQUEST)">
So what I belive this is doing is creating a temperery object then
changing it's ID (which sounds very screwy).
The problem I am having is first of all the Catalog is indexing the
temporery random key not the one returned from the CREATE trigger.
Please advise.
Also in my CHANGE trigger I am calling SQL like this:
UPDATE sc_account SET
<dtml-in CHANGED_ATTRS>
<dtml-var sequence-item>= <dtml-var
expr="_.getattr(object,_['sequence-item'])" sql_quote>
<dtml-unless sequence-end>,</dtml-unless>
</dtml-in>
This updates all my 'string' fields but not the 'int' ones I think
because they are quoted by "sql_quote" (although I'm not sure).
Please advise.
I know this is a rambling email but I would greatly appreciate your
help in creating DataSkins that are stored in RDBMS not
persistently.
Once I get this working I'll post a full How-To (unless there is
one already that I've missed).
-Ben