Commit graph

366 commits

Author SHA1 Message Date
stronk7
94ef00f3bb MSSQL and Oracle don't want DISTINCT clauses over TEXT/BINARY fields.
In this case, we simply delete it because SELECT g.* guarantees unique
records to be retrieved by the first field.
2006-09-04 22:05:58 +00:00
stronk7
fea43a7f51 Casting $course->modinfo to string prevents one notice to
be showed when it's null, returning false as desired.
2006-09-04 21:12:37 +00:00
toyomoyo
20aeb4b8e3 utf8 migrate support for site with roles active, resolved isstudent legacy problem, implemented $CFG->notloggedinroleid 2006-09-01 09:25:34 +00:00
stronk7
7e13be0887 Splitting datalib.php in three libraries:
- ddllib.php: Where all the DDL (install/upgrade) functions will be.
  - dmllib.php: Where all the DML (select...) functions will be.
  - datalib.php: Legacy lib. Its contents should go to other libraries soon.
For more info see: http://docs.moodle.org/en/XMLDB_Roadmap (point 1)
2006-08-18 22:56:08 +00:00
tjhunt
5553c2ec47 New function record_exists_select with unit tests for all the record_exists_* functions. 2006-08-18 11:28:30 +00:00
tjhunt
cfa27f4472 Fix bug in new function get_field_select(), and this time add a unittest to see if the new function works! 2006-08-17 16:28:29 +00:00
tjhunt
ab757152ec New function get_field_select(). 2006-08-15 13:44:22 +00:00
tjhunt
78b26f761c Typo in comment. 2006-08-10 15:44:52 +00:00
tjhunt
dba4e6da97 Document table_column. 2006-08-09 17:46:16 +00:00
skodak
f9d5371b28 new function get_coursemodule_from_id() is now used for obtaining of valid $cm from coursemodule id SC#283 2006-08-08 22:09:55 +00:00
moodler
fa145ae1af Merged fixes from stable 2006-07-19 10:21:52 +00:00
martinlanghoff
2338ad3239 Close Bug #5670 - get_courses_page() - remove costly and redundant DISTINCT
get_courses_page() uses get_records_sql() which means that it will actually
break if the first field requested isn't c.id. This in turn means that
the DISTINCT is not needed at all.

So let's go fast again!
2006-07-18 04:39:01 +00:00
moodler
418b4e5a5f Merged new variable $CFG->allowvisiblecoursesinhiddencategories from stable 2006-07-13 14:18:29 +00:00
tjhunt
a36f058e53 Bug 6101 - Automatically scroll to any errors when upgrading the database. JavaScript thanks to Andrew Walker. PHP changes are my fault. 2006-07-13 09:48:56 +00:00
tjhunt
3ef8c9362d Bug #5979 - Check in the OU's unit testing framework. Docs at http://docs.moodle.org/en/Unit_tests 2006-06-30 14:59:05 +00:00
tjhunt
3fae19dd98 Bug #5810 missing ' > 7' in debug test. Merged from MOODLE_16_STABLE. 2006-06-13 14:37:45 +00:00
stronk7
d96466d29f Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)

Merged from MOODLE_16_STABLE
2006-06-09 10:04:43 +00:00
stronk7
ee6e91d4af make_default_scale() now searches properly under
both dataroot and dirroot, defaulting to en_utf8. Bug 5719.
(http://moodle.org/bugs/bug.php?op=show&bugid=5719)


Merged from MOODLE_16_STABLE
2006-06-04 15:19:05 +00:00
moodler
152a90601b Merged fixes from stable (undoing category visibility changes) 2006-05-02 07:56:25 +00:00
toyomoyo
5bce15857e added a comment 2006-04-18 03:45:23 +00:00
moodler
c204f5fea1 Made the empty recordset array cache global, so that various functions can
manipulate it.    See bug 5077.
2006-04-11 07:43:05 +00:00
moodler
d9d282e493 Fixing some documentation.
get_records etc are not inefficient if used correctly, and result in MUCH
more readable code that get_recordset does.

I'm already starting to see code being submitted that takes these
instructions literally and it looks like Java.  :-(
2006-04-06 15:26:44 +00:00
stronk7
475e9de86f SITE and SITEID were calculated *before* 'set names' so they weren't
fetched properly from DB. Moving such block of code from datalib.php
to setup.php to execute it *after* 'set names'. Credit goes to Skodak B-)
2006-03-29 23:38:46 +00:00
moodler
f07fa64418 Of $COURSE you can't redefine constants :) 2006-03-29 17:56:35 +00:00
moodler
8a58a8e17f Starting the global COURSEID.
require_login seems to be the best place to capture this, however
I'm sure there are a few little places where it won't work.

We need to hunt these places down and fix them, because I would
like to rely on COURSEID and remove all the "global $course" hacks
that are floating around.

Probably later we need the full object $COURSE as well (to match $SITE)
2006-03-29 15:38:29 +00:00
tjhunt
f76648809e Clarify doc comment. 2006-03-21 14:09:55 +00:00
moodler
ba6602f8da Old change, just removing a comment 2006-03-21 09:08:16 +00:00
gustav_delius
43a602a7a6 Small correction to comment 2006-03-19 12:19:49 +00:00
tjhunt
d2176fb2f1 For some arguments, get_record_sql could fail only with debug off, then no error message is shown and it is hard to debug. Now the code is more similar between debug on/off, which should make debugging easier. 2006-03-13 17:07:38 +00:00
tjhunt
e8395a09f4 Added a comment to explain that add_to_log is the way it is for performance reasons. 2006-03-13 10:37:21 +00:00
skodak
df1931578a password handling refactoring and added conversion of passwords to unicode 2006-03-11 11:26:36 +00:00
patrickslee
6442124426 Add update_record() postgres bytea support
To get ready for the postgres utf8 migration script
2006-03-10 03:32:48 +00:00
gustav_delius
1bc28beba0 Improved the comment for set_field() 2006-02-15 12:13:20 +00:00
mjollnir_
3a11c548b2 Fixing a warning in debug mode 2006-02-14 02:01:31 +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