Skip to content

Commit

Permalink
#9 add benchmark for one-to-many updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoss committed Apr 2, 2021
1 parent 8e7d5e7 commit 4896ba2
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void createRepositories() {
departmentRepository = new DepartmentRepository(dataSource);
employeeRepository = new EmployeeRepository(dataSource);
projectRepository = new ProjectRepository(dataSource);
companyRepository.insertCompany("metio.wtf", "www");
companyRepository.insertCompany("metio.wtf", "jul");
companyRepository.insertCompany("other", "tests");
departmentRepository.insertDepartment(1L, "benchmarks");
projectRepository.insertProject("JUL", NOW);
employeeRepository.insertEmployee(1L, "bob", "example", "bob@example.com", 100L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void writeSingleEntity() {

@Override
public void updateOneToManyRelation() {
// TODO: implement benchmark
departmentRepository.updateDepartmentsOfCompany(2L, 1L, "benchmarks");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void createRepositories() {
departmentRepository = new DepartmentRepository(dataSource);
employeeRepository = new EmployeeRepository(dataSource);
projectRepository = new ProjectRepository(dataSource);
companyRepository.insertCompany("metio.wtf", "www");
companyRepository.insertCompany("metio.wtf", "log4j");
companyRepository.insertCompany("other", "tests");
departmentRepository.insertDepartment(1L, "benchmarks");
projectRepository.insertProject("log4j", NOW);
employeeRepository.insertEmployee(1L, "bob", "example", "bob@example.com", 100L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void writeSingleEntity() {

@Override
public void updateOneToManyRelation() {
// TODO: implement benchmark
departmentRepository.updateDepartmentsOfCompany(2L, 1L, "benchmarks");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void createRepositories() {
departmentRepository = new DepartmentRepository(dataSource);
employeeRepository = new EmployeeRepository(dataSource);
projectRepository = new ProjectRepository(dataSource);
companyRepository.insertCompany("metio.wtf", "www");
companyRepository.insertCompany("metio.wtf", "NoOp");
companyRepository.insertCompany("other", "tests");
departmentRepository.insertDepartment(1L, "benchmarks");
projectRepository.insertProject("NoOp", NOW);
employeeRepository.insertEmployee(1L, "bob", "example", "bob@example.com", 100L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void writeSingleEntity() {

@Override
public void updateOneToManyRelation() {
// TODO: implement benchmark
departmentRepository.updateDepartmentsOfCompany(2L, 1L, "benchmarks");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void createRepositories() {
departmentRepository = new DepartmentRepository(dataSource);
employeeRepository = new EmployeeRepository(dataSource);
projectRepository = new ProjectRepository(dataSource);
companyRepository.insertCompany("metio.wtf", "www");
companyRepository.insertCompany("metio.wtf", "slf4j");
companyRepository.insertCompany("other", "tests");
departmentRepository.insertDepartment(1L, "benchmarks");
projectRepository.insertProject("slf4j", NOW);
employeeRepository.insertEmployee(1L, "bob", "example", "bob@example.com", 100L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void writeSingleEntity() {

@Override
public void updateOneToManyRelation() {
// TODO: implement benchmark
departmentRepository.updateDepartmentsOfCompany(2L, 1L, "benchmarks");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void createRepositories() {
departmentRepository = new DepartmentRepository(dataSource);
employeeRepository = new EmployeeRepository(dataSource);
projectRepository = new ProjectRepository(dataSource);
companyRepository.insertCompany("metio.wtf", "www");
companyRepository.insertCompany("metio.wtf", "tinylog");
companyRepository.insertCompany("other", "tests");
departmentRepository.insertDepartment(1L, "benchmarks");
projectRepository.insertProject("tinylog", NOW);
employeeRepository.insertEmployee(1L, "bob", "example", "bob@example.com", 100L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void writeSingleEntity() {

@Override
public void updateOneToManyRelation() {
// TODO: implement benchmark
departmentRepository.updateDepartmentsOfCompany(2L, 1L, "benchmarks");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-- parameters:
-- - name: company
-- type: java.lang.Long
-- - name: address
-- - name: name
-- type: java.lang.String
INSERT INTO departments (company_pid, name)
VALUES (:company, :address)
VALUES (:company, :name)
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* This file is part of yosql. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of yosql,
* including this file, may be copied, modified, propagated, or distributed except according to the terms contained
* in the LICENSE file.
*/

-- parameters:
-- - name: company
-- type: java.lang.Long
-- - name: oldCompany
-- type: java.lang.Long
-- - name: name
-- type: java.lang.String
UPDATE departments
SET company_pid = :company,
name = :name
WHERE company_pid = :oldCompany
;

0 comments on commit 4896ba2

Please sign in to comment.