#include <rude/database.h>
#include <iostream>

using namespace std;
using namespace rude;

int main(void)
{

 // You may want to change these variables 
 //
 string username="";
 string password="";
 string database="mysql";
 string server="localhost";
 int port=3306;
 
 
 Database::addContext("mycontext", database.c_str(), username.c_str(), password.c_str(), server.c_str(), port); 
 	

 Database *db = Database::instance("mycontext");

 string sql="SHOW TABLE STATUS";

 if(db->storeResultQuery(sql.c_str()))
 {
	while(db->nextRow())
	{
		cout << ( db->column(0)  ? db->column(0)  : "(table name not available)")  		<< "\t"; // table name
		cout << ( db->column(1)  ? db->column(1)  : "(engine not available)" )  			<< "\t"; // engine
		cout << ( db->column(4)  ? db->column(4)  : "(number of rows not available)" ) 	<< "\t"; // number of rows
		cout << ( db->column(12) ? db->column(12) : "(update time not available)" )		<< "\n"; // update time
	}
 }
 else
 {
	cerr << db->getError() << "\n";
 }

 Database::finish(); 
 return 0; 

}

