171 Commits

Author SHA1 Message Date
Mark Webster
1a561c23e6 MDL-78492 dml: Better support for auroramysql
Aurora MySQL does not support row format COMPRESSED and falls back
to COMPACT if you try to use it, cuasing column size too large
errors if you try to use it with utf8mb4 collation.
2023-07-25 11:56:50 +01:00
Srdjan
bb1ecd8ea4 MDL-54704 dml: support for SSL with MySQL / MariaDB and PostgreSQL 2023-06-30 15:41:39 +10:00
Srdjan
9fcba75de4 MDL-78212 dml: Added MYSQLI_CLIENT_COMPRESS option for mysqli
Config dboptions key 'clientcompress'.
Decreases traffic between the application server and the database host.
2023-06-21 10:07:17 +10:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Matteo Scaramuccia
0131c3be00 MDL-69581 dml: Improve MySQL/MariaDB server version detection
Add 'versionfromdb' to opt-in for VERSION() query.

mariadb_native_moodle_database::get_server_info() has been removed
to avoid the specific override: everything is now managed in the base
method which takes care of both MySQL and MariaDB versioning details.

New protected methods have been added too to improve the testing strategy,
allowing to mock the results from an actual DB connection.
The new testing strategy enables simulating even the Azure scenarios.
2022-12-28 10:59:45 +01:00
Matteo Scaramuccia
75123ed7fd MDL-74912 dml: Fix missing nullable marker 2022-11-05 10:07:26 +01:00
Matteo Scaramuccia
b82c95a075 MDL-74912 mod_forum: Fix regexp word boundaries markers in MySQL 8 2022-11-05 10:07:26 +01:00
Eloy Lafuente (stronk7)
83eb19338e MDL-75760 database: Keep mysql driver working over all PHP versions
Before PHP 8.1, the mysqli extension had MYSQLI_REPORT_OFF as default setting.
With PHP 8.1, it has been changed to MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT
The native driver is not ready to work with this new reporting level,
see MDL-75761 about to considering to improve it.

So this change just ensures that we continue using MYSQLI_REPORT_OFF
with any PHP version.
2022-10-21 16:33:22 +02:00
Srdjan
5248067884 MDL-71000 lib/dml: New query type SQL_QUERY_AUX_READONLY
For SQL_QUERY_AUX queries that can go to readonly, conditions permitting.
2022-08-23 10:39:43 +10:00
Limekiller
3c60f8a0ce MDL-73450 installation: Support Aurora MySQL >= 8.0.0 2022-02-10 15:14:35 -05:00
Paul Holden
b2d19cc29f MDL-52817 dml: implement driver methods for SQL group concatenation. 2021-02-19 15:31:00 +00:00
Tim Hunt
dc72bc6ac5 MDL-54907 dml: Correct incorrect PHPdoc 2020-11-27 14:57:36 +00:00
Eloy Lafuente (stronk7)
533c35ff99 MDL-69973 xmldb: Fix problem with MariaDB >= 10.2.7 metadata defaults
With MariaDB 10.2.7 the driver was incorrectly returning '' (empty
string) as default for all the columns having null (meaning, no
default).

Also, cover the case in unit tests, it seems that we were already
testing other defaults but not the null case.
2020-10-30 19:27:11 +01:00
sam marshall
edb5cd0de4 MDL-69687 DB: Add API for deleting data based on subquery
The new API works on normal databases (by deleting data based on the
subquery) and also on MySQL (by deleting the data using a weird join
on the subquery).
2020-10-16 18:20:23 +01:00
Srdjan
317432cacc MDL-19711 dml: call mysqli::real_connect() with @ 2020-05-19 18:09:14 +10:00
Srdjan
3612d0b8b9 MDL-19711 dml: Fix undefined $dberr
In mysqli_native_moodle_database::raw_connect()
2020-05-19 17:02:05 +10:00
Srdjan
46cfde3d95 MDL-19711 dml: Enable use of readonly slave database handles
Implemented with moodle_read_slave_trait

