Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Test SQL code generator class
  19   *
  20   * @package    core
  21   * @category   dml
  22   * @copyright  2018 Srdjan Janković, Catalyst IT
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  require_once (__DIR__.'/../../../ddl/sql_generator.php');
  29  
  30  /**
  31   * Test SQL code generator class
  32   *
  33   * @package    core
  34   * @category   ddl
  35   * @copyright  2018 Catalyst IT
  36   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  37   */
  38  class test_sql_generator extends sql_generator {
  39      // @codingStandardsIgnoreStart
  40      /**
  41       * Reset a sequence to the id field of a table.
  42       *
  43       * @param xmldb_table|string $table name of table or the table object.
  44       * @return array of sql statements
  45       */
  46      public function getResetSequenceSQL($table) {
  47      // @codingStandardsIgnoreEnd
  48          return [];
  49      }
  50  
  51      // @codingStandardsIgnoreStart
  52      /**
  53       * Given one correct xmldb_table, returns the SQL statements
  54       * to create temporary table (inside one array).
  55       *
  56       * @param xmldb_table $xmldbtable The xmldb_table object instance.
  57       * @return array of sql statements
  58       */
  59      public function getCreateTempTableSQL($xmldbtable) {
  60      // @codingStandardsIgnoreEnd
  61          return [];
  62      }
  63  
  64      // @codingStandardsIgnoreStart
  65      /**
  66       * Given one XMLDB Type, length and decimals, returns the DB proper SQL type.
  67       *
  68       * @param int $xmldbtype The xmldb_type defined constant. XMLDB_TYPE_INTEGER and other XMLDB_TYPE_* constants.
  69       * @param int $xmldblength The length of that data type.
  70       * @param int $xmldbdecimals The decimal places of precision of the data type.
  71       * @return string The DB defined data type.
  72       */
  73      public function getTypeSQL($xmldbtype, $xmldblength = null, $xmldbdecimals = null) {
  74      // @codingStandardsIgnoreEnd
  75          return '';
  76      }
  77  
  78      // @codingStandardsIgnoreStart
  79      /**
  80       * Returns the code (array of statements) needed to add one comment to the table.
  81       *
  82       * @param xmldb_table $xmldbtable The xmldb_table object instance.
  83       * @return array Array of SQL statements to add one comment to the table.
  84       */
  85      function getCommentSQL ($xmldbtable) {
  86      // @codingStandardsIgnoreEnd
  87          return [];
  88      }
  89  
  90      // @codingStandardsIgnoreStart
  91      /**
  92       * Given one xmldb_table and one xmldb_field, return the SQL statements needed to add its default
  93       * (usually invoked from getModifyDefaultSQL()
  94       *
  95       * @param xmldb_table $xmldbtable The xmldb_table object instance.
  96       * @param xmldb_field $xmldbfield The xmldb_field object instance.
  97       * @return array Array of SQL statements to create a field's default.
  98       */
  99      public function getCreateDefaultSQL($xmldbtable, $xmldbfield) {
 100      // @codingStandardsIgnoreEnd
 101          return [];
 102      }
 103  
 104      // @codingStandardsIgnoreStart
 105      /**
 106       * Given one xmldb_table and one xmldb_field, return the SQL statements needed to drop its default
 107       * (usually invoked from getModifyDefaultSQL()
 108       *
 109       * @param xmldb_table $xmldbtable The xmldb_table object instance.
 110       * @param xmldb_field $xmldbfield The xmldb_field object instance.
 111       * @return array Array of SQL statements to create a field's default.
 112       */
 113      public function getDropDefaultSQL($xmldbtable, $xmldbfield) {
 114      // @codingStandardsIgnoreEnd
 115          return [];
 116      }
 117  
 118      // @codingStandardsIgnoreStart
 119      /**
 120       * Returns an array of reserved words (lowercase) for this DB
 121       * @return array An array of database specific reserved words
 122       */
 123      public static function getReservedWords() {
 124      // @codingStandardsIgnoreEnd
 125          return [];
 126      }
 127  
 128  }