| 2273 | } |
| 2274 | |
| 2275 | uint64_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 | } |
no test coverage detected