hello I can help pass data from MySQL to a struct and then to read the struct.
I have done this:
typedef struct TPackettest22
{
BYTE tipo;
int cantidad;
} TPackettest22;
int CHARACTER::GetbApplyOn ()
{
TPackettest22 ps;
return ps.tipo;
}
int CHARACTER::GetlApplyValue ()
{
TPackettest22 ps;
return ps.cantidad;
}
void CHARACTER::LoadtestR ()
{
TPackettest22 ps;
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT bApplyOn,lApplyValue FROM player.teststruct WHERE DwID=%d ", GetPlayerID()));
if ( pmsg->Get()->uiNumRows > 0 )
{
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
str_to_number(ps.tipo, row[0]);
str_to_number(ps.cantidad, row[1]);
}
}
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("LOAD_TEST: tipo %d cantidad %d"), ch->GetbApplyOn(), ch->GetlApplyValue());
result:
should leave: LOAD_TEST: Type 9 Number 1000