Commit Graph

294 Commits

Author SHA1 Message Date
mjollnir_ 18c26f97ef Fixing bug 3977: sort of. Check for mysql >= 4 or postgres, do a smarter query with a UNION. Otherwise, do the same old query. This is not very good for mysql 3.23 users with large datasets, but not much else I can do. 2005-08-31 23:57:37 +00:00
martinlanghoff 8a9e5ac327 Long-pending rollback_sql() 2005-08-26 03:57:30 +00:00
mjollnir_ 289cf90737 Fixing another postgres problem. With distinct, you can't order by a field not in the select field list 2005-08-25 00:02:49 +00:00
mjollnir_ cef4a0e828 Fixing typo in postgres-fixing patch from a couple days ago 2005-08-24 23:47:51 +00:00
mjollnir_ 05746e64f2 Fixing a postgres error. You can't sort by a field that isn't in the select list when you have distinct 2005-08-17 23:16:34 +00:00
patrickslee 83847ae5b1 Fixed a serious bug in table_column() that modified column not having NOT NULL for postgres 2005-08-11 23:50:13 +00:00
mjollnir_ 04f1658794 When fetching child courses for a metacourse, order by shortname (unless just counting) 2005-08-11 04:24:15 +00:00
defacer b586f7cda2 All this time, table_column() didn't handle CHAR fields correctly! :o 2005-07-20 17:42:55 +00:00
patrickslee 9021f8168a Fixed when $cm is NULL, postgres still reports error. From HEAD 2005-07-18 22:41:48 +00:00
skodak 0c2a8be918 fixed bug 3606, thanks Ilshat Fattakhov 2005-07-10 17:30:32 +00:00
mjollnir_ 61cf7b168b html_entity_decode segfaults in php 4.3.1 on an empty variable... documented in bug 3508. credit: Eloy & Jose Luis Daz 2005-06-16 02:57:58 +00:00
moodler 27437410f4 file survey.php was added on branch MOODLE_15_STABLE on 2006-03-10 07:27:54 +0000 2005-04-05 20:54:43 +00:00
mjollnir_ 824f1c40fc cache category_parent_visible so as to avoid doing millions of database queries 2006-01-17 23:46:42 +00:00
mjollnir_ 185cfb095b Reworked the My Moodle course overview API to be MUCH more efficient.
Previously we were literally doing hundreds of database queries, now it's
very much faster.
This makes the API slightly more complicated, but it's definitely worth it!
Each module should implement modname_print_overview, which takes an array of courses
and an array to fill up indexed by [$courseid]['modname'] for the controller to loop through and print.
Each module should LIMIT the number of queries to use, all module instances can be fetched
with the new function get_all_instances_in_courses which is the same as get_all_instances_in_course
but takes an array of courses to fetch the instances for.  This means there is no need to loop
over the courses array and fetch the instances for each course (dramatically cutting down the number of queries!)
2006-01-17 20:49:43 +00:00
stronk7 ff4651e6e5 Part of Bug 4583. Now insert_record() always unset the primary key
(instead of the first, non-cached, invocation). Also, modified one
condition with no sense now. Needs testing (specially from PostgreSQL,
although it should work and the bug would be solved.
(http://moodle.org/bugs/bug.php?op=show&bugid=4583)
2006-01-16 10:36:59 +00:00
martinlanghoff 18147bc254 lib/datalib.php - fixed missing return and global $CFG
Tidyup after merging Tim Hunt's patches.
2006-01-16 06:35:58 +00:00
martinlanghoff d53c5dfc63 lib/datalib.php: Fixed a problem that get_recordset() does not return results
Author: Patrick Li <patrick@catalyst.net.nz>
2006-01-16 06:26:47 +00:00
martinlanghoff eb856e3b4d lib/datalib.php [5/6] Make other methods that obtain a record set use the
appropriate get_recordset* function, instead of duplicating
code.

Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:24:53 +00:00
martinlanghoff 26c0a58702 lib/datalib.php [5/6] Make the get_records*_menu family of functions use the
get_recordset* functions, instead of duplicating code.


Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:23:17 +00:00
martinlanghoff 9b277c0d80 lib/datalib.php [4/6] Make the get_records* family of functions use the
get_recordset* functions, instead of duplicating code.

Note: I've replaced the @deprecated tokens in phpdoc with an indication
that the get_records* calls are valid as convenience calls. The
get_recordset*() calls should be considered for performance and memory
footprint, but are not mandatory.

In a sense, deprecating get_records*() would mean a commitment to remove
them within X number of versions, which I am not sure we will do. Now,
if phpdoc has a @discouraged token, I'd like to hear about it ;-)

Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:17:38 +00:00
martinlanghoff 1184063286 lib/datalib.php [3/6] Move all instances of code that processes the
(..., $field1, $value1, $field2, $value2, $field3, $value3, ...)
part of argument lists to a common method, and improve the
comments relating to those arguments on calling methods.

Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:07:57 +00:00
martinlanghoff 0934b9def8 lib/datalib.php [2/6] Version of Martin Langhoff's patch to add the get_recordset_*
family of methods.

Author: Martin Langhoff <martin@catalyst.net.nz> && Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:05:43 +00:00
martinlanghoff d4c54cd6a6 lib/datalib.php [1/6] Remove unreachable code (break statements after returns in switches).
Author: Tim Hunt <T.J.Hunt@open.ac.uk>
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
2006-01-16 06:04:09 +00:00
martinlanghoff 061fb2e7c3 datalib: teach moodle to pull an array from a column
the new get_fieldset_sql() gets around the nastiness in get_recordset()
that treats the first column as the unique key of the recordset. You can
now request a column from a table, or a set of values as a set of 1 field
records.
2006-01-16 03:07:23 +00:00
mjollnir_ fbcbd77c85 Fixing bug # 4567: warning in get_my_courses 2006-01-12 02:55:59 +00:00
patrickslee 0986271ba2 Moved the new functions added for Bug #4074 to datalib.php 2005-12-13 19:31:48 +00:00
patrickslee 7fb0fec757 Fixed courses and subcategories in an invisible category being visible (Bug #4074)
This patch is different from the one form MOODLE_15_STABLE as it used the stored path in category data.
2005-12-13 04:05:04 +00:00
moodler 81532b92f2 Merged bug 4351 fix from stable 2005-11-19 15:39:31 +00:00
mjollnir_ 1b4fe47b08 Merged from MOODLE_15_STABLE: Pulling in a missing global CFG in datalib:execute_sql (affects CFG->dblogerror) 2005-11-17 02:27:05 +00:00
moodler fa22fd5fff BIG FEATURE - MULTIPLE GROUPS
Users can now be assigned to multiple groups.  Thanks Yu!
Break out the Bob Marley!!

Otherwise groups work more or less like they did before.

This has been pretty well tested by Yu and myself, but since Yu started
uncovering lots of existing groups bugs it's possible there may be still
a few corner cases still lurking here and there.

Please help test this thoroughly for 1.6!!
2005-11-08 07:19:27 +00:00
moodler a2bed05944 Fix for bug 4242/4243. Optimize insert_record. 2005-10-31 06:25:17 +00:00
mjollnir_ 3ec22e352c Merged from MOODLE_15_STABLE: merging check_db_compat function for backwards compatability (just in case) 2005-09-01 00:28:45 +00:00
martinlanghoff c54a59435c Merged from MOODLE_15_STABLE - Long-pending rollback_sql() 2005-08-26 04:02:06 +00:00
mjollnir_ 5b66416fe9 Merged from MOODLE_15_STABLE: Fixing another postgres problem. With distinct, you can't order by a field not in the select field list 2005-08-25 00:03:14 +00:00
mjollnir_ d5efb299de Merged from MOODLE_15_STABLE: Fixing typo in postgres-fixing patch from a couple days ago 2005-08-24 23:48:12 +00:00
mjollnir_ c1147b7efe merged from MOODLE_15_STABLE: Fixing a postgres error. You can't sort by a field that isn't in the select list when you have distinct 2005-08-17 23:17:05 +00:00
mjollnir_ f41ef63ee6 materialized path & depth for course categories. 2005-08-16 23:15:58 +00:00
patrickslee 7c56e42da0 Fixed a serious bug in table_column() that modified column not having NOT NULL for postgres (merged from 15_STABLE) 2005-08-11 23:52:11 +00:00
mjollnir_ 5afa0de677 Merged from MOODLE_15_STABLE: When fetching child courses for a metacourse, order by shortname (unless just counting) 2005-08-11 04:24:57 +00:00
defacer 2ecdff7894 Merging from STABLE:
All this time, table_column() didn't handle CHAR fields correctly! :o
2005-07-20 17:47:05 +00:00
patrickslee 7a5b1fc555 Fixed when $cm is NULL, postgres still reports error. 2005-07-18 22:21:56 +00:00
dhawes 7290c7faf2 phpdoc work 2005-07-12 02:23:58 +00:00
skodak 9a4d45aea4 fixed bug 3606, thanks Ilshat Fattakhov; merged from MOODLE_15_STABLE 2005-07-10 17:32:03 +00:00
mjollnir_ 10a760b9b2 Merged from MOODLE_15_STABLE: html_entity_decode segfaults in php 4.3.1 on an empty variable... documented in bug 3508. credit: Eloy & Jose Luis Daz 2005-06-16 02:58:24 +00:00
martinlanghoff 31df0bb83c Merged from MOODLE_14_STABLE - Better DB errors debug traces from Patrick Li 2005-05-19 21:59:00 +00:00
martinlanghoff 9feb9a19d6 Typo in table_column() breaks field renaming under postgres -- credit for the patch goes to Patrick Li 2005-05-19 05:08:03 +00:00
mjollnir_ acd2279e54 Merged from MOODLE_14_STABLE: SQL errors are now (optionally -- defaults to off) logged to the apache error log. Helps debugging! Credit: Patrick Li <patrick@catalyst.net.nz> 2005-05-11 23:34:46 +00:00
paca70 9c8513599b handle tinyints as integers when using postgresql 2005-04-27 19:24:48 +00:00
moodler 705a2aa45c Reverting Jon's change 2005-04-22 06:24:57 +00:00
defacer d290029084 Correcting the behavior of update_record.
Fixes bug 2776.
2005-04-22 03:43:09 +00:00