863 Commits

Author SHA1 Message Date
Matteo Scaramuccia
bccbd3b4eb MDL-61626 core_dml: pgsql and schema qualification. 2018-03-11 22:56:36 +01:00
Eloy Lafuente (stronk7)
5405354d88 MDL-61240 dml: php72 compatibility, avoid counting on non-countables
This was not detected earlier because we have been unable to
run sqlsrv + php72 till now (not available).
2018-01-19 00:59:16 +01:00
Jake Dallimore
fa2a9cc933 MDL-23887 database: fix use of deprecated system tables for mssql
Catalog views are available which we should use instead.
2018-01-02 17:19:17 +08:00
Damyon Wiese
8cae085071 Merge branch 'MDL-60976-master' of https://github.com/matt-catalyst/moodle 2017-12-12 09:56:20 +08:00
Neill Magill
61fad215f1 MDL-60041 dml: MOODLELIB sql file must have Unix line endings
If the file does not have Unix line endings then the regular expression
in oci_native_moodle_database::attempt_oci_package_install() does
not split it correctly.

This leads to an invalid package being created in Oracle.

The .gitattribute file changes for oci_native_moodle_package.sql
force it to have Unix style line endings when the branch is checked
out and the file does not already exist.

The file has been modified so that the Unix style line endings are
applied even if the file already exists, for example when pulling in
this change to an existing branch.
2017-12-11 08:40:58 +00:00
Matt Clarkson
1c06098b6b MDL-60976 dml: Optimise replace_all_text()
Avoid updating fields that do not match the search string.
2017-12-08 12:35:56 +13:00
sam marshall
ed00d67c99 MDL-60174 core_dml: get_recordset on Postgres eats all the RAM
On Postgres, get_recordset_sql loads all the results into memory
(within the Postgres library, which doesn't count towards the PHP
memory limit, but does count towards making your server run out of
memory) as soon as the query completes.

This commit changes the code to use cursors, which in Postgres
allow the results to be returned in smaller chunks (by default
100,000 rows).
2017-11-27 11:10:29 +00: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
Matteo Scaramuccia
ea34d02d55 MDL-59635 tool_replace: Escape the column name. 2017-09-04 11:46:55 +02: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
Dan Poltawski
afa752eb12 Merge branch 'MDL-57698-master' of https://github.com/xow/moodle 2017-07-25 11:48:09 +01: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
David Monllao
b4e55d3a37 Merge branch 'MDL-59509-master' of git://github.com/andrewnicols/moodle 2017-07-24 13:03:10 +02:00
Dan Poltawski
9c0cdc069b Merge branch 'MDL-59572-master' of git://github.com/andrewnicols/moodle 2017-07-24 09:54:39 +01:00
John Okely
9726144ef3 MDL-57698 sqlsrv: Unit test NOLOCK 2017-07-21 14:41:55 +08:00
John Okely
b540fd1a80 MDL-57698 sqlsrv: Query temp tables with no lock 2017-07-21 14:41:54 +08:00
Andrew Nicols
e879619477 MDL-59509 dml: sqlsrv should respect port setting
Details of how to connect to a specific port are available at
https://docs.microsoft.com/en-us/sql/connect/php/how-to-connect-on-a-specified-port
2017-07-21 13:23:17 +08: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
Andrew Nicols
9790a9b583 MDL-59572 dml: Call error_log for AJAX/WS calls 2017-07-19 12:49:15 +08:00
Marina Glancy
f2b5ed40f9 MDL-58689 dml: prevent logging during setup 2017-04-27 10:07:01 +08:00
David Monllao
996731dded Merge branch 'MDL-45584_master' of git://github.com/markn86/moodle 2017-03-07 12:00:01 +01:00
Russell Smith
f3789f2fb3 MDL-45584 cache: Make identifiers part of the cache creation.
It is now safe to cache a reference to a cache and expect consistent results.

Changing identifiers altered cache results where a reference was
held to the cache. Identifiers have been set to be cached with
identifiers included so the caches are separate.

As a consequence of this it was identified that invalidation events
and identifiers don't easily work together as an event can't determine
which identifiers should be used for cache invalidation.  So invalidation
events have been made incompatible with identifiers being set.  No core
code used this combination as it's not possible to understand any expected
behaviour.