Functionality is triggered by supplying config dboption['readonly'].
See config-dist.php for more info on supported dboptions.

pgsql and mysqli drivers are using this feature. Also added support for
connection timeout for these two drivers.
2020-05-19 11:50:42 +10:00
Shamim Rezaie
b4d062c6be MDL-58584 core: remove duplications from get_columns functions 2020-02-03 15:07:15 +11:00
Jun Pataleta
669de78352 MDL-66110 dml: Undo table name fix when table name's used as parameter 2019-08-22 16:16:08 +08:00
Ryan Wyllie
f12c591807 MDL-66110 dml: use fix_table_name for all mysql table names
Changed all of the places that were manually prefixing the table
name to instead fix the table name with the fix_table_name
function.
2019-08-22 16:03:33 +08:00
Ryan Wyllie
30d2b9cd31 MDL-66110 dml: Fix MySQL v8 compatibility with groups table
MySQL v8 has added "groups" to the reserved word list. That is used
as a table name in Moodle so we have to quote it with backticks in the
SQL so that MySQL knows it's being used as an identifier.
2019-08-13 09:35:19 +08:00
Matteo Scaramuccia
82c2d98fa2 MDL-61702 dml: MariaDB 10.3 supports only the Barracuda file format.
More details about this change also in https://tracker.moodle.org/browse/MDL-59099

Ref.: https://mariadb.com/kb/en/library/mariadb-1031-release-notes/#other-variables
2018-05-31 22:55:00 +02:00
David Monllao
17ed12eb17 Merge branch 'm35_MDL-59596_DDL_Issues_With_MariaDB_10p2_SQLMode' of https://github.com/scara/moodle 2018-05-28 08:15:09 +02:00
Matteo Scaramuccia
f6b16e95a8 MDL-59596 ddl: Added has_breaking_change_sqlmode() 2018-03-26 23:12:36 +02:00
David Monllao
c2e970779d MDL-53226 search_simpledb: Refine the patch
- Clumsy fallback only when there is no full-text search support
- Mimic solr tests
- pgsql tokenization using simple configuration
- workaround for mysql '*' search issue
- total results proper calculation
- SQL server FTS support
- Standarize dml full-text search checkings
- Upgrade note about the new dml method
- Set search_simpledb as default engine if no solr config
2018-03-20 18:49:38 +01:00
Matteo Scaramuccia
740a9315c3 MDL-59099 dml: MySQL8 supports only the Barracuda file format.
The following InnoDB file format configuration parameters were deprecated
in MySQL 5.7.7 and are now removed:
- innodb_file_format
- innodb_file_format_check
- innodb_file_format_max
- innodb_large_prefix

File format configuration parameters were necessary for creating tables
compatible with earlier versions of InnoDB in MySQL 5.1.
Now that MySQL 5.1 has reached the end of its product lifecycle,
the parameters are no longer required.

The FILE_FORMAT column was removed from the INNODB_SYS_TABLES and
INNODB_SYS_TABLESPACES Information Schema tables.

Ref: https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-0.html
2017-10-27 17:38:36 +02:00
Matteo Scaramuccia
500d8650d2 MDL-59100 dml: Lower the case of INFORMATION_SCHEMA.* fields. 2017-10-21 14:30:38 +02:00
David Monllao
b1a9a6a19a Merge branch 'wip-MDL-60281-master' of git://github.com/marinaglancy/moodle 2017-10-17 09:45:44 +02:00
Marina Glancy
109fbd5a15 MDL-46269 dml: Add casesensitive argument to sql_regex() 2017-10-16 16:53:46 +08:00
Marina Glancy
484b43f456 MDL-60281 general: create_function is deprecated in PHP7.2 2017-10-16 09:37:19 +08:00
Andrew Nicols
ee640d3f2d Merge branch 'm34_MDL-59583_Fix_MariaDB_10d2d7_Breaking_Change' of https://github.com/scara/moodle 2017-08-03 12:29:56 +08:00
Matteo Scaramuccia
2ec50fe3fd MDL-59583 dml: fixed NULL values w/ MariaDB 10.2.7+ 2017-08-03 00:13:03 +02:00
Andrew Nicols
2653e0c8e1 Merge branch 'm34_MDL-59583_Fix_MariaDB_10d2d7_Breaking_Change' of https://github.com/scara/moodle 2017-07-31 11:37:45 +08:00
Matteo Scaramuccia
0510d5c757 MDL-59583 dml: fixed breaking change added w/ MariaDB 10.2.7+ 2017-07-25 12:36:23 +02:00
Matteo Scaramuccia
dae6c5dc31 MDL-59583 dml: improve perfs by unsetting the key. 2017-07-25 09:06:18 +02:00
Adrian Greeve
3a8c989137 MDL-59561 database: Update to creating new indexes in mysql.
When updating the mysql system to utf8mb4 not all tables are
converted to the row format of compressed or dynamic. If a new
index is created there is a possibility that the table could be
using compact or redundant and then an error will be shown saying
that the index size is too large. This fix handles this exception
and converts the table over to compressed.
2017-07-21 09:27:08 +08:00
Marina Glancy
f2b5ed40f9 MDL-58689 dml: prevent logging during setup 2017-04-27 10:07:01 +08:00
Adrian Greeve
0bbefd81cd MDL-48228 database: Make utf8mb4 the default character set for mysql.
Thanks to Jetha Chan for providing the initial patch that this is
based on.
2017-03-01 09:03:12 +08:00
Ankit Agarwal
c728b45904 MDL-57192 dml: Temporarily disable query logging during setup 2017-01-03 17:24:21 +05:30
Eloy Lafuente (stronk7)
9d5c12bee4 MDL-29332 dml: new sql_equal() to force cs/ci behavior on varchar matching 2016-09-15 16:33:00 +02:00
Eloy Lafuente (stronk7)
4ae653024d MDL-53944 dml: make char2real() for mysql to support decimals
- With the patch, 6 positions of scale accuracy are guaranteed
  per individual casted value.
- Backed with unit tests, both for varchar and clob.
- Added 2 missing tests about uses of the method with params
  and values.

Note: 6 was picked because looking to all databases implementation
postgres was found to be casting to real, aka, 6.
2016-05-06 09:27:32 +08:00
Simey Lameze
87a3e50192 MDL-51374 core_dml: change database layer to pass table name as parameter 2016-03-15 14:43:45 +08:00
Russell Smith
d22a01fd99 MDL-53213 caching: Faster databasemeta caching for all databases. 2016-02-28 17:03:14 +11:00
Marina Glancy
57ee89569a MDL-50633 dml: deprecated var replaced in mysql 5.7
Thanks to Charles Verge for providing a patch
2015-11-02 21:05:20 +08:00
David Monllao
2bdeb8ef30 MDL-51052 dml: More info about mysql and case & accent sensitiveness 2015-09-18 11:45:53 +08:00
Charles Fulton
3d47155643 MDL-51052 dml: support for sql_like() under utf8_bin 2015-09-18 09:56:43 +08:00
Julien Boulen
9b45b74e8f MDL-47584 database SQL: add debug info on connection error notices 2014-10-29 16:59:56 +08:00
Marina Glancy
3b4db5bdf5 MDL-44725 dml: added sql_intersect() 2014-09-03 13:33:58 +08:00
Petr Skoda
a45d54b8cb MDL-46235 ddl: add support for large number of text fields in one database table 2014-08-25 12:40:57 +12:00
Tim Hunt
5bcfd504df MDL-45618 Fix @since PHPdoc tags. 2014-05-19 17:03:04 +01:00