Exemplo n.º 1
0
void createDatabases(sqlite3_connection& con) {

  try {
	  con.executenonquery("create table IF NOT EXISTS timing(property_name TEXT, total_wallclock FLOAT, total_usertime FLOAT, total_systime FLOAT, wallclock FLOAT, usertime FLOAT, systime FLOAT )");
  }
  catch(std::exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
    // Function IDs are only unique within a file
	  con.executenonquery("create table IF NOT EXISTS function_statistics(row_number INTEGER PRIMARY KEY, function_id INTEGER, num_instructions INTEGER )");
  }
  catch(std::exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS function_ids(row_number INTEGER PRIMARY KEY, file TEXT, function_name TEXT)");
  }
  catch(std::exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  
  try {
	  con.executenonquery("create table IF NOT EXISTS vectors(row_number INTEGER PRIMARY KEY, function_id INTEGER,  index_within_function INTEGER, line INTEGER, offset INTEGER, sum_of_counts INTEGER, counts BLOB, instr_seq BLOB)");

  }
  catch(std::exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS clusters(row_number INTEGER PRIMARY KEY, cluster INTEGER, function_id INTEGER, index_within_function INTEGER, vectors_row INTEGER, dist INTEGER)");


  }
  catch(std::exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

}
Exemplo n.º 2
0
void createDatabases(sqlite3_connection& con) {
  try {
	  con.executenonquery("create table IF NOT EXISTS run_parameters(window_size INTEGER, stride INTEGER)");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS detection_parameters(similarity_threshold FLOAT, false_negative_rate FLOAT)");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }


  
  try {
	  con.executenonquery("create table IF NOT EXISTS vector_generator_timing(file TEXT, total_wallclock FLOAT, total_usertime FLOAT, total_systime FLOAT, vecgen_wallclock FLOAT, vecgen_usertime FLOAT, vecgen_systime FLOAT )");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS timing(property_name TEXT, total_wallclock FLOAT, total_usertime FLOAT, total_systime FLOAT, wallclock FLOAT, usertime FLOAT, systime FLOAT )");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
    // Function IDs are only unique within a file
	  con.executenonquery("create table IF NOT EXISTS function_statistics(row_number INTEGER PRIMARY KEY, function_id INTEGER, num_instructions INTEGER )");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS results(row_number INTEGER PRIMARY KEY, edit_distance INTEGER, false_positive_rate FLOAT )");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS function_ids(row_number INTEGER PRIMARY KEY, file TEXT, function_name TEXT)");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  
  try {
    // index_within_function values are only unique within a file and function
//	  con.executenonquery("create table IF NOT EXISTS vectors(row_number INTEGER PRIMARY KEY, line INTEGER, offset INTEGER, sum_of_counts INTEGER, counts BLOB, instr_seq TEXT, function_id INTEGER, index_within_function INTEGER )");
	  con.executenonquery("create table IF NOT EXISTS vectors(row_number INTEGER PRIMARY KEY, function_id INTEGER,  index_within_function INTEGER, line INTEGER, offset INTEGER, sum_of_counts INTEGER, counts BLOB, instr_seq BLOB)");

  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
    // index_within_function values are only unique within a file and function
	  con.executenonquery("create index IF NOT EXISTS vectors_sum_of_counts_index on vectors(sum_of_counts)");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS clusters(row_number INTEGER PRIMARY KEY, cluster INTEGER, function_id INTEGER, index_within_function INTEGER, vectors_row INTEGER, dist INTEGER)");


  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {
	  con.executenonquery("create table IF NOT EXISTS postprocessed_clusters(row_number INTEGER PRIMARY KEY, cluster INTEGER, function_id INTEGER, index_within_function INTEGER, vectors_row INTEGER, dist INTEGER )");
  }
  catch(exception &ex) {
	cerr << "Exception Occurred: " << ex.what() << endl;
  }

  try {con.executenonquery("create table if not exists function_coverage(function_id integer, num_instructions_covered_not_postprocessed integer, fraction_instructions_covered_not_postprocessed float, num_instructions_covered_postprocessed integer, fraction_instructions_covered_postprocessed float)");}
  catch(exception &ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

  try {con.executenonquery("create table if not exists total_coverage(num_instructions_covered_not_postprocessed integer, fraction_instructions_covered_not_postprocessed float, num_instructions_covered_postprocessed integer, fraction_instructions_covered_postprocessed float)");}
  catch(exception &ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

  try {con.executenonquery("create index if not exists clusters_by_function on clusters(function_id)");}
  catch(exception &ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

  try {con.executenonquery("create index if not exists postprocessed_clusters_by_function on postprocessed_clusters(function_id)");}
  catch(exception &ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

  try {con.executenonquery("create index if not exists function_statistics_by_function on function_statistics(function_id)");}
  catch(exception &ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

  try {
	sqlite3_command(con, "create index if not exists clusters_index_by_cluster on clusters(cluster)").executenonquery();
  } catch (exception& ex) {cerr << "Exception Occurred: " << ex.what() << endl;}
  try {
	sqlite3_command(con, "create index if not exists postprocessed_clusters_index_by_cluster on postprocessed_clusters(cluster)").executenonquery();
  } catch (exception& ex) {cerr << "Exception Occurred: " << ex.what() << endl;}

}