Skip to content

Commit ad12d1c

Browse files
authored
Merge pull request #1006 from ExpressionEngine/add/clarify-db-driver-usefulness
Beef up discussion of DB driver benefits
2 parents 6e2c597 + 1bc63f4 commit ad12d1c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/development/database-access.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
-->
99

1010
# Accessing the Database
11-
You may often want to query or update your database from within your add-on. This can be done using the [Model Service](development/services/model.md) or you can also execute SQL statements by using the legacy [Database Driver](development/legacy/database/index.md).
12-
13-
TIP: The Model Service is much cleaner than the legacy Database Driver. However, it also has limitations on what it can do compared to the Database Driver.
11+
You may often want to query or update your database from within your add-on. This can be done using the [Model Service](development/services/model.md) or you can execute SQL statements by using the [Database Driver](development/legacy/database/index.md) and its [Active Record](https://docs.expressionengine.com/latest/development/legacy/database/active-record.html) class.
1412

13+
Each approach has its own strengths, and you can use either depending on the specific needs of your code.
1514

1615
Let's use a real example to show how you might access data using both methods:
1716

@@ -46,7 +45,7 @@ class Memberlist extends AbstractRoute
4645
}
4746
```
4847

49-
Here is the class syntax using the legacy Database Drive:
48+
Here is the class syntax using the Database Driver's Active Record class, which provides more portability, cleaner code, and default secuirity enhancementsa versus raw queries:
5049

5150
```
5251
namespace ExpressionengineDeveloper\AmazingAddOn\Module\Tags;
@@ -88,4 +87,6 @@ Douglas
8887
Richmond
8988
```
9089

90+
The Database driver shines when pulling back raw data from specific sources quickly or making targeted inserts and updates. Models provide consistency and easy access to complex data. Use both as needed for fast, clean, secure interaction with the database.
91+
9192
This is only the beginning of how you can interact with the database through your add-on. Explore the [Model Service](development/services/model.md) and the legacy [Database Driver](development/legacy/database/index.md) to learn how to add more power to your add-on.

0 commit comments

Comments
 (0)