22.06.2011, 12:30
(
Последний раз редактировалось Blowfish; 23.06.2011 в 20:21.
)
Hi,
I just tried to solve my problems on my own and was successful.
(this is the thread where I described them:
http://forum.sa-mp.com/showpost.php?...postcount=1567)
I was not able to compile a fully working version of the plugin because
of the MySQL headers shipped with the source code. Using the ones
shipped with my operating system works perfectly. So I simply changed
line 46 in main.h from
to
To make the plugin support fetching multiline strings from the database i needed
to alter CMySQLHandler::FetchField a little bit. My version of it, which, in my opinion
is simpler, more elegant and faster than the original:
(this function can be found in source/CMySQLHandler.cpp, line 52 ff)
I hope that I can help someone with this.
Thanks,
Blowfish
I just tried to solve my problems on my own and was successful.
(this is the thread where I described them:
http://forum.sa-mp.com/showpost.php?...postcount=1567)
I was not able to compile a fully working version of the plugin because
of the MySQL headers shipped with the source code. Using the ones
shipped with my operating system works perfectly. So I simply changed
line 46 in main.h from
Код:
#include "mysql_include/mysql.h"
Код:
#include <mysql/mysql.h>
to alter CMySQLHandler::FetchField a little bit. My version of it, which, in my opinion
is simpler, more elegant and faster than the original:
Код:
bool CMySQLHandler::FetchField(string column)
{
if(!m_bIsConnected) {
NativeFunctions::MySQL_Log("CMySQLHandler::FetchField(%s) - You cannot call this function now. (Reason: Connection is dead)",$
return 0;
}
if(m_stField == NULL || m_stRow == NULL) {
NativeFunctions::MySQL_Log("CMySQLHandler::FetchField(%s) - You cannot call this function now. (Reason: Fields/Rows are empty$
return 0;
}
for(string::size_type i = 0;i < m_dwFields;i++) {
if(column.compare(m_stField[i].name) == 0) {
m_szResult = (m_stRow[i] ? m_stRow[i] : "NULL");
break;
}
}
NativeFunctions::MySQL_Log("CMySQLHandler::FetchField(\"%s\") - %s",column.c_str(),m_szResult.c_str());
return 1;
}
I hope that I can help someone with this.
Thanks,
Blowfish

