[Zope] marshall zsql results
Christopher Rivard
chris at chrisrivard.com
Sun Oct 30 19:11:23 EST 2005
Hello,
I am having a little difficulty with a result object from ZSQL.
The MySQL form input is a series of checkboxes that are creating a
"mapping table".
I have gone round and round and landed here:
The checkboxes are marshalled as:
list_map_dir_id:list:int
SQL like this:
<dtml-in list_map_dir_id>
insert into listing_map (list_map_dir_id, list_map_list_id) values
(<dtml-sqlvar sequence-item type=int>,
<dtml-sqlvar list_map_list_id type=string>
)
<dtml-var sql_delimiter>
</dtml-in>
MySQL data type is int for this column.
All of this works fine, but ideally I would like to manipulate the id's
as a list.
I have tried a few variations and regularly run into "len of unsized
object" if I try to insert as a varchar or insert the full list as
[0,1,2,3,4]
I have tried a few different MySQL data types, but no luck.
Retrieving the results like this:
select * from listing_map where list_map_list_id = <dtml-var list_id>
And mapping them back to the directory table like this:
select t1.*
from directory as t1
left join listing_map as t2
on t1.dir_id = t2.list_map_dir_id
where t1.dir_id = t2.list_map_dir_id && t2.list_map_list_id = <dtml-var
list_id>
Is there a way to marshall the results of this ZSQL object back into a list?
I am branching the subsequent forms based on the above query results.
The difficulty I am running into are exclusion situations
A and B not C
Seems like it would be easier if I could loop through and pull id's from
a list. Maybe I'm asking the wrong question.
Thanks in advance,
Chris
More information about the Zope
mailing list