MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / GetNextTableId

Method GetNextTableId

common/database.cpp:2275–2290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2273}
2274
2275uint64_t Database::GetNextTableId(const std::string &table_name)
2276{
2277 auto results = QueryDatabase(fmt::format("SHOW TABLE STATUS LIKE '{}'", table_name));
2278
2279 for (auto row: results) {
2280 for (int row_index = 0; row_index < results.ColumnCount(); row_index++) {
2281 std::string field_name = Strings::ToLower(results.FieldName(row_index));
2282 if (field_name == "auto_increment") {
2283 std::string value = row[row_index] ? row[row_index] : "null";
2284 return Strings::ToUnsignedBigInt(value, 1);
2285 }
2286 }
2287 }
2288
2289 return 1;
2290}

Callers 1

LoadEtlIdsMethod · 0.80

Calls 2

FieldNameMethod · 0.80
ColumnCountMethod · 0.45

Tested by

no test coverage detected