Ejemplo n.º 1
0
/*********************************************
*函数功能:装载数据库数据到各个容器
*函数参数:无
*函数返回值:无
**********************************************/
void load_from_mysql()
{
	const char *host = "localhost";
	const char *user = "******";
	const char *pass = "******";
	const char *db   = "book";
	MYSQL *connect = NULL;	
	
	connect = mysql_init(NULL);
	if(NULL == connect)
	{
		cout<<"init failed"<<endl;
		return ;
	}

	connect = mysql_real_connect(connect, host, user, pass, db, 0, NULL, 0);
	if(NULL == connect)
	{
		cout<<"connect failed"<<endl;
		return ;
	}

	//装载用户数据
	list_user = load_user_data(connect);
	//装载图书数据	
	list_book = load_book_data(connect);
	//装载历史记录数据
	list_t = load_transaction_data(connect);

	mysql_close(connect);
}
// Constructor
palm_installer::palm_installer()
{
    m_number_of_users = 0;

    // Set the m_palm_desktop_path to where it is on a MacOSX machine.
    m_palm_desktop_path = wxGetHomeDir() + "/Documents/Palm/Users";
    wxLogDebug( "Directory to look for Palm Users dat file is" + m_palm_desktop_path );

    // All set, so now read the "Palm Users" file in the OSX's user's home directory
    // (this is the equivalent to users.dat equivalent on MSW).
    load_user_data();
}