Is this the easiest way to get a list of database tables?
db=pdo.connect("Module=MySQLdb;User=%s;Passwd=%s;DB=%s" % (un,pw,dbs))
if db.active:
showTables='show tables'
result=db.openRS(showTables)
tables=[]
while result.next():
for r in result.fields:
tables.append(result.fields[r].value)
print tables
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think that 'openRS' is deprecated, and 'open' is the correct method. Other than than, it looks like there isn't a simpler way to query the database to list tables/databases/or other meta information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is this the easiest way to get a list of database tables?
db=pdo.connect("Module=MySQLdb;User=%s;Passwd=%s;DB=%s" % (un,pw,dbs))
if db.active:
showTables='show tables'
result=db.openRS(showTables)
tables=[]
while result.next():
for r in result.fields:
tables.append(result.fields[r].value)
print tables
I think that 'openRS' is deprecated, and 'open' is the correct method. Other than than, it looks like there isn't a simpler way to query the database to list tables/databases/or other meta information.