I am trying to get a string from the database. Heres what I got working so far.
Code: Select all
int32 count;
int32 message_id;
string_t message;
string_t username;
// char will not be logged in so get the id manually
const int8* Query = "SELECT message_id, username, message FROM phpbb_chat WHERE count = '0';";
int32 ret = Sql_Query(SqlHandle,Query);
if (Sql_NextRow(SqlHandle) == SQL_SUCCESS)
{
message_id = (int32)Sql_GetIntData(SqlHandle,0);
username = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
message = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
count = (int32)Sql_GetIntData(SqlHandle,0);
ShowNotice(CL_RED"TRACER:COMMAND: CRecastContainer::Check MessageID %u Username %s Message %s Count %u \n" CL_RESET,message_id,username.c_str(),message.c_str(),count);
}
Print out loos like this.
TRACER:COMMAND: CRecastContainer::Check MessageID 470 Username NULL Message NULL Count 0
It should look lie this
TRACER:COMMAND: CRecastContainer::Check MessageID 470 Username Clarity Message Hello World Count 0
Now Message_ID and Count works it is pulling the correct data.
message_id = (int32)Sql_GetIntData(SqlHandle,0);<____________________________THIS IS GOOD
username = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
message = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
count = (int32)Sql_GetIntData(SqlHandle,0);<____________________________THIS IS GOOD
So it leads me to believe the problem is with
username = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
message = (int32) Sql_GetUIntData(SqlHandle,0);<______________________PROBLEM CAN NOT GET THE STRING
I thought there would be Sql_GetStrData like there is Sql_GetUIntData but there is not one.
Would anyone know the solution?