I'm trying to create a dynamic table editor. The idea is you instance this product, give it the database host, user, pass, database name (Postgres in this case, BTW), and table, and you can edit that table via a nifty web interface. The problem is, I don't know what this table's format is beforehand, so I can't realy make any ZSQL methods for inserting new rows. Does anyone know how to work around this? Thanks, DJ.
When you say format do you mean the underlying physical format ( as in InnoDB/ BDB etc ) or do you mean just the column names. If it is the former then there usually you can use the SHOW command to get details about the table ( I only know about MySQL, but PG is way ahead of MySQL in terms of features and it should be there ). If it is the latter the same using SHOW COLUMNS will get you the list of columns. You can always use DTML in a ZSQL query to read off a dictionary of key value pairs. So IMO use a ZSQL which does something like this: insert into <table> ( <dtml-in <var_name>.keys> <dtml-var sequence-item> <dtml-if "not _['sequence-end']">,</dtml-if> </dtml-in> ) values ( <dtml-in <var_name>.values> <dtml-var sequence-item> <dtml-if "not _['sequence-end']">,</dtml-if> </dtml-in> ) I think that should do what you want. to get the dictionary the easiest way is to process the input form in a python script that creates a dictionary from the form vars. hth am Daniel Jackson wrote:
I'm trying to create a dynamic table editor. The idea is you instance this product, give it the database host, user, pass, database name (Postgres in this case, BTW), and table, and you can edit that table via a nifty web interface. The problem is, I don't know what this table's format is beforehand, so I can't realy make any ZSQL methods for inserting new rows. Does anyone know how to work around this?
Thanks, DJ.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
I mean the latter, sorry for not being more specific. Hmm.. that looks good. I should have seen that. I put it in, but now I'm getting Error Type: KeyError Error Value: valDict.keys I'm just passing the ZSQL a dict with key/value pairs from a python script. On Thu, 2003-01-16 at 12:00, AM wrote:
If it is the latter the same using SHOW COLUMNS will get you the list of columns. You can always use DTML in a ZSQL query to read off a dictionary of key value pairs.
Oh, and PS. I would use php, but it has to be in Zope. Not my project. :)
Oh I am sorry keys is a function.. it should be <dtml-in "<var_name>.keys()"> same for values sorry for the trouble. hth AM Daniel Jackson wrote:
I mean the latter, sorry for not being more specific.
Hmm.. that looks good. I should have seen that. I put it in, but now I'm getting
Error Type: KeyError Error Value: valDict.keys
I'm just passing the ZSQL a dict with key/value pairs from a python script.
On Thu, 2003-01-16 at 12:00, AM wrote:
If it is the latter the same using SHOW COLUMNS will get you the list of columns. You can always use DTML in a ZSQL query to read off a dictionary of key value pairs.
Oh, and PS. I would use php, but it has to be in Zope. Not my project. :)
.
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Dear Daniel,
I'm trying to create a dynamic table editor. The idea is you instance this product, give it the database host, user, pass, database name (Postgres in this case, BTW), and table, and you can edit that table via a nifty web interface. The problem is, I don't know what this table's format is beforehand, so I can't realy make any ZSQL methods for inserting new rows. Does anyone know how to work around this?
Have a look at: http://www.postgresql.org/idocs/index.php?catalogs.html Cheers, Ian P.S. You could just use phpPgAdmin though. ;-) -- Dr Ian Sealy Internet Development Institute for Learning and Research Technology University of Bristol
participants (3)
-
AM -
Daniel Jackson -
Ian Sealy