Skip to content

Commit 81c2836

Browse files
committed
Fix #22 - Re-numbered falsely created rules G-3210 and G-3220 to G-3310 and G-3320. Fixed links for these rules in PDF.
1 parent 29d1079 commit 81c2836

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

docs/1-introduction/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ There are basically two types of standards.
7878

7979
2. Controversial
8080

81-
Almost every rule/guildeline falls into this category. An example of this category is [3 space indention](../../3-coding-style/coding-style/#rules). - Why not 2 or 4 or even 8? Why not use tabs? You can argue in favor of all these options. In most cases it does not really matter which option you choose. Being consistent is more important. In this case it will make the code easier to read.
81+
Almost every rule/guideline falls into this category. An example of this category is [3 space indention](../../3-coding-style/coding-style/#rules). - Why not 2 or 4 or even 8? Why not use tabs? You can argue in favor of all these options. In most cases it does not really matter which option you choose. Being consistent is more important. In this case it will make the code easier to read.
8282

8383
For very controversial rules, we have started to include the reasoning either as a footnote or directly in the text.
8484

docs/4-language-usage/3-dml-and-sql/3-transaction-control/g-3210.md renamed to docs/4-language-usage/3-dml-and-sql/3-transaction-control/g-3310.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# G-3210: Never commit within a cursor loop.
1+
# G-3310: Never commit within a cursor loop.
22

33
!!! danger "Critical"
44
Efficiency, Reliability
@@ -8,7 +8,7 @@
88
Doing frequent commits within a cursor loop (all types of loops over cursors, whether implicit cursor for loop or loop with explicit fetch from cursor or cursor variable) risks not being able to complete due to ORA-01555, gives bad performance, and risks that the work is left in an unknown half-finished state and cannot be restarted.
99

1010
* If the work belongs together (an atomic transaction) the `commit` should be moved to after the loop. Or even better if the logic can be rewritten to a single DML statement on all relevant rows instead of a loop, committing after the single statement.
11-
* If each loop iteration is a self-contained atomic transaction, consider instead to populate a collection of transactions to be done (taking restartability into account by collection population), loop over that collection (instead of looping over a cursor) and call a procedure (that contains the transaction logic and the `commit`) in the loop (see also [G-3220](../g-3220)).
11+
* If each loop iteration is a self-contained atomic transaction, consider instead to populate a collection of transactions to be done (taking restartability into account by collection population), loop over that collection (instead of looping over a cursor) and call a procedure (that contains the transaction logic and the `commit`) in the loop (see also [G-3320](../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3320)).
1212

1313

1414
## Example (bad)

docs/4-language-usage/3-dml-and-sql/3-transaction-control/g-3220.md renamed to docs/4-language-usage/3-dml-and-sql/3-transaction-control/g-3320.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# G-3220: Try to move transactions within a non-cursor loop into procedures.
1+
# G-3320: Try to move transactions within a non-cursor loop into procedures.
22

33
!!! warning "Major"
44
Maintainability, Reusability, Testability
55

66
## Reason
77

8-
Commit inside a non-cursor loop (other loop types than loops over cursors - see also [G-3210](../g-3210)) is either a self-contained atomic transaction, or it is a chunk (with suitable restartability handling) of very large data manipulations. In either case encapsulating the transaction in a procedure is good modularity, enabling reuse and testing of a single call.
8+
Commit inside a non-cursor loop (other loop types than loops over cursors - see also [G-3310](../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3310)) is either a self-contained atomic transaction, or it is a chunk (with suitable restartability handling) of very large data manipulations. In either case encapsulating the transaction in a procedure is good modularity, enabling reuse and testing of a single call.
99

1010
## Example (bad)
1111

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ markdown_extensions:
2828
- footnotes
2929

3030
extra:
31-
guideline_version: 4.0
31+
guideline_version: 4.0-SNAPSHOT
3232
social:
3333
- type: github-alt
3434
link: https://github.com/Trivadis

tools/run-in-container/genpdf.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ function write_guidelines(){
4444
for f in ${DATA_DIR}/docs/${DIR}/*.md
4545
do
4646
echo "" >> ${TARGET_DIR}/docs/index.md
47-
sed -e "s|# |${HEADER} |g" $f >> ${TARGET_DIR}/docs/index.md
47+
sed -e "s|# |${HEADER} |g" $f | \
48+
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3310|#g-3310-never-commit-within-a-cursor-loop|g' | \
49+
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3320|#g-3320-try-to-move-transactions-within-a-non-cursor-loop-into-procedures|g' >> ${TARGET_DIR}/docs/index.md
4850
done
4951
}
5052

0 commit comments

Comments
 (0)