User login
Drupal is an open source content management platform
Equipped with a powerful blend of features, Drupal supports a variety of websites ranging from personal weblogs to large community-driven websites.
Layer of abstraction database

This text is automatically translated. That's just an example how your nodes will look like.
Allows the use of different types of databases, using the same code.
Drupal is a simplified abstraction level of data and allows developers to easily work with several types of database servers (eg: MySQL or PGSQL). This method allows you to keep the syntax and the power of SQL, how much is possible, and at the same time requests Drupal will generate different servers in different ways, and it helps protect data stored in SQL.
For the majority of calls to the database, it is sufficient to use the function db_query ( ) or db_query_range ( ) Developers should also pay attention to the function pager_query ( ) which is used in case of queries, the results of which will need to be derive by page, and tablesort_sql ( ) is used to make queries posed sorts.
For example, to list the last 10 articles of a specific user. Instead of direct use of SQL-query:
SELECT n.title, n.body, n.created FROM node n WHERE n.uid = $ uid LIMIT 0, 10;
You can call functions of Drupal:
| $ result = db_query_range ( 'SELECT n.title, n.body, n.created FROM (node) n WHERE n.uid =% D', $ uid, 0, 10); while ($ node = db_fetch_object ($ result)) ( / / Take any operations on $ node-> body, etc. ) |
The braces around the 'node' is used to auto-prefix lookup table, which makes the function db_prefix_tables ( ) Uid parameter is inserted into the request through substitute '%d' and the argument of the function $uid which prevents SQL-injection, possibly with the filing of a $uid malicious values.
The syntax of SQL-LIMIT design depends on the DBMS, therefore, should use the db_query_range ( ) to obtain the relevant functionality.
Finally, to obtain and work with the result, primarily use db_fetch_object ( )
- Login to post comments
Drupal is a free software package that allows an individual or a community of users to easily publish, manage and organize a wide variety of content on a website. Tens of thousands of people and organizations are using Drupal.