Skip to content
  1. Feb 25, 2011
  2. Nov 15, 2006
  3. Oct 12, 2006
  4. Sep 26, 2006
  5. May 24, 2006
  6. Apr 27, 2006
  7. Apr 11, 2006
  8. Feb 26, 2006
  9. Feb 20, 2006
  10. Jan 24, 2006
  11. Jan 21, 2006
  12. Dec 07, 2005
  13. Dec 06, 2005
  14. Nov 29, 2005
  15. Nov 27, 2005
  16. Nov 21, 2005
  17. Nov 04, 2005
  18. Oct 20, 2005
  19. Oct 18, 2005
  20. Aug 29, 2005
  21. Aug 25, 2005
  22. Aug 11, 2005
  23. Jul 30, 2005
  24. Jul 27, 2005
  25. Jun 22, 2005
  26. May 23, 2005
  27. Apr 08, 2005
  28. Jan 07, 2005
  29. Nov 29, 2004
    • Dries Buytaert's avatar
      - Patch #13581 by Steven: Db_query() allows a variable amount of parameters so... · 29337ad8
      Dries Buytaert authored
      - Patch #13581 by Steven: Db_query() allows a variable amount of parameters so you can pass the query arguments in. There is however an alternative syntax: instead of passing the query arguments as function arguments, you can also pass a single array with the query arguments in it. For example the following two statements are equivalent:
      
      db_query($query, $a, $b, $c);
      db_query($query, array($a, $b, $c));
      
      This usage is particularly interesting when the query is constructed dynamically, and the amount of arguments to pass varies. In that case we use the second method to avoid using call_user_func_array(). This behaviour is not documented explicitly, but it is used in several places.
      
      However, db_query_range() and pager_query() do not support this syntax properly, which means there are several pieces of code which still revert to the ugly call_user_func_array() call.
      
      This patch updates db_query_range() and pager_query() so they support the array-passing method. I also added documentation about this method to each of the db functions.
      
      I also cleaned up the code for db_query (it was weird and hard to understand) and moved db_query() and db_queryd() from database.xxxxx.inc to database.inc: it was the same between both mysql and pgsql, as it doesn't do anything database specific. It just prefixes the tables and inserts the arguments. The actual db query is performed in _db_query(), which is still in database.xxxxx.inc.
      
      Finally, I updated several places with the new syntax, and the code is a lot cleaner. For example:
      - array_unshift($params, "SELECT u.* FROM {users} u WHERE $query u.status < 3");
      - $params[] = 0;
      - $params[] = 1;
      - $result = call_user_func_array('db_query_range', $params);
      + $result = db_query_range("SELECT u.* FROM {users} u WHERE $query u.status < 3", $params, 0, 1);
      
      and
      
      - return call_user_func_array('db_query_range', array_merge(array($query), $args, array((int)$pager_from_array[$element], (int)$limit)));
      + return db_query_range($query, $args, (int)$pager_from_array[$element], (int)$limit);
      
      I've tested it on mysql. I didn't alter the actual db behaviour, so pgsql should be okay too.
      
      This patch is important because many people avoid the call_user_func_array() method and put data directly into the db query.  This is very, very bad because the database prefix will be applied to it, and strip out braces. It's also generally bad form as you have to call check_query() yourself.  With the new, documented syntax, there is no more excuse to put data directly in the query.
      29337ad8
  30. Nov 21, 2004
    • Dries Buytaert's avatar
      · fa978390
      Dries Buytaert authored
      - Patch 13180 by chx: renamed check_query() to db_escape_string() and implemtented it properly per database backend.
      
        Read the manual for pg_escape_string:  "Use of this function is recommended instead of addslashes()." Or read sqlite_escape_string: "addslashes() should NOT be used to quote your strings for SQLite queries; it will lead to strange results when retrieving your data."
      fa978390
  31. Sep 20, 2004
    • Dries Buytaert's avatar
      · 228b3c7c
      Dries Buytaert authored
      - Patch #10945 by Adrian: more PostgreSQL fixes/updates.
      228b3c7c
  32. Sep 09, 2004
    • Dries Buytaert's avatar
      · b84b6e42
      Dries Buytaert authored
      - Patch #10663 by JonBob: documentation improvements: fixed some typos and improved consistency to the use of Doxygen/api.module commands in the comments.
      b84b6e42
  33. Sep 08, 2004
    • Dries Buytaert's avatar
      · 7b716e8e
      Dries Buytaert authored
      - Patch #10622 by Adrian: fixes various PostgreSQL related problems.
      
        1) Menu problems with Postgres (this is a highly critical 1 line fix)
        2) Archive module fails with Postgres
        3) Postgres setup problems - changes to database.pgsql (although i made these changes myself before finding this patch)
        4) Book module fails with Postgres
        5) Postgres problems following creation of a new type of user - which is actually about a taxonomy.module bug.
        6) Creating accregator_item_table in PostgreSQL
        7) Postgres - Polls not displayed on Poll Page
        8) Blog module has sql errors with postgres
      
        This should not affect MySQL users (hopefully).
      7b716e8e
  34. Jul 14, 2004
    • Dries Buytaert's avatar
      · 63a327db
      Dries Buytaert authored
      - Patch #9287 by JonBob: made the code style in the three database include files consistent with Drupal standards, and adds a wealth of Doxygen-style comments to aid developers in writing solid database access code using the API.
      63a327db
  35. Apr 30, 2004
    • Dries Buytaert's avatar
      · e4d45aae
      Dries Buytaert authored
      - Patch by Adrian: added support for multiple database connections.
      e4d45aae
  36. Dec 08, 2003
    • Dries Buytaert's avatar
      · 3904790e
      Dries Buytaert authored
      - Tidied up the DoxyGen comments.  Patch by Kjartan.
      3904790e
  37. Nov 24, 2003
    • Dries Buytaert's avatar
      Patch by Ax to fixe and improve to the core doxygen PHPdoc: · 06045ff7
      Dries Buytaert authored
        * fixes all doxygen warnings [#]_ in the current code base
          + changes @param style from phpDocumentor (@param type $var desc) to doxygen (@param $var desc)
          + documents all undocumented parameters
          + escapes / fixes html warnings
          + fixes @defgroup in theme.inc
        * adds more groupings [#]_
          + drupal_{set|get}_title, drupal_{set|get}_breadcrumb
          + pager.inc: pager_api (pager_query(), pager_display()), pager pieces
        * adds a new group "themeable" which contains all themeable functions.
      06045ff7
  38. Oct 22, 2003
    • Dries Buytaert's avatar
      · 742410aa
      Dries Buytaert authored
      - Bugfix: prefix not prepended to sequences.  Fixes bug #3639.
      
        Make sure to write:
      
          db_next_id({table}_field);
      
        instead of:
      
          db_next_id(table_field);
      742410aa
  39. Jul 21, 2003
    • Dries Buytaert's avatar
      · c39562ae
      Dries Buytaert authored
      - Fixed node_save() and user_save() bug introduced by table prefix changes.
        Modified patches from Gerhard.
      
      - Changed the order of the checks in node_teaser().  Patch from Kobus.
      c39562ae
  40. Jul 10, 2003
    • Dries Buytaert's avatar
      · 337b3c9d
      Dries Buytaert authored
      - Committed a slightly modified version of Slavica's table prefix patch.
      337b3c9d