diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/src/nl/astraeus/database/Queries.kt b/src/nl/astraeus/database/Queries.kt deleted file mode 100644 index 68f4a7f..0000000 --- a/src/nl/astraeus/database/Queries.kt +++ /dev/null @@ -1,27 +0,0 @@ -package nl.astraeus.database - -import java.sql.ResultSet - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:46 - */ - -fun execute(dbName: String = "default", query: String, vararg args: Any) { - val db = SimpleDatabase.get(dbName) - - db.execute(query, *args) -} - -fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { - val db = SimpleDatabase.get(dbName) - - return db.executeQuery(query, *args) -} - -fun update(dbName: String = "default", query: String, vararg args: Any): Int { - val db = SimpleDatabase.get(dbName) - - return db.executeUpdate(query, *args) -} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/src/nl/astraeus/database/Queries.kt b/src/nl/astraeus/database/Queries.kt deleted file mode 100644 index 68f4a7f..0000000 --- a/src/nl/astraeus/database/Queries.kt +++ /dev/null @@ -1,27 +0,0 @@ -package nl.astraeus.database - -import java.sql.ResultSet - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:46 - */ - -fun execute(dbName: String = "default", query: String, vararg args: Any) { - val db = SimpleDatabase.get(dbName) - - db.execute(query, *args) -} - -fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { - val db = SimpleDatabase.get(dbName) - - return db.executeQuery(query, *args) -} - -fun update(dbName: String = "default", query: String, vararg args: Any): Int { - val db = SimpleDatabase.get(dbName) - - return db.executeUpdate(query, *args) -} diff --git a/src/test/kotlin/nl/astraeus/database/TestQueries.kt b/src/test/kotlin/nl/astraeus/database/TestQueries.kt new file mode 100644 index 0000000..18abb38 --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/TestQueries.kt @@ -0,0 +1,199 @@ +package nl.astraeus.database + +import nl.astraeus.database.annotations.Column +import nl.astraeus.database.annotations.Id +import nl.astraeus.database.annotations.Table +import nl.astraeus.database.jdbc.ConnectionPool +import nl.astraeus.database.jdbc.ConnectionProvider +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import java.sql.Connection +import java.sql.DriverManager + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 17:00 + */ + +@Table +data class Company(var name: String) { + @Id var id: Long = 0 + + protected constructor(): this("") + + fun users(): List { + return transaction> { + var dao = UserDao() + + dao.where("company = ?", id) + } + } +} + +@Table(name = "usr") +class User( + var company: Company, + var name: String, + var email: String) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), "", "") +} + +// needs manual index to prevent double entries +@Table +class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), User(Company(""), "", "")) +} + +class CompanyDao(): SimpleDao(Company::class.java) + +class UserDao(): SimpleDao(User::class.java) + +class MTMDao(): SimpleDao(ManyToMany::class.java) { + + fun users(comp: Company): List { + return transaction> { + val dao = UserDao() + + dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) + } + } + + fun companies(user: User): List { + return transaction> { + val dao = CompanyDao() + + dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) + } + } +} + +fun createConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") + connection.autoCommit = false + + // result + return connection +} + +class MyConnectionProvider : ConnectionProvider() { + + override fun getConnection() = createConnection() + + override fun getDefinition(): DdlMapping.DatabaseDefinition { + return DdlMapping.DatabaseDefinition.H2 + } +} + +class TestQueries { + @Before fun setUp() { + val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) + + db.setExecuteDDLUpdates(true); + } + + @Test fun testWhere() { + val companyDao = CompanyDao() + val userDao = UserDao() + val mtmDao = MTMDao() + + transaction { + val company = Company("company") + + val info = User(company, "Info", "info@somewhere.com") + val piet = User(company, "Piet", "piet@somewhere.com") + + userDao.insert(info) + userDao.upsert(piet) + + info.name = "Iiiinfo" + userDao.update(info) + + piet.email = "pietje@somewhere.com" + userDao.upsert(piet) + + mtmDao.insert(ManyToMany(company, info)) + mtmDao.insert(ManyToMany(company, piet)) + mtmDao.insert(ManyToMany(Company("Other company"), info)) + } + + transaction { + val user = userDao.find("name = ?", "Iiiinfo") + + if (user != null) { + user.company.name = "Better Company!" + + companyDao.update(user.company) + + val companies = mtmDao.companies(user) + + for (company in companies) { + println("Company from ${user.name} -> ${company.name}") + } + } + } + + transaction { + val found = userDao.where("name = ?", "Iiiinfo") + + assertTrue(found.size == 1) + + assertTrue(userDao.all().size == 2) + + assertTrue(userDao.count("name = ?", "Piet") == 1) + + for(company in companyDao.all()) { + println("Company: #${company.id} - ${company.name}") + + for(user in company.users()) { + println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + } + + for(user in userDao.all()) { + println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + + var rs = query(query = "SELECT * FROM company") + + while(rs.next()) { + print("Company: ") + print(rs.getLong(1)) + print(" - ") + println(rs.getString(2)) + } + + rs = query(query = "SELECT * FROM usr") + + while(rs.next()) { + print("User: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + print(rs.getString(3)) + print(" - ") + println(rs.getString(4)) + } + + rs = query(query = "SELECT * FROM manytomany") + + while(rs.next()) { + print("MTM: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + println(rs.getLong(3)) + } + } + } + +} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/src/nl/astraeus/database/Queries.kt b/src/nl/astraeus/database/Queries.kt deleted file mode 100644 index 68f4a7f..0000000 --- a/src/nl/astraeus/database/Queries.kt +++ /dev/null @@ -1,27 +0,0 @@ -package nl.astraeus.database - -import java.sql.ResultSet - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:46 - */ - -fun execute(dbName: String = "default", query: String, vararg args: Any) { - val db = SimpleDatabase.get(dbName) - - db.execute(query, *args) -} - -fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { - val db = SimpleDatabase.get(dbName) - - return db.executeQuery(query, *args) -} - -fun update(dbName: String = "default", query: String, vararg args: Any): Int { - val db = SimpleDatabase.get(dbName) - - return db.executeUpdate(query, *args) -} diff --git a/src/test/kotlin/nl/astraeus/database/TestQueries.kt b/src/test/kotlin/nl/astraeus/database/TestQueries.kt new file mode 100644 index 0000000..18abb38 --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/TestQueries.kt @@ -0,0 +1,199 @@ +package nl.astraeus.database + +import nl.astraeus.database.annotations.Column +import nl.astraeus.database.annotations.Id +import nl.astraeus.database.annotations.Table +import nl.astraeus.database.jdbc.ConnectionPool +import nl.astraeus.database.jdbc.ConnectionProvider +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import java.sql.Connection +import java.sql.DriverManager + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 17:00 + */ + +@Table +data class Company(var name: String) { + @Id var id: Long = 0 + + protected constructor(): this("") + + fun users(): List { + return transaction> { + var dao = UserDao() + + dao.where("company = ?", id) + } + } +} + +@Table(name = "usr") +class User( + var company: Company, + var name: String, + var email: String) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), "", "") +} + +// needs manual index to prevent double entries +@Table +class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), User(Company(""), "", "")) +} + +class CompanyDao(): SimpleDao(Company::class.java) + +class UserDao(): SimpleDao(User::class.java) + +class MTMDao(): SimpleDao(ManyToMany::class.java) { + + fun users(comp: Company): List { + return transaction> { + val dao = UserDao() + + dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) + } + } + + fun companies(user: User): List { + return transaction> { + val dao = CompanyDao() + + dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) + } + } +} + +fun createConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") + connection.autoCommit = false + + // result + return connection +} + +class MyConnectionProvider : ConnectionProvider() { + + override fun getConnection() = createConnection() + + override fun getDefinition(): DdlMapping.DatabaseDefinition { + return DdlMapping.DatabaseDefinition.H2 + } +} + +class TestQueries { + @Before fun setUp() { + val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) + + db.setExecuteDDLUpdates(true); + } + + @Test fun testWhere() { + val companyDao = CompanyDao() + val userDao = UserDao() + val mtmDao = MTMDao() + + transaction { + val company = Company("company") + + val info = User(company, "Info", "info@somewhere.com") + val piet = User(company, "Piet", "piet@somewhere.com") + + userDao.insert(info) + userDao.upsert(piet) + + info.name = "Iiiinfo" + userDao.update(info) + + piet.email = "pietje@somewhere.com" + userDao.upsert(piet) + + mtmDao.insert(ManyToMany(company, info)) + mtmDao.insert(ManyToMany(company, piet)) + mtmDao.insert(ManyToMany(Company("Other company"), info)) + } + + transaction { + val user = userDao.find("name = ?", "Iiiinfo") + + if (user != null) { + user.company.name = "Better Company!" + + companyDao.update(user.company) + + val companies = mtmDao.companies(user) + + for (company in companies) { + println("Company from ${user.name} -> ${company.name}") + } + } + } + + transaction { + val found = userDao.where("name = ?", "Iiiinfo") + + assertTrue(found.size == 1) + + assertTrue(userDao.all().size == 2) + + assertTrue(userDao.count("name = ?", "Piet") == 1) + + for(company in companyDao.all()) { + println("Company: #${company.id} - ${company.name}") + + for(user in company.users()) { + println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + } + + for(user in userDao.all()) { + println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + + var rs = query(query = "SELECT * FROM company") + + while(rs.next()) { + print("Company: ") + print(rs.getLong(1)) + print(" - ") + println(rs.getString(2)) + } + + rs = query(query = "SELECT * FROM usr") + + while(rs.next()) { + print("User: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + print(rs.getString(3)) + print(" - ") + println(rs.getString(4)) + } + + rs = query(query = "SELECT * FROM manytomany") + + while(rs.next()) { + print("MTM: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + println(rs.getLong(3)) + } + } + } + +} diff --git a/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt new file mode 100644 index 0000000..35fcfba --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt @@ -0,0 +1,92 @@ +package nl.astraeus.database.example + +import nl.astraeus.database.SimpleDao +import nl.astraeus.database.SimpleDatabase +import nl.astraeus.database.annotations.* +import nl.astraeus.database.jdbc.ConnectionProvider +import nl.astraeus.database.transaction +import java.sql.Connection +import java.sql.DriverManager +import java.sql.SQLException + +/** + * User: rnentjes + * Date: 11-12-16 + * Time: 16:43 + */ +@Table(name="persons") +@Cache(maxSize = 6) +class Person( + @Id val id: Long = 0, + + @Length(value = 200) + @Default("'new name'") + var name: String, + + @Default("21") + var age: Int, + + @Length(precision = 10, scale = 2) + var balance: Double, + + var address: String +) { + // no-arg constructor required + constructor(): this(0, "", 0, 0.0, "") + + constructor(name: String, age: Int, address: String): this(0, name, age, 0.0, address) +} + +fun main(args: Array) { + // define the default database, all it needs it a way to get a connection + val db = SimpleDatabase.define(object : ConnectionProvider() { + @Throws(SQLException::class, ClassNotFoundException::class) + override fun getConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:Example;DB_CLOSE_DELAY=-1", "sa", "") + connection.autoCommit = false + + return connection + } + }) + + // automatically create database tables and columns if needed + db.setExecuteDDLUpdates(true) + + // use default dao (extends it if you need more) + val personDao = SimpleDao(Person::class.java) + + // execute multiple dao actions in transaction + personDao.execute({ dao -> + dao.insert(Person("John", 40, "Road")) + dao.insert(Person("Jan", 32, "Straat")) + dao.insert(Person("Ronald", 31, "Wherever")) + dao.insert(Person("Piet", 26, "Weg")) + dao.insert(Person("Klaas", 10, "Pad")) + }) + + // find persons, read actions don't need a transaction + var persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } + + // start transaction because of the update + db.begin() + + transaction { + val person = personDao.find("name = ? and age = ?", "John", 40) + + person.name = "Johnny" + + personDao.update(person) + } + + persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } +} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/src/nl/astraeus/database/Queries.kt b/src/nl/astraeus/database/Queries.kt deleted file mode 100644 index 68f4a7f..0000000 --- a/src/nl/astraeus/database/Queries.kt +++ /dev/null @@ -1,27 +0,0 @@ -package nl.astraeus.database - -import java.sql.ResultSet - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:46 - */ - -fun execute(dbName: String = "default", query: String, vararg args: Any) { - val db = SimpleDatabase.get(dbName) - - db.execute(query, *args) -} - -fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { - val db = SimpleDatabase.get(dbName) - - return db.executeQuery(query, *args) -} - -fun update(dbName: String = "default", query: String, vararg args: Any): Int { - val db = SimpleDatabase.get(dbName) - - return db.executeUpdate(query, *args) -} diff --git a/src/test/kotlin/nl/astraeus/database/TestQueries.kt b/src/test/kotlin/nl/astraeus/database/TestQueries.kt new file mode 100644 index 0000000..18abb38 --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/TestQueries.kt @@ -0,0 +1,199 @@ +package nl.astraeus.database + +import nl.astraeus.database.annotations.Column +import nl.astraeus.database.annotations.Id +import nl.astraeus.database.annotations.Table +import nl.astraeus.database.jdbc.ConnectionPool +import nl.astraeus.database.jdbc.ConnectionProvider +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import java.sql.Connection +import java.sql.DriverManager + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 17:00 + */ + +@Table +data class Company(var name: String) { + @Id var id: Long = 0 + + protected constructor(): this("") + + fun users(): List { + return transaction> { + var dao = UserDao() + + dao.where("company = ?", id) + } + } +} + +@Table(name = "usr") +class User( + var company: Company, + var name: String, + var email: String) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), "", "") +} + +// needs manual index to prevent double entries +@Table +class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), User(Company(""), "", "")) +} + +class CompanyDao(): SimpleDao(Company::class.java) + +class UserDao(): SimpleDao(User::class.java) + +class MTMDao(): SimpleDao(ManyToMany::class.java) { + + fun users(comp: Company): List { + return transaction> { + val dao = UserDao() + + dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) + } + } + + fun companies(user: User): List { + return transaction> { + val dao = CompanyDao() + + dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) + } + } +} + +fun createConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") + connection.autoCommit = false + + // result + return connection +} + +class MyConnectionProvider : ConnectionProvider() { + + override fun getConnection() = createConnection() + + override fun getDefinition(): DdlMapping.DatabaseDefinition { + return DdlMapping.DatabaseDefinition.H2 + } +} + +class TestQueries { + @Before fun setUp() { + val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) + + db.setExecuteDDLUpdates(true); + } + + @Test fun testWhere() { + val companyDao = CompanyDao() + val userDao = UserDao() + val mtmDao = MTMDao() + + transaction { + val company = Company("company") + + val info = User(company, "Info", "info@somewhere.com") + val piet = User(company, "Piet", "piet@somewhere.com") + + userDao.insert(info) + userDao.upsert(piet) + + info.name = "Iiiinfo" + userDao.update(info) + + piet.email = "pietje@somewhere.com" + userDao.upsert(piet) + + mtmDao.insert(ManyToMany(company, info)) + mtmDao.insert(ManyToMany(company, piet)) + mtmDao.insert(ManyToMany(Company("Other company"), info)) + } + + transaction { + val user = userDao.find("name = ?", "Iiiinfo") + + if (user != null) { + user.company.name = "Better Company!" + + companyDao.update(user.company) + + val companies = mtmDao.companies(user) + + for (company in companies) { + println("Company from ${user.name} -> ${company.name}") + } + } + } + + transaction { + val found = userDao.where("name = ?", "Iiiinfo") + + assertTrue(found.size == 1) + + assertTrue(userDao.all().size == 2) + + assertTrue(userDao.count("name = ?", "Piet") == 1) + + for(company in companyDao.all()) { + println("Company: #${company.id} - ${company.name}") + + for(user in company.users()) { + println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + } + + for(user in userDao.all()) { + println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + + var rs = query(query = "SELECT * FROM company") + + while(rs.next()) { + print("Company: ") + print(rs.getLong(1)) + print(" - ") + println(rs.getString(2)) + } + + rs = query(query = "SELECT * FROM usr") + + while(rs.next()) { + print("User: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + print(rs.getString(3)) + print(" - ") + println(rs.getString(4)) + } + + rs = query(query = "SELECT * FROM manytomany") + + while(rs.next()) { + print("MTM: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + println(rs.getLong(3)) + } + } + } + +} diff --git a/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt new file mode 100644 index 0000000..35fcfba --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt @@ -0,0 +1,92 @@ +package nl.astraeus.database.example + +import nl.astraeus.database.SimpleDao +import nl.astraeus.database.SimpleDatabase +import nl.astraeus.database.annotations.* +import nl.astraeus.database.jdbc.ConnectionProvider +import nl.astraeus.database.transaction +import java.sql.Connection +import java.sql.DriverManager +import java.sql.SQLException + +/** + * User: rnentjes + * Date: 11-12-16 + * Time: 16:43 + */ +@Table(name="persons") +@Cache(maxSize = 6) +class Person( + @Id val id: Long = 0, + + @Length(value = 200) + @Default("'new name'") + var name: String, + + @Default("21") + var age: Int, + + @Length(precision = 10, scale = 2) + var balance: Double, + + var address: String +) { + // no-arg constructor required + constructor(): this(0, "", 0, 0.0, "") + + constructor(name: String, age: Int, address: String): this(0, name, age, 0.0, address) +} + +fun main(args: Array) { + // define the default database, all it needs it a way to get a connection + val db = SimpleDatabase.define(object : ConnectionProvider() { + @Throws(SQLException::class, ClassNotFoundException::class) + override fun getConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:Example;DB_CLOSE_DELAY=-1", "sa", "") + connection.autoCommit = false + + return connection + } + }) + + // automatically create database tables and columns if needed + db.setExecuteDDLUpdates(true) + + // use default dao (extends it if you need more) + val personDao = SimpleDao(Person::class.java) + + // execute multiple dao actions in transaction + personDao.execute({ dao -> + dao.insert(Person("John", 40, "Road")) + dao.insert(Person("Jan", 32, "Straat")) + dao.insert(Person("Ronald", 31, "Wherever")) + dao.insert(Person("Piet", 26, "Weg")) + dao.insert(Person("Klaas", 10, "Pad")) + }) + + // find persons, read actions don't need a transaction + var persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } + + // start transaction because of the update + db.begin() + + transaction { + val person = personDao.find("name = ? and age = ?", "John", 40) + + person.name = "Johnny" + + personDao.update(person) + } + + persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } +} diff --git a/test/nl/astraeus/database/TestQueries.kt b/test/nl/astraeus/database/TestQueries.kt deleted file mode 100644 index 17391f4..0000000 --- a/test/nl/astraeus/database/TestQueries.kt +++ /dev/null @@ -1,199 +0,0 @@ -package nl.astraeus.database - -import nl.astraeus.database.annotations.Column -import nl.astraeus.database.annotations.Id -import nl.astraeus.database.annotations.Table -import nl.astraeus.database.jdbc.ConnectionPool -import nl.astraeus.database.jdbc.ConnectionProvider -import org.junit.Assert.* -import org.junit.Before -import org.junit.Test -import java.sql.Connection -import java.sql.DriverManager - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 17:00 - */ - -@Table -data class Company(var name: String) { - @Id var id: Long = 0 - - protected constructor(): this("") - - fun users(): List { - return transaction> { - var dao = UserDao() - - dao.where("company = ?", id) - } - } -} - -@Table(name = "usr") -class User( - var company: Company, - var name: String, - var email: String) { - @Id var id: Long = 0 - - protected constructor(): this(Company(""), "", "") -} - -// needs manual index to prevent double entries -@Table -class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { - @Id var id: Long = 0 - - protected constructor(): this(Company(""), User(Company(""), "", "")) -} - -class CompanyDao(): SimpleDao(Company::class.java) - -class UserDao(): SimpleDao(User::class.java) - -class MTMDao(): SimpleDao(ManyToMany::class.java) { - - fun users(comp: Company): List { - return transaction> { - val dao = UserDao() - - dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) - } - } - - fun companies(user: User): List { - return transaction> { - val dao = CompanyDao() - - dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) - } - } -} - -fun createConnection(): Connection { - Class.forName("org.h2.Driver") - - val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") - connection.autoCommit = false - - // result - return connection -} - -class MyConnectionProvider : ConnectionProvider() { - - override fun getConnection() = createConnection() - - override fun getDefinition(): DdlMapping.DatabaseDefinition { - return DdlMapping.DatabaseDefinition.H2 - } -} - -class TestQueries { - @Before fun setUp() { - val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) - - db.setExecuteDDLUpdates(true); - } - - @Test fun testWhere() { - val companyDao = CompanyDao() - val userDao = UserDao() - val mtmDao = MTMDao() - - transaction { - val company = Company("company") - - val info = User(company, "Info", "info@somewhere.com") - val piet = User(company, "Piet", "piet@somewhere.com") - - userDao.insert(info) - userDao.upsert(piet) - - info.name = "Iiiinfo" - userDao.update(info) - - piet.email = "pietje@somewhere.com" - userDao.upsert(piet) - - mtmDao.insert(ManyToMany(company, info)) - mtmDao.insert(ManyToMany(company, piet)) - mtmDao.insert(ManyToMany(Company("Other company"), info)) - } - - transaction { - val user = userDao.find("name = ?", "Iiiinfo") - - if (user != null) { - user.company.name = "Better Company!" - - companyDao.update(user.company) - - val companies = mtmDao.companies(user) - - for (company in companies) { - println("Company from ${user.name} -> ${company.name}") - } - } - } - - transaction { - val found = userDao.where("name = ?", "Iiiinfo") - - assertTrue(found.size == 1) - - assertTrue(userDao.all().size == 2) - - assertTrue(userDao.count("name = ?", "Piet") == 1) - - for(company in companyDao.all()) { - println("Company: #${company.id} - ${company.name}") - - for(user in company.users()) { - println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") - } - } - - for(user in userDao.all()) { - println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") - } - - var rs = query(query = "SELECT * FROM company") - - while(rs.next()) { - print("Company: ") - print(rs.getLong(1)) - print(" - ") - println(rs.getString(2)) - } - - rs = query(query = "SELECT * FROM usr") - - while(rs.next()) { - print("User: ") - print(rs.getLong(1)) - print(" - ") - print(rs.getLong(2)) - print(" - ") - print(rs.getString(3)) - print(" - ") - println(rs.getString(4)) - } - - rs = query(query = "SELECT * FROM manytomany") - - while(rs.next()) { - print("MTM: ") - print(rs.getLong(1)) - print(" - ") - print(rs.getLong(2)) - print(" - ") - println(rs.getLong(3)) - } - } - } - -} diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 0000000..c78bf7a --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/hotswap_agent.xml b/.idea/hotswap_agent.xml new file mode 100644 index 0000000..8a869d9 --- /dev/null +++ b/.idea/hotswap_agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml deleted file mode 100644 index 68cbdf9..0000000 --- a/.idea/libraries/Gradle__com_h2database_h2_1_4_193.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml new file mode 100644 index 0000000..80cfa8b --- /dev/null +++ b/.idea/libraries/Gradle__com_h2database_h2_1_4_196.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_11.xml b/.idea/libraries/Gradle__junit_junit_4_11.xml index 720213c..dc26b34 100644 --- a/.idea/libraries/Gradle__junit_junit_4_11.xml +++ b/.idea/libraries/Gradle__junit_junit_4_11.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml deleted file mode 100644 index ea23f21..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_1.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml new file mode 100644 index 0000000..4380f62 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_simple_database_2_0_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml b/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml deleted file mode 100644 index 9a00155..0000000 --- a/.idea/libraries/Gradle__nl_astraeus_template_very_simple_templates_1_3.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml new file mode 100644 index 0000000..7755a30 --- /dev/null +++ b/.idea/libraries/Gradle__nl_astraeus_very_simple_templates_1_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml index b9f5b31..8262f72 100644 --- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -1,9 +1,11 @@ - + - + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml deleted file mode 100644 index 3590fad..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml deleted file mode 100644 index 7b0f401..0000000 --- a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_6_eap_77.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml new file mode 100644 index 0000000..0f8be77 --- /dev/null +++ b/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_2_30.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin.iml b/.idea/modules/simple-database-kotlin.iml index e3cf18a..2e7168a 100644 --- a/.idea/modules/simple-database-kotlin.iml +++ b/.idea/modules/simple-database-kotlin.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/simple-database-kotlin_main.iml b/.idea/modules/simple-database-kotlin_main.iml index 28ddb68..3ef6611 100644 --- a/.idea/modules/simple-database-kotlin_main.iml +++ b/.idea/modules/simple-database-kotlin_main.iml @@ -1,7 +1,7 @@ - - - + + + @@ -11,10 +11,10 @@ - - - - + + + + \ No newline at end of file diff --git a/.idea/modules/simple-database-kotlin_test.iml b/.idea/modules/simple-database-kotlin_test.iml index 77f427d..8a224c0 100644 --- a/.idea/modules/simple-database-kotlin_test.iml +++ b/.idea/modules/simple-database-kotlin_test.iml @@ -1,7 +1,7 @@ - - - + + + @@ -14,12 +14,12 @@ - - + + - - - + + + diff --git a/build.gradle b/build.gradle index efdc161..2ecefa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '2.0.3-SNAPSHOT' +version '2.0.5-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'idea' @@ -7,20 +7,15 @@ apply plugin: 'findbugs' apply plugin: 'maven-publish' -sourceSets { - main.java.srcDirs += 'src' - test.java.srcDirs += 'test' -} - repositories { - mavenLocal() + mavenCentral() maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" } } buildscript { - ext.kotlin_version = '1.0.+' + ext.kotlin_version = '1.2.30' repositories { maven { url "http://nexus.astraeus.nl/nexus/content/groups/public" @@ -36,7 +31,7 @@ testCompile "com.h2database:h2:1.4.+" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "nl.astraeus:simple-database:2.0.1" + compile "nl.astraeus:simple-database:2.0.4" } uploadArchives { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6b5590..d579dc8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/nl/astraeus/database/Database.kt b/src/main/kotlin/nl/astraeus/database/Database.kt new file mode 100644 index 0000000..f827971 --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Database.kt @@ -0,0 +1,49 @@ +package nl.astraeus.database + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:40 + */ + +fun transaction(name: String = "default", task: () -> Unit) { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + task() + + db.commit() + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} + +fun transaction(name: String = "default", task: () -> T): T { + val db = SimpleDatabase.get(name) + + if (db.transactionActive()) { + return task() + } else { + try { + db.begin() + + val result = task() + + db.commit() + + return result + } finally { + if (db.transactionActive()) { + db.rollback() + } + } + } +} diff --git a/src/main/kotlin/nl/astraeus/database/Queries.kt b/src/main/kotlin/nl/astraeus/database/Queries.kt new file mode 100644 index 0000000..68f4a7f --- /dev/null +++ b/src/main/kotlin/nl/astraeus/database/Queries.kt @@ -0,0 +1,27 @@ +package nl.astraeus.database + +import java.sql.ResultSet + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 16:46 + */ + +fun execute(dbName: String = "default", query: String, vararg args: Any) { + val db = SimpleDatabase.get(dbName) + + db.execute(query, *args) +} + +fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { + val db = SimpleDatabase.get(dbName) + + return db.executeQuery(query, *args) +} + +fun update(dbName: String = "default", query: String, vararg args: Any): Int { + val db = SimpleDatabase.get(dbName) + + return db.executeUpdate(query, *args) +} diff --git a/src/nl/astraeus/database/Database.kt b/src/nl/astraeus/database/Database.kt deleted file mode 100644 index f827971..0000000 --- a/src/nl/astraeus/database/Database.kt +++ /dev/null @@ -1,49 +0,0 @@ -package nl.astraeus.database - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:40 - */ - -fun transaction(name: String = "default", task: () -> Unit) { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - task() - - db.commit() - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} - -fun transaction(name: String = "default", task: () -> T): T { - val db = SimpleDatabase.get(name) - - if (db.transactionActive()) { - return task() - } else { - try { - db.begin() - - val result = task() - - db.commit() - - return result - } finally { - if (db.transactionActive()) { - db.rollback() - } - } - } -} diff --git a/src/nl/astraeus/database/Queries.kt b/src/nl/astraeus/database/Queries.kt deleted file mode 100644 index 68f4a7f..0000000 --- a/src/nl/astraeus/database/Queries.kt +++ /dev/null @@ -1,27 +0,0 @@ -package nl.astraeus.database - -import java.sql.ResultSet - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 16:46 - */ - -fun execute(dbName: String = "default", query: String, vararg args: Any) { - val db = SimpleDatabase.get(dbName) - - db.execute(query, *args) -} - -fun query(dbName: String = "default", query: String, vararg args: Any): ResultSet { - val db = SimpleDatabase.get(dbName) - - return db.executeQuery(query, *args) -} - -fun update(dbName: String = "default", query: String, vararg args: Any): Int { - val db = SimpleDatabase.get(dbName) - - return db.executeUpdate(query, *args) -} diff --git a/src/test/kotlin/nl/astraeus/database/TestQueries.kt b/src/test/kotlin/nl/astraeus/database/TestQueries.kt new file mode 100644 index 0000000..18abb38 --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/TestQueries.kt @@ -0,0 +1,199 @@ +package nl.astraeus.database + +import nl.astraeus.database.annotations.Column +import nl.astraeus.database.annotations.Id +import nl.astraeus.database.annotations.Table +import nl.astraeus.database.jdbc.ConnectionPool +import nl.astraeus.database.jdbc.ConnectionProvider +import org.junit.Assert.assertTrue +import org.junit.Before +import org.junit.Test +import java.sql.Connection +import java.sql.DriverManager + +/** + * User: rnentjes + * Date: 18-10-15 + * Time: 17:00 + */ + +@Table +data class Company(var name: String) { + @Id var id: Long = 0 + + protected constructor(): this("") + + fun users(): List { + return transaction> { + var dao = UserDao() + + dao.where("company = ?", id) + } + } +} + +@Table(name = "usr") +class User( + var company: Company, + var name: String, + var email: String) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), "", "") +} + +// needs manual index to prevent double entries +@Table +class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { + @Id var id: Long = 0 + + protected constructor(): this(Company(""), User(Company(""), "", "")) +} + +class CompanyDao(): SimpleDao(Company::class.java) + +class UserDao(): SimpleDao(User::class.java) + +class MTMDao(): SimpleDao(ManyToMany::class.java) { + + fun users(comp: Company): List { + return transaction> { + val dao = UserDao() + + dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) + } + } + + fun companies(user: User): List { + return transaction> { + val dao = CompanyDao() + + dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) + } + } +} + +fun createConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") + connection.autoCommit = false + + // result + return connection +} + +class MyConnectionProvider : ConnectionProvider() { + + override fun getConnection() = createConnection() + + override fun getDefinition(): DdlMapping.DatabaseDefinition { + return DdlMapping.DatabaseDefinition.H2 + } +} + +class TestQueries { + @Before fun setUp() { + val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) + + db.setExecuteDDLUpdates(true); + } + + @Test fun testWhere() { + val companyDao = CompanyDao() + val userDao = UserDao() + val mtmDao = MTMDao() + + transaction { + val company = Company("company") + + val info = User(company, "Info", "info@somewhere.com") + val piet = User(company, "Piet", "piet@somewhere.com") + + userDao.insert(info) + userDao.upsert(piet) + + info.name = "Iiiinfo" + userDao.update(info) + + piet.email = "pietje@somewhere.com" + userDao.upsert(piet) + + mtmDao.insert(ManyToMany(company, info)) + mtmDao.insert(ManyToMany(company, piet)) + mtmDao.insert(ManyToMany(Company("Other company"), info)) + } + + transaction { + val user = userDao.find("name = ?", "Iiiinfo") + + if (user != null) { + user.company.name = "Better Company!" + + companyDao.update(user.company) + + val companies = mtmDao.companies(user) + + for (company in companies) { + println("Company from ${user.name} -> ${company.name}") + } + } + } + + transaction { + val found = userDao.where("name = ?", "Iiiinfo") + + assertTrue(found.size == 1) + + assertTrue(userDao.all().size == 2) + + assertTrue(userDao.count("name = ?", "Piet") == 1) + + for(company in companyDao.all()) { + println("Company: #${company.id} - ${company.name}") + + for(user in company.users()) { + println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + } + + for(user in userDao.all()) { + println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") + } + + var rs = query(query = "SELECT * FROM company") + + while(rs.next()) { + print("Company: ") + print(rs.getLong(1)) + print(" - ") + println(rs.getString(2)) + } + + rs = query(query = "SELECT * FROM usr") + + while(rs.next()) { + print("User: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + print(rs.getString(3)) + print(" - ") + println(rs.getString(4)) + } + + rs = query(query = "SELECT * FROM manytomany") + + while(rs.next()) { + print("MTM: ") + print(rs.getLong(1)) + print(" - ") + print(rs.getLong(2)) + print(" - ") + println(rs.getLong(3)) + } + } + } + +} diff --git a/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt new file mode 100644 index 0000000..35fcfba --- /dev/null +++ b/src/test/kotlin/nl/astraeus/database/example/MinimalExample.kt @@ -0,0 +1,92 @@ +package nl.astraeus.database.example + +import nl.astraeus.database.SimpleDao +import nl.astraeus.database.SimpleDatabase +import nl.astraeus.database.annotations.* +import nl.astraeus.database.jdbc.ConnectionProvider +import nl.astraeus.database.transaction +import java.sql.Connection +import java.sql.DriverManager +import java.sql.SQLException + +/** + * User: rnentjes + * Date: 11-12-16 + * Time: 16:43 + */ +@Table(name="persons") +@Cache(maxSize = 6) +class Person( + @Id val id: Long = 0, + + @Length(value = 200) + @Default("'new name'") + var name: String, + + @Default("21") + var age: Int, + + @Length(precision = 10, scale = 2) + var balance: Double, + + var address: String +) { + // no-arg constructor required + constructor(): this(0, "", 0, 0.0, "") + + constructor(name: String, age: Int, address: String): this(0, name, age, 0.0, address) +} + +fun main(args: Array) { + // define the default database, all it needs it a way to get a connection + val db = SimpleDatabase.define(object : ConnectionProvider() { + @Throws(SQLException::class, ClassNotFoundException::class) + override fun getConnection(): Connection { + Class.forName("org.h2.Driver") + + val connection = DriverManager.getConnection("jdbc:h2:mem:Example;DB_CLOSE_DELAY=-1", "sa", "") + connection.autoCommit = false + + return connection + } + }) + + // automatically create database tables and columns if needed + db.setExecuteDDLUpdates(true) + + // use default dao (extends it if you need more) + val personDao = SimpleDao(Person::class.java) + + // execute multiple dao actions in transaction + personDao.execute({ dao -> + dao.insert(Person("John", 40, "Road")) + dao.insert(Person("Jan", 32, "Straat")) + dao.insert(Person("Ronald", 31, "Wherever")) + dao.insert(Person("Piet", 26, "Weg")) + dao.insert(Person("Klaas", 10, "Pad")) + }) + + // find persons, read actions don't need a transaction + var persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } + + // start transaction because of the update + db.begin() + + transaction { + val person = personDao.find("name = ? and age = ?", "John", 40) + + person.name = "Johnny" + + personDao.update(person) + } + + persons = personDao.where("name like ?", "J%") + + for (person in persons) { + System.out.println("Person: " + person.name) + } +} diff --git a/test/nl/astraeus/database/TestQueries.kt b/test/nl/astraeus/database/TestQueries.kt deleted file mode 100644 index 17391f4..0000000 --- a/test/nl/astraeus/database/TestQueries.kt +++ /dev/null @@ -1,199 +0,0 @@ -package nl.astraeus.database - -import nl.astraeus.database.annotations.Column -import nl.astraeus.database.annotations.Id -import nl.astraeus.database.annotations.Table -import nl.astraeus.database.jdbc.ConnectionPool -import nl.astraeus.database.jdbc.ConnectionProvider -import org.junit.Assert.* -import org.junit.Before -import org.junit.Test -import java.sql.Connection -import java.sql.DriverManager - -/** - * User: rnentjes - * Date: 18-10-15 - * Time: 17:00 - */ - -@Table -data class Company(var name: String) { - @Id var id: Long = 0 - - protected constructor(): this("") - - fun users(): List { - return transaction> { - var dao = UserDao() - - dao.where("company = ?", id) - } - } -} - -@Table(name = "usr") -class User( - var company: Company, - var name: String, - var email: String) { - @Id var id: Long = 0 - - protected constructor(): this(Company(""), "", "") -} - -// needs manual index to prevent double entries -@Table -class ManyToMany(var company: Company, @Column(name = "usr") var user: User) { - @Id var id: Long = 0 - - protected constructor(): this(Company(""), User(Company(""), "", "")) -} - -class CompanyDao(): SimpleDao(Company::class.java) - -class UserDao(): SimpleDao(User::class.java) - -class MTMDao(): SimpleDao(ManyToMany::class.java) { - - fun users(comp: Company): List { - return transaction> { - val dao = UserDao() - - dao.from("join manytomany where manytomany.user = usr.id and manytomany.company = ?", comp.id) - } - } - - fun companies(user: User): List { - return transaction> { - val dao = CompanyDao() - - dao.from("join manytomany where manytomany.company = company.id and manytomany.user = ?", user.id) - } - } -} - -fun createConnection(): Connection { - Class.forName("org.h2.Driver") - - val connection = DriverManager.getConnection("jdbc:h2:mem:TestQueries", "sa", "") - connection.autoCommit = false - - // result - return connection -} - -class MyConnectionProvider : ConnectionProvider() { - - override fun getConnection() = createConnection() - - override fun getDefinition(): DdlMapping.DatabaseDefinition { - return DdlMapping.DatabaseDefinition.H2 - } -} - -class TestQueries { - @Before fun setUp() { - val db = SimpleDatabase.define(ConnectionPool(MyConnectionProvider())) - - db.setExecuteDDLUpdates(true); - } - - @Test fun testWhere() { - val companyDao = CompanyDao() - val userDao = UserDao() - val mtmDao = MTMDao() - - transaction { - val company = Company("company") - - val info = User(company, "Info", "info@somewhere.com") - val piet = User(company, "Piet", "piet@somewhere.com") - - userDao.insert(info) - userDao.upsert(piet) - - info.name = "Iiiinfo" - userDao.update(info) - - piet.email = "pietje@somewhere.com" - userDao.upsert(piet) - - mtmDao.insert(ManyToMany(company, info)) - mtmDao.insert(ManyToMany(company, piet)) - mtmDao.insert(ManyToMany(Company("Other company"), info)) - } - - transaction { - val user = userDao.find("name = ?", "Iiiinfo") - - if (user != null) { - user.company.name = "Better Company!" - - companyDao.update(user.company) - - val companies = mtmDao.companies(user) - - for (company in companies) { - println("Company from ${user.name} -> ${company.name}") - } - } - } - - transaction { - val found = userDao.where("name = ?", "Iiiinfo") - - assertTrue(found.size == 1) - - assertTrue(userDao.all().size == 2) - - assertTrue(userDao.count("name = ?", "Piet") == 1) - - for(company in companyDao.all()) { - println("Company: #${company.id} - ${company.name}") - - for(user in company.users()) { - println("Company user: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") - } - } - - for(user in userDao.all()) { - println("Found: #${user.id} - ${user.name} - ${user.email} - ${user.company.name}") - } - - var rs = query(query = "SELECT * FROM company") - - while(rs.next()) { - print("Company: ") - print(rs.getLong(1)) - print(" - ") - println(rs.getString(2)) - } - - rs = query(query = "SELECT * FROM usr") - - while(rs.next()) { - print("User: ") - print(rs.getLong(1)) - print(" - ") - print(rs.getLong(2)) - print(" - ") - print(rs.getString(3)) - print(" - ") - println(rs.getString(4)) - } - - rs = query(query = "SELECT * FROM manytomany") - - while(rs.next()) { - print("MTM: ") - print(rs.getLong(1)) - print(" - ") - print(rs.getLong(2)) - print(" - ") - println(rs.getLong(3)) - } - } - } - -} diff --git a/test/nl/astraeus/database/example/MinimalExample.kt b/test/nl/astraeus/database/example/MinimalExample.kt deleted file mode 100644 index 35fcfba..0000000 --- a/test/nl/astraeus/database/example/MinimalExample.kt +++ /dev/null @@ -1,92 +0,0 @@ -package nl.astraeus.database.example - -import nl.astraeus.database.SimpleDao -import nl.astraeus.database.SimpleDatabase -import nl.astraeus.database.annotations.* -import nl.astraeus.database.jdbc.ConnectionProvider -import nl.astraeus.database.transaction -import java.sql.Connection -import java.sql.DriverManager -import java.sql.SQLException - -/** - * User: rnentjes - * Date: 11-12-16 - * Time: 16:43 - */ -@Table(name="persons") -@Cache(maxSize = 6) -class Person( - @Id val id: Long = 0, - - @Length(value = 200) - @Default("'new name'") - var name: String, - - @Default("21") - var age: Int, - - @Length(precision = 10, scale = 2) - var balance: Double, - - var address: String -) { - // no-arg constructor required - constructor(): this(0, "", 0, 0.0, "") - - constructor(name: String, age: Int, address: String): this(0, name, age, 0.0, address) -} - -fun main(args: Array) { - // define the default database, all it needs it a way to get a connection - val db = SimpleDatabase.define(object : ConnectionProvider() { - @Throws(SQLException::class, ClassNotFoundException::class) - override fun getConnection(): Connection { - Class.forName("org.h2.Driver") - - val connection = DriverManager.getConnection("jdbc:h2:mem:Example;DB_CLOSE_DELAY=-1", "sa", "") - connection.autoCommit = false - - return connection - } - }) - - // automatically create database tables and columns if needed - db.setExecuteDDLUpdates(true) - - // use default dao (extends it if you need more) - val personDao = SimpleDao(Person::class.java) - - // execute multiple dao actions in transaction - personDao.execute({ dao -> - dao.insert(Person("John", 40, "Road")) - dao.insert(Person("Jan", 32, "Straat")) - dao.insert(Person("Ronald", 31, "Wherever")) - dao.insert(Person("Piet", 26, "Weg")) - dao.insert(Person("Klaas", 10, "Pad")) - }) - - // find persons, read actions don't need a transaction - var persons = personDao.where("name like ?", "J%") - - for (person in persons) { - System.out.println("Person: " + person.name) - } - - // start transaction because of the update - db.begin() - - transaction { - val person = personDao.find("name = ? and age = ?", "John", 40) - - person.name = "Johnny" - - personDao.update(person) - } - - persons = personDao.where("name like ?", "J%") - - for (person in persons) { - System.out.println("Person: " + person.name) - } -}