Beispiel #1
0
void ConfigHandler::InitSettings() {
    user = QString(getenv("USER"));
    if (!QFile::exists(fileName())) {
        AddDatabase("Rostock", "192.168.118.35", 5432, "daisi", "daisi","18ifaoe184");
        AddDatabase("Hamburg", "192.168.200.35", 5432, "daisi", "daisi","18ifaoe184");
    }
}
void CreateYCSBDatabase() {
  const oid_t col_count = state.column_count + 1;
  const bool is_inlined = false;

  /////////////////////////////////////////////////////////
  // Create tables
  /////////////////////////////////////////////////////////
  // Clean up
  delete ycsb_database;
  ycsb_database = nullptr;
  user_table = nullptr;

  auto catalog = catalog::Catalog::GetInstance();
  ycsb_database = new storage::Database(ycsb_database_oid);
  catalog->AddDatabase(ycsb_database);

  bool own_schema = true;
  bool adapt_table = false;
  // Create schema first
  std::vector<catalog::Column> columns;

  auto column =
      catalog::Column(type::Type::INTEGER, type::Type::GetTypeSize(type::Type::INTEGER),
                      "YCSB_KEY", is_inlined);
  columns.push_back(column);

  if (state.string_mode == true) {
    for (oid_t col_itr = 1; col_itr < col_count; col_itr++) {
        auto column =
            catalog::Column(type::Type::VARCHAR, 100,
                            "FIELD" + std::to_string(col_itr), is_inlined);
        columns.push_back(column);
    }
  } else {
    for (oid_t col_itr = 1; col_itr < col_count; col_itr++) {
        auto column =
            catalog::Column(type::Type::INTEGER, type::Type::GetTypeSize(type::Type::INTEGER),
                            "FIELD" + std::to_string(col_itr), is_inlined);
        columns.push_back(column);
    }
  }

  catalog::Schema *table_schema = new catalog::Schema(columns);
  std::string table_name("USERTABLE");

  user_table = storage::TableFactory::GetDataTable(
      ycsb_database_oid, user_table_oid, table_schema, table_name,
      DEFAULT_TUPLES_PER_TILEGROUP, own_schema, adapt_table);

  ycsb_database->AddTable(user_table);

  // Primary index on user key
  std::vector<oid_t> key_attrs;

  auto tuple_schema = user_table->GetSchema();
  catalog::Schema *key_schema;
  index::IndexMetadata *index_metadata;
  bool unique;

  key_attrs = {0};
  key_schema = catalog::Schema::CopySchema(tuple_schema, key_attrs);
  key_schema->SetIndexedColumns(key_attrs);

  unique = true;

  index_metadata = new index::IndexMetadata(
    "primary_index", user_table_pkey_index_oid, user_table_oid,
    ycsb_database_oid, state.index, INDEX_CONSTRAINT_TYPE_PRIMARY_KEY,
    tuple_schema, key_schema, key_attrs, unique);

  std::shared_ptr<index::Index> pkey_index(
      index::IndexFactory::GetIndex(index_metadata));
  user_table->AddIndex(pkey_index);
}
Beispiel #3
0
void UserSettings::InitSettings() {
//	if (!QFile::exists(fileName())) {
		AddDatabase("Rostock", "192.168.118.35", 5432, "daisi", "daisi","18ifaoe184");
		AddDatabase("Hamburg", "192.168.200.35", 5432, "daisi", "daisi","18ifaoe184");
//	}
}