mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
ExportSpells converted to QueryDatabase
This commit is contained in:
parent
87efd22394
commit
11c327e1d7
@ -69,14 +69,13 @@ void ExportSpells(SharedDatabase *db) {
|
||||
return;
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
const char *query = "SELECT * FROM spells_new ORDER BY id";
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
if(db->RunQuery(query, strlen(query), errbuf, &result)) {
|
||||
while(row = mysql_fetch_row(result)) {
|
||||
const std::string query = "SELECT * FROM spells_new ORDER BY id";
|
||||
auto results = db->QueryDatabase(query);
|
||||
|
||||
if(results.Success()) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = mysql_num_fields(result);
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for(unsigned int i = 0; i < fields; ++i) {
|
||||
if(i != 0) {
|
||||
line.push_back('^');
|
||||
@ -87,9 +86,8 @@ void ExportSpells(SharedDatabase *db) {
|
||||
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query, errbuf);
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user