[Zope] Convert Help

Paula Mangas pamm@students.fct.unl.pt
Tue, 26 Feb 2002 19:11:05 +0000 (WET)



It depends on what you want to do, exactly.


For example, i am using Oracle... and i am using DCOracle2...


using your example...

----
import Products.DCO2.DCOracle2

connect_string = userid_wanted+'/'+passwd_wanted+'@'+service_wanted
db_context = connect(connect_string)
c = db_context.cursor()
for elem in ['1', '2', '3']:
	query = "insert into table values ('" + elem + "')"
	c.execute(query)
c.close()
db_context.commit()
db_context.close()
----


Something like this should work.

I hope this can help,
Paula Mangas




On Tue, 26 Feb 2002, Todd Loomis wrote:

> Paula:
> 
> Please forgive me but how would i then run/execute the sql statements?
> 
> Regards,
> Tood
> 
> At 06:38 PM 2/26/2002 +0000, you wrote:
> 
> 
> >Hi,
> >
> >I think that someone tell you before, but...
> >
> >sql_statement_list = []
> >for elem in ['1', '2', '3']:
> >         sql.append("insert into table values ('"+elem+"')")
> >
> >doing something like this, at the end, you have a list with the strings
> >you want.
> >
> >
> >Result:
> >["insert into table values ('1')", "insert into table values ('2')",
> >"insert into table values ('3')"]
> >
> >I hop this help,
> >Paula Mangas
> >
> >
> >
> >On Tue, 26 Feb 2002, Todd Loomis wrote:
> >
> > > All:
> > >
> > > I need to take the elements in the list ['1', '2', '3'] and make them
> > > separate SQL Statements:
> > >
> > > insert into table values ('1')
> > > insert into table values ('2')
> > > insert into table values ('3')
> > >
> > > how can i do this?
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > Todd Loomis
> > > SAIC - DMSO Support
> > > 1901 N. Beauregard Street, Suite 500
> > > Alexandria, VA 22311
> > > Office: 703.824.3407 Fax: 703.379.3778
> > > tloomis@dmso.mil
> > >
> > >
> > >
> > > _______________________________________________
> > > 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 )
> > >
> >
> >--
> >====================================================================
> >  "Everything should be made as simple as possible, but not simpler"
> >  -- Albert Heinstein
> >--------------------------------------------------------------------
> >Paula Mangas
> >
> >e-mail: pamm@students.fct.unl.pt
> >URL:    http://students.fct.unl.pt/~pamm/
> >TMV:    (+351) 96 2559034
> >====================================================================
> 

-- 
====================================================================
 "Everything should be made as simple as possible, but not simpler" 
 -- Albert Heinstein
--------------------------------------------------------------------
Paula Mangas

e-mail: pamm@students.fct.unl.pt
URL: 	http://students.fct.unl.pt/~pamm/
TMV:    (+351) 96 2559034
====================================================================