query.inc

  1. cis7 includes/database/query.inc
  2. cis7 includes/database/mysql/query.inc
  3. cis7 includes/database/sqlite/query.inc
  4. cis7 includes/database/pgsql/query.inc
  5. cle7 includes/database/sqlite/query.inc
  6. cle7 includes/database/query.inc
  7. cle7 includes/database/mysql/query.inc
  8. cle7 includes/database/pgsql/query.inc
  9. ecd7 includes/database/pgsql/query.inc
  10. ecd7 includes/database/mysql/query.inc
  11. ecd7 includes/database/sqlite/query.inc
  12. ecd7 includes/database/query.inc
  13. elmsmedia7 includes/database/query.inc
  14. elmsmedia7 includes/database/mysql/query.inc
  15. elmsmedia7 includes/database/sqlite/query.inc
  16. elmsmedia7 includes/database/pgsql/query.inc
  17. harmony7 includes/database/pgsql/query.inc
  18. harmony7 includes/database/mysql/query.inc
  19. harmony7 includes/database/sqlite/query.inc
  20. harmony7 includes/database/query.inc
  21. icor7 includes/database/query.inc
  22. icor7 includes/database/pgsql/query.inc
  23. icor7 includes/database/sqlite/query.inc
  24. icor7 includes/database/mysql/query.inc
  25. meedjum_blog7 includes/database/mysql/query.inc
  26. meedjum_blog7 includes/database/pgsql/query.inc
  27. meedjum_blog7 includes/database/sqlite/query.inc
  28. meedjum_blog7 includes/database/query.inc
  29. mooc7 includes/database/mysql/query.inc
  30. mooc7 includes/database/sqlite/query.inc
  31. mooc7 includes/database/pgsql/query.inc
  32. mooc7 includes/database/query.inc

Query code for MySQL embedded database engine.

Classes

File

includes/database/mysql/query.inc
View source
  1. <?php
  2. /**
  3. * @addtogroup database
  4. * @{
  5. */
  6. /**
  7. * @file
  8. * Query code for MySQL embedded database engine.
  9. */
  10. class InsertQuery_mysql extends InsertQuery {
  11. public function execute() {
  12. if (!$this->preExecute()) {
  13. return NULL;
  14. }
  15. // If we're selecting from a SelectQuery, finish building the query and
  16. // pass it back, as any remaining options are irrelevant.
  17. if (empty($this->fromQuery)) {
  18. $max_placeholder = 0;
  19. $values = array();
  20. foreach ($this->insertValues as $insert_values) {
  21. foreach ($insert_values as $value) {
  22. $values[':db_insert_placeholder_' . $max_placeholder++] = $value;
  23. }
  24. }
  25. }
  26. else {
  27. $values = $this->fromQuery->getArguments();
  28. }
  29. $last_insert_id = $this->connection->query((string) $this, $values, $this->queryOptions);
  30. // Re-initialize the values array so that we can re-use this query.
  31. $this->insertValues = array();
  32. return $last_insert_id;
  33. }
  34. public function __toString() {
  35. // Create a sanitized comment string to prepend to the query.
  36. $comments = $this->connection->makeComment($this->comments);
  37. // Default fields are always placed first for consistency.
  38. $insert_fields = array_merge($this->defaultFields, $this->insertFields);
  39. // If we're selecting from a SelectQuery, finish building the query and
  40. // pass it back, as any remaining options are irrelevant.
  41. if (!empty($this->fromQuery)) {
  42. $insert_fields_string = $insert_fields ? ' (' . implode(', ', $insert_fields) . ') ' : ' ';
  43. return $comments . 'INSERT INTO {' . $this->table . '}' . $insert_fields_string . $this->fromQuery;
  44. }
  45. $query = $comments . 'INSERT INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
  46. $max_placeholder = 0;
  47. $values = array();
  48. if (count($this->insertValues)) {
  49. foreach ($this->insertValues as $insert_values) {
  50. $placeholders = array();
  51. // Default fields aren't really placeholders, but this is the most convenient
  52. // way to handle them.
  53. $placeholders = array_pad($placeholders, count($this->defaultFields), 'default');
  54. $new_placeholder = $max_placeholder + count($insert_values);
  55. for ($i = $max_placeholder; $i < $new_placeholder; ++$i) {
  56. $placeholders[] = ':db_insert_placeholder_' . $i;
  57. }
  58. $max_placeholder = $new_placeholder;
  59. $values[] = '(' . implode(', ', $placeholders) . ')';
  60. }
  61. }
  62. else {
  63. // If there are no values, then this is a default-only query. We still need to handle that.
  64. $placeholders = array_fill(0, count($this->defaultFields), 'default');
  65. $values[] = '(' . implode(', ', $placeholders) . ')';
  66. }
  67. $query .= implode(', ', $values);
  68. return $query;
  69. }
  70. }
  71. class TruncateQuery_mysql extends TruncateQuery { }
  72. /**
  73. * @} End of "addtogroup database".
  74. */
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.