I'm coding a game. (MMORPG) private server.
and when I load with command the infomartion of the player (From SQL)
Its works perfect.
But if I typing worng name. that's the SQL not found at the SQL.
Its crashing my game. (The server side)
And I just want its say "Error" and wor'nt crsash it ..
Sorry for my bad english ..
and here the code ..
std::string CQuery::CheckName(int aIndex, char *Name)
{
char String[256];
char Query[150];
SQLCHAR Str[5][64];
SQLINTEGER Indicator[5];
SQLSMALLINT Col;
SQLRETURN Retcode;
Clear();
wsprintf(Query, "SELECT Name FROM Character WHERE Name = '%s'", Name);
Retcode = SQLExecDirect(hStmt, (SQLCHAR*)Query, SQL_NTS);
SQLTables(hStmt, NULL, 0, NULL, 0, NULL, 0, (SQLCHAR*)"TABLE", SQL_NTS);
SQLNumResultCols(hStmt, &Col);
for(int i = 0; i < Col; i++)
{
SQLBindCol(hStmt, i + 1, SQL_C_CHAR, Str[i], sizeof(Str[i]), &Indicator[i]);
}
while(SQL_SUCCEEDED(SQLFetch(hStmt)))
{
for(int i = 0; i < Col; i++)
{
if(Indicator[i] != SQL_NULL_DATA)
{
wsprintf(String, "%s", Str[i]);
if(strcmpi(String, Name) == 0)
{
return String;
}
else
{
GCServerMsgStringSend("ERROR", aIndex, 1);
}
}
}
}
}
Any idea ?
(Btw the game is: Mu Online :D )