|
| 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 | + * Native Aurora MySQL class representing moodle database interface. |
| 19 | + * |
| 20 | + * @package core_dml |
| 21 | + * @copyright 2020 Lafayette College ITS |
| 22 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 23 | + */ |
| 24 | + |
| 25 | +defined('MOODLE_INTERNAL') || die(); |
| 26 | + |
| 27 | +require_once(__DIR__.'/moodle_database.php'); |
| 28 | +require_once(__DIR__.'/mysqli_native_moodle_database.php'); |
| 29 | +require_once(__DIR__.'/mysqli_native_moodle_recordset.php'); |
| 30 | +require_once(__DIR__.'/mysqli_native_moodle_temptables.php'); |
| 31 | + |
| 32 | +/** |
| 33 | + * Native Aurora MySQL class representing moodle database interface. |
| 34 | + * |
| 35 | + * @package core_dml |
| 36 | + * @copyright 2020 Lafayette College ITS |
| 37 | + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 38 | + */ |
| 39 | +class auroramysql_native_moodle_database extends mysqli_native_moodle_database { |
| 40 | + |
| 41 | + /** @var bool is compressed row format supported cache */ |
| 42 | + protected $compressedrowformatsupported = false; |
| 43 | + |
| 44 | + /** |
| 45 | + * Returns localised database type name. |
| 46 | + * |
| 47 | + * Returns localised database type name. Can be used before connect(). |
| 48 | + * @return string |
| 49 | + */ |
| 50 | + public function get_name(): ?string { |
| 51 | + return get_string('nativeauroramysql', 'install'); |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Returns localised database configuration help. |
| 56 | + * |
| 57 | + * Returns localised database configuration help. Can be used before connect(). |
| 58 | + * @return string |
| 59 | + */ |
| 60 | + public function get_configuration_help(): ?string { |
| 61 | + return get_string('nativeauroramysql', 'install'); |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Returns the database vendor. |
| 66 | + * |
| 67 | + * Returns the database vendor. Can be used before connect(). |
| 68 | + * @return string The db vendor name, usually the same as db family name. |
| 69 | + */ |
| 70 | + public function get_dbvendor(): ?string { |
| 71 | + return 'mysql'; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Returns more specific database driver type |
| 76 | + * |
| 77 | + * Returns more specific database driver type. Can be used before connect(). |
| 78 | + * @return string db type mysqli, pgsql, oci, mssql, sqlsrv |
| 79 | + */ |
| 80 | + protected function get_dbtype(): ?string { |
| 81 | + return 'auroramysql'; |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * It is time to require transactions everywhere. |
| 86 | + * |
| 87 | + * MyISAM is NOT supported! |
| 88 | + * |
| 89 | + * @return bool |
| 90 | + */ |
| 91 | + protected function transactions_supported(): ?bool { |
| 92 | + if ($this->external) { |
| 93 | + return parent::transactions_supported(); |
| 94 | + } |
| 95 | + return true; |
| 96 | + } |
| 97 | + |
| 98 | + |
| 99 | +} |
0 commit comments