getting close. I can call my code from the unit test, but now I am not getting
the right data back.
Ultimately I need something I can bind a grid to, so I am not sure that I can
just use getFields() as a model.
I was hoping this would work:
def getDBs(self,user):
"""Get the list of DBs the given user has access to.
see dBackend.getDBs for details."""
tempCursor = self._connection.cursor()
rows = tempCursor.execute("""select distinct table_schema
from information_schema.SCHEMA_PRIVILEGES
where GRANTEE like %(user)s
""", {'user':"'"+user+"'@%"} )
return rows
def test_getDBs(self):
cur = self.cur
ret=cur.getDBs('dabo_unittest')
self.assertEqual(ret, 1)
ds = cur.getDataSet()
print ds
# ({'pk': 1L, 'cfield': u'Paul Keith McNett', 'nfield': Decimal("23.23"),
'ifield': 23L}, {'pk': 2L, 'cfield': u'Edward Leafe', 'nfield':
Decimal("42.42"), 'ifield': 42L}, {'pk': 3L, 'cfield': u'Carl Karsten',
'nfield': Decimal("23032.76"), 'ifield': 10223L})
I was expecing one row, one field:
mysql> select distinct table_schema from information_schema.SCHEMA_PRIVILEGES
where grantee like '''webuser''@%';
+--------------+
| table_schema |
+--------------+
| webtest |
+--------------+
1 row in set (0.05 sec)
Carl K
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]