-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
4 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
Querying database | ||
----------------- | ||
|
||
To query database, you can use hte ``$DB::query()`` method. | ||
To query database, you can use the ``$DB::request()`` method and give it a full SQL query. | ||
|
||
.. warning:: | ||
|
||
Whether this is possible to query database directly using this method, it should be avoid when possible, and you'd better use :doc:`DBIterator <dbiterator>` instead. | ||
Whether this is possible to use full SQL t query database using this method, it should be avoid when possible, and you'd better use :doc:`DBIterator <dbiterator>` instead. | ||
|
||
|
||
To make a database query that could not be done using ``$DB->request()``, to call SQL functions (``NOW()``, ``ADD_DATE()``, ...) for example, you can use the ``query()`` method: | ||
To make a database query that could not be done using DBIterator (calling SQL functions such as ``NOW()``, ``ADD_DATE()``, ... for example), you can do: | ||
|
||
.. code-block:: php | ||
<?php | ||
$DB->query('SELECT id FROM glpi_users WHERE end_date > NOW()'); | ||
$DB->request('SELECT id FROM glpi_users WHERE end_date > NOW()'); |