main logo
Subject: Re: [dabo-dev] VFP cursors and data update
Author: Ed Leafe
Posted: 2006/12/30 18:48:07
 
View Entire Thread
New Search


On Dec 30, 2006, at 6:16 PM, Carl Karsten wrote:

> I'll go with B. for instance, right now I am trying to write some
> simple db
> unit test code and I can't figure out how to do this using dabo
> classes:
>
> import MySQLdb
> con = MySQLdb.connect(host='vaio', user='daboadmin',
> passwd='dabo0', db='dabotest3')
> cur = con.cursor()
> ret = cur.execute( "insert into logs (host, facility) values (%
> (host)s,
> %(facility)s)", {'host': 'foo3', 'facility': 'bar3'} )
>
>
> After splunking around, I took a shot:
> db=MySQL()
> db.getConnection(
> ... hmm... looks like I need to pass an object that defines the
> connection
> parameters. trying to figure out 'that.'

Does this help? Assuming that you have the connection defined in
a .cnxml file, you can do:

f = dabo.ui.getFile("cnxml")
conn = dabo.db.dConnection(f)
crs = conn.getDaboCursor()
crs.Table = "zipcodes"
crs.executeSQL()
dabo.ui.browse(crs.getDataSet())



-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




 
©2006 Ed Leafe
<-- Prior Message New Search Next Message -->