On first impressions this may look like a homework assignment question
but I can assure you it isn't! I'm having difficulty trying to explain
this (hence the strange subject line ;-) but I hope someone can offer me
some advice...

I have four attributes (A, B, C, D) and each is an integer say, between
0 and 9.

I need a method to create a table with the following columns:

[if A=3] then A1, A2, A3
[if B=1] then B1

i.e. if A=3 and B=1 and C & D =0 then 6 columns will be created.

I already have the code (well, the logic) to do this but what is the
best way to do it. ZSQL methods can't handle such logic, right?
I was thinking maybe passing the parameters into a python method to
build a "CREATE TABLE..." string... but can this be used to actually
execute the query?

I don't know if I have explained this well enough.

Here's the logic (no particular language and A,B,C,D = P,T,A,B)

int t = TUTORIALS;
int b = BONUS;

string classAndCode = CLASSCODE;

String createDB = "CREATE TABLE " + classAndCode + " ( "

while (p != 0)
  String createDB = create DB + "p" + p + "integer, " // e.g. p0, p1,
p2, etc.
  p = p-1;

while (t != 0)
  String createDB = create DB + "t" + t + "varchar, "
  t = t-1;

... etc

Okay, say I have a python method, which returns an String (an SQL CREATE
TABLE statement). How could I execute this?

Thanks very much in advance.


PS: Alex, I managed to get the COUNT var to work. The solution was
simply a good night's sleep and a large mug of coffee in the morning.
Cheers :)

Lee Reilly

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to