Skip to content

Commit

Permalink
Merge pull request #102 from 0xmzn/patch-1
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
tibitoth authored Jan 17, 2025
2 parents 3db0dfb + a42c066 commit 4703d9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/en/lecture-notes/adonet/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ How do we know that the result of our query is an empty set? And how do we know

### DataReader

Here, we need a connection to the database to fetch the required data from the database. The connection remains open only for a short time, during with we query fresh data and usually convert it to some other internal representation.
Here, we need a connection to the database to fetch the required data from the database. The connection remains open only for a short time, during which we query fresh data and usually convert it to some other internal representation.

**Processing steps:**

Expand Down Expand Up @@ -310,7 +310,7 @@ using(var conn = new SqlConnection(connectionString))

### SQL injection

**SQL injection** is a **severe error** in an application when a query is created without sanitizing the values of parameters. Parameter values can come from the client side, with user-selected or user-specified data. This can cause a problem if a malicious user writes an SQL command into a field from which we would expect something else. For example, we would expect a username, but instead `Monkey92); DROP TABLE Users; -` value is received. If we were to include this text and insert it into our SQL statement, we would also execute `drop table`, thereby deleting an entire table. This is a **serious mistake**!
**SQL injection** is a **severe vulnerability** in an application when a query is created without sanitizing the values of parameters. Parameter values can come from the client side, with user-selected or user-specified data. This can cause a problem if a malicious user writes an SQL command into a field from which we would expect something else. For example, we would expect a username, but instead `Monkey92); DROP TABLE Users; -` value is received. If we were to include this text and insert it into our SQL statement, we would also execute `drop table`, thereby deleting an entire table. This is a **serious mistake**!

!!! important "**SOLUTION**"
Using parameters (see the [Command section](#command) for an example).
Expand Down
4 changes: 2 additions & 2 deletions docs/en/lecture-notes/transactions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The ANSI/ISO SQL standard defines the following isolation levels:

The database enforces isolation through locks: when a record is accessed (read or write), it is locked by the system. The lock is placed on the record when it is first accessed and is removed at the end of the transaction. The type of lock (e.g., shared lock or mutually exclusive) depends on the isolation level and the implementation of the database management system.

These locks, in effect, enforce the scheduling of the transactions. When a lock is not available, because the record it used by another translation and concurrent access is not allowed by the isolation level, the transaction will wait.
These locks, in effect, enforce the scheduling of the transactions. When a lock is not available, because the record it used by another transaction and concurrent access is not allowed by the isolation level, the transaction will wait.

We know that when we use locks, **deadlock** can occur. This is no different in databases. A deadlock may occur when two transactions are competing for the same locks. See the figure below; a continuous line represents an owned lock, while the dashed ones represent a lock the transaction would like to acquire. Neither of these requests can be fulfilled, resulting in both transactions being unable to move forward.

Expand All @@ -160,7 +160,7 @@ A transaction combines a sequence of steps. It is, therefore, necessary to mark
!!! note "Simple statements are transactions too"
Since all SQL statements run within a transaction scope, the transaction properties are automatically guaranteed for all statements. For example, a `delete` statement affecting multiple records cannot abort and delete only half of the records.

1. The developer executes a `begin transaction` SQL statement to start a transaction, and completes it either with `commit` or `rollback`. Commit completes the translation and saves its changes, while rollback aborts the transaction and undoes its changes.
1. The developer executes a `begin transaction` SQL statement to start a transaction, and completes it either with `commit` or `rollback`. Commit completes the transaction and saves its changes, while rollback aborts the transaction and undoes its changes.

!!! note "Nested transactions"
Some database management systems enable nested transactions too. Completing transactions follow the nesting: each level needs to be committed.
Expand Down

0 comments on commit 4703d9e

Please sign in to comment.