Event invalidation for application and session caches was centralised to the same
location.  The only difference was the name of the lastinvalidation variable. This
improves support and consistency of invalidation code.
2017-03-02 11:06:17 +08:00
Adrian Greeve
8c1288dbdb MDL-48228 database: Unit test addition and update. 2017-03-01 09:03:12 +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
Ankit Agarwal
c14fe2cb03 MDL-57192 dml: Support temporarily disabling query logs during setup 2017-01-03 17:24:21 +05:30
Luke Carrier
6f62abab2c MDL-57143 dml: sqlsrv drivers are going xplat \o/
They're now available on PECL:
    https://pecl.php.net/package/sqlsrv

And the source for the extension is on GitHub:
    https://github.com/Microsoft/msphpsql

Note that they do require installation of unixODBC; relevant
documentation is available for Debian- and RHEL-likes:
* https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu
* https://www.microsoft.com/en-us/sql-server/developer-get-started/php-rhel
2016-12-01 22:08:57 +00:00
Eloy Lafuente (stronk7)
64573a35e9 Merge branch 'MDL-55124' of https://github.com/mr-russ/moodle 2016-09-22 00:52:30 +02:00
Russell Smith
d59f1d3150 MDL-55124 database: Mode connection test to after connection.
To verify the client encoding and other data is correct then
the connection must have been made first.
2016-09-22 08:40:03 +10:00
Eloy Lafuente (stronk7)
ce7863ba36 Merge branch 'MDL-55124' of https://github.com/mr-russ/moodle 2016-09-20 12:13:10 +02:00
Russell Smith
f834a8f5eb MDL-55124 database: Allow option to not send options.
pgbouncer doesn't accept the PostgreSQL options command as it can't
process it.  If you are using pgBouncer you need to make sure your
database is configured to set client encoding and standard_conforming_strings
correctly on each connection.  pgBouncer can do this, as can ALTER
commands.

Also using sockets without a filename did not allow different ports to work.
This is because you either specify a filename which includes a port or
you just specify a port and libpq works out the correct socket location.
2016-09-20 19:53:01 +10:00
Eloy Lafuente (stronk7)
8dcc999d96 Merge branch 'wip-MDL-55827-master' of git://github.com/marinaglancy/moodle 2016-09-20 01:02:06 +02:00
Eloy Lafuente (stronk7)
03d27c303d MDL-29332 tests: Cover the new sql_equal() function
- For CS, CI and AS
- Not for AI (it's not cross-db)
- equal (=) and not equal (<>)
- delete old test_sql_binary_equal() now with cross-db solution.
2016-09-15 16:33:08 +02:00
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
Marina Glancy
308ce5b46f MDL-55827 tests: @ does not suppress wrong number of arguments in php7.1 2016-09-06 15:37:30 +08:00
Dan Poltawski
763c5b0eb4 Merge branch 'MDL-48856' of https://github.com/mr-russ/moodle 2016-08-08 14:45:06 +01:00
Russell Smith
e868574f02 MDL-48856 dmllib: Adjust performance improvements. 2016-07-22 11:52:41 +10:00
Tony Levi
73d37b20ed MDL-48856 pgsql: Performance tuning 2016-07-21 10:31:41 +10:00
Eloy Lafuente (stronk7)
5281e6a082 MDL-52544 oracle: small tweaks
This commit just:

- Moves the null => '' to better place, restricting it to PHP >= 7.0
  (bug https://bugs.php.net/bug.php?id=72524)
- Adds a couple of notes here and there.
- Changes some small details to keep the file using the same coding.
2016-07-19 04:04:32 +02:00
Damyon Wiese
eea2fc4319 MDL-52544 oracle: php7 fixes for oci driver
These are our bugs actually - the oci docs are very clear that bound
params should be in-scope when oci_execute is called - and due to pass by value etc,
this was not true for our driver.

There is another bug that needed fixing - OCI barfs if null values are bound - this
can be avoided by setting them to '' which oci treats as null.

And finally - all our lob/clob/blob hacks were also binding to local "out-of-scope" vars.
2016-07-12 16:55:47 +08:00
Russell Smith
1b0b082a08 MDL-54947 database: Update PostgreSQL binary handling.
PostgreSQL 9.1 allows hex formating for binary which is handled better
by pg_query_params().

Getting bytea isn't required on connection, it can be used as pg_field_type()
when binary needs to be checked.
2016-06-30 12:58:53 +10: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
David Monllao
a696bb9ebd MDL-51374 dml: Identifying the cache with connection data 2016-03-16 17:17:39 +08:00