mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
ImportSpells converted to QueryDatabase
This commit is contained in:
parent
b7bcd13cbd
commit
503a2c0d04
@ -79,8 +79,8 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string delete_sql = "DELETE FROM spells_new";
|
std::string query = "DELETE FROM spells_new";
|
||||||
db->RunQuery(delete_sql.c_str(), (uint32)delete_sql.length());
|
db->QueryDatabase(query);
|
||||||
|
|
||||||
int columns = GetSpellColumns(db);
|
int columns = GetSpellColumns(db);
|
||||||
int spells_imported = 0;
|
int spells_imported = 0;
|
||||||
@ -97,8 +97,8 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
std::string escaped = ::EscapeString(buffer);
|
std::string escaped = ::EscapeString(buffer);
|
||||||
auto split = SplitString(escaped, '^');
|
auto split = SplitString(escaped, '^');
|
||||||
int line_columns = (int)split.size();
|
int line_columns = (int)split.size();
|
||||||
std::string sql;
|
|
||||||
|
|
||||||
|
std::string sql;
|
||||||
if(line_columns >= columns) {
|
if(line_columns >= columns) {
|
||||||
sql = "INSERT INTO spells_new VALUES(";
|
sql = "INSERT INTO spells_new VALUES(";
|
||||||
for(int i = 0; i < columns; ++i) {
|
for(int i = 0; i < columns; ++i) {
|
||||||
@ -134,7 +134,7 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
sql += ");";
|
sql += ");";
|
||||||
}
|
}
|
||||||
|
|
||||||
db->RunQuery(sql.c_str(), (uint32)sql.length());
|
db->QueryDatabase(sql);
|
||||||
|
|
||||||
spells_imported++;
|
spells_imported++;
|
||||||
if(spells_imported % 1000 == 0) {
|
if(spells_imported % 1000 == 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user