mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
ExportBaseData converted to QueryDatabase
This commit is contained in:
parent
24732eff88
commit
446da590d8
@ -170,27 +170,23 @@ void ExportBaseData(SharedDatabase *db) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
|
||||||
const char *query = "SELECT * FROM base_data ORDER BY level, class";
|
auto results = db->QueryDatabase(query);
|
||||||
MYSQL_RES *result;
|
if(results.Success()) {
|
||||||
MYSQL_ROW row;
|
for (auto row = results.begin();row != results.end();++row) {
|
||||||
if(db->RunQuery(query, strlen(query), errbuf, &result)) {
|
|
||||||
while(row = mysql_fetch_row(result)) {
|
|
||||||
std::string line;
|
std::string line;
|
||||||
unsigned int fields = mysql_num_fields(result);
|
unsigned int fields = results.ColumnCount();
|
||||||
for(unsigned int i = 0; i < fields; ++i) {
|
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||||
if(i != 0) {
|
if(rowIndex != 0)
|
||||||
line.push_back('^');
|
line.push_back('^');
|
||||||
}
|
|
||||||
|
|
||||||
line += row[i];
|
line += row[rowIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(f, "%s\n", line.c_str());
|
fprintf(f, "%s\n", line.c_str());
|
||||||
}
|
}
|
||||||
mysql_free_result(result);
|
|
||||||
} else {
|
} else {
|
||||||
LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query, errbuf);
|
LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user