message: Terminate if existing DB doesn't have meta table
diff: @@ -64,12 +64,26 @@ void Database::checkMetaTable() {
  sqlite3_stmt* stmt;
  sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
  if (sqlite3_step(stmt) != SQLITE_ROW) {
  + sqlite3_finalize(stmt);
  std::cout << "[FATAL] Failed to check meta table" << std::endl;
  terminate(0);
  }
  int count = sqlite3_column_int(stmt, 0);
  if (count == 0) {
  +
  + // check if there's other non-internal tables first
  + sql = R"(
  + SELECT COUNT (*) FROM sqlite_master WHERE type="table" AND name NOT LIKE "sqlite_%";
  + )";
  + sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
  + if (sqlite3_step(stmt) != SQLITE_ROW || sqlite3_column_int(stmt, 0) != 0) {
  + sqlite3_finalize(stmt);
  + std::cout << "[FATAL] Existing DB is outdated" << std::endl;
  + terminate(0);
  + }
  +
  + // create meta table
  sqlite3_finalize(stmt);
  return createMetaTable();
  }
  @@ -608,7 +622,7 @@ bool Database::finishCharacter(sP_CL2LS_REQ_CHAR_CREATE* character, int accountI
  "SkinColor" = ?
  WHERE "PlayerID" = ? ;
  )";
  - sqlite3_prepare_v2(db, sql, -1, &stmt, 0);
  + sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
  sqlite3_bind_int(stmt, 1, character->PCStyle.iBody);
  sqlite3_bind_int(stmt, 2, character->PCStyle.iEyeColor);
  