77 Commits

Author SHA1 Message Date
martinlanghoff
02d3b34a8e rcache_getforfill() - better phpdoc 2006-12-27 22:55:12 +00:00
martinlanghoff
3530015874 rcache functions -- use a saner memory cache API
Push into the $MCACHE object
 - dealing with getforfill() nuances
 - dealing with moodle-host prefixes
2006-12-27 22:46:31 +00:00
martinlanghoff
ec9fe5cf6f rcache_set() and rcache_table_unset(): use a configurable TTL 2006-12-27 22:45:47 +00:00
martinlanghoff
c96a4a46d5 rcache_* calls - flesh out logic and use $MCACHE if available
- move from $CFG->enablerecordcache <count> to $CFG->rcache <type>

 - if $CFG->rcache === 'internal' use the cache array
   otherwise, attempt to use $MCACHE

 - implement and use rcache_getforfill() to catch thundering herds

 - the cache lifetime is hardcoded to 2s until we understand better the
   possible race conditions against updates that are not happening via
   update_record() / delete_record()
2006-12-27 22:40:38 +00:00
martinlanghoff
6c2f585f85 dmllib: introducing the rcache_* functions for record cache handling
Abstracted Sam's initial work with $record_cache into a series of functions
that abstract things _just enough_ that we can use an internal
in-memory-array implementation or something that is shared across
processes, like memcached or the turckmmcache/eaccelerator caches.

Also
- added hit/miss stats tracking and reporting
- removed max entries limiting as it was buggy - var names mismatches
  and not counting unset()s
2006-12-27 22:39:32 +00:00
sam_marshall
ad9947a857 MDL-7969 Documented requirement for first column in get_records_sql etc to be a unique field such as id. 2006-12-18 13:54:31 +00:00
tjhunt
0dae5d33a7 MDL-7926 - set_field_select function. Merged from MOODLE_17_STABLE. 2006-12-15 18:23:31 +00:00
stronk7
c54f0c106a Prevent some false-positives detecting uses of old user_XXX tables.
See http://moodle.org/mod/forum/discuss.php?d=58976

Merged from MOODLE_17_STABLE
2006-11-18 20:28:00 +00:00
skodak
810944af7f we are going 100% unicode now - removed use of $CFG->unicodedb and current_charset(); MDL-7439 - part 2, only hotpot and wiki left 2006-11-11 17:23:20 +00:00
stronk7
3eda2b3a7e modify_database() will show the deprecated debugging after 2006101007
(Moodle 1.7 release version) MDL-5919
2006-11-05 09:45:19 +00:00
stronk7
6c279afaef Now all the get_records() functions support only one field
to be specified in the SELECT clause. Not needed anymore to
write double "SELECT id, id..." queries. Results returned
follow exactly the same structure than normal recordsets
(first field = key) MDL-5877

Merged from MOODLE_17_STABLE
2006-11-04 17:01:34 +00:00
stronk7
bb5b7329bb Deprecating modify_database(). It shows debugging info
if release > 2006101004 (Beta2 +01) MDL-5919

Merged from MOODLE_17_STABLE
2006-11-04 16:22:49 +00:00
sam_marshall
2af5513789 MDL-7346 Changed enablerecordcache to be a limit for the size of cache, not just an on/off switch. 2006-11-03 17:29:15 +00:00
stronk7
6df56bc473 Oracle optimization. Texts under 4000cc can be handled directly as varchar2,
so they don't need the 2-phase (insert/update) handling of LOBs

Merged from MOODLE_17_STABLE
2006-10-30 23:13:48 +00:00
stronk7
18fcece954 Fixed one bug on Oracle produced when we were inserting
records with returnid disabled and containing LOBs

Merged from MOODLE_17_STABLE
2006-10-30 22:59:49 +00:00
stronk7
06edab84e1 New function sql_substr() returns the proper substr() function for each DB
Merged from MOODLE_17_STABLE
2006-10-30 18:31:08 +00:00
stronk7
db3df7266a Deprecating sql_as (now the AS keyword is required in COLUMN aliases)
Merged from MOODLE_17_STABLE
2006-10-30 17:41:55 +00:00
stronk7
b716e2e069 Now record_cache is controlled by $CFG->enablerecordcache
Merged from MOODLE_17_STABLE
2006-10-28 19:56:34 +00:00
stronk7
2fd40f8cbe Moved cache cleaning code near the begin of functions. Sometimes
it wasnt' executed due to function ending. MDL-7196

Merged from MOODLE_17_STABLE
2006-10-28 17:53:00 +00:00
stronk7
4bfb64aad2 Counting extra updates performed by Oracle & MSSQL in PERF 2006-10-27 17:49:25 +00:00
stronk7
068744a7a5 I forgot to globalize $record_cache in delete_record_XXX() functions.
Merged from MOODLE_17_STABLE
2006-10-27 17:14:58 +00:00
stronk7
9d98635b5e Minor improvements to the get_record() cache. Part of MDL-7196
1) Check the cache issset() before unset() it.
2) In the set_field() function, if fieldX = 'id',
   just delete such element from the cache,
   else the whole table
3) Add some more unset() operations against the cache in
   the delete_xxxx() dmllib functions.

Merged from MOODLE_17_STABLE
2006-10-27 16:56:34 +00:00
toyomoyo
4bda5c717c merged, taking care of a warning 2006-10-27 02:15:02 +00:00
moodler
92309430b8 Merged get_record caching from MDL-7196 in stable (thanks sam!) 2006-10-26 07:57:07 +00:00
stronk7
92602651dc Now insert_record() is using $db->GenID() to retrieve
sequence numbers for Oracle. Just wondering if the same
function should be used by PostgreSQL too. MDL-7183

Merged from MOODLE_17_STABLE
2006-10-23 17:46:08 +00:00
stronk7
f96a5db1c4 strip "old" harcoded "limit" clauses from the sql passed and
debug about them. MDL-7173

Merged from MOODLE_17_STABLE
2006-10-23 07:46:10 +00:00
stronk7
b9c3b8c734 Prevent MSSQL to return from insert_record() before
trying to execute the updating of LOBs.

Merged from MOODLE_17_STABLE
2006-10-23 00:01:57 +00:00
stronk7
c1bf1b0073 Debugging sql_paging_limit() as deprecated and
enforcing get_field_sql() to return 1 record max

Merged from MOODLE_17_STABLE
2006-10-22 23:21:59 +00:00
stronk7
cb4c207832 Adding limitfrom and limitnum parameters to a bunch of
rarely executed functions...

Merged from MOODLE_17_STABLE
2006-10-22 22:37:30 +00:00
stronk7
1afef7d9b3 Now insert/update/set of BINATY fields is supported by MSSQL
(and easier to add new DB in the furure) MDL-7062

Merged from MOODLE_17_STABLE
2006-10-17 23:37:58 +00:00
stronk7
e45346f98e Fixed typo that was preventing correct BLOB storage under Oracle.
Merged from MOODLE_17_STABLE
2006-10-17 18:31:56 +00:00
stronk7
6b7be6d74f Now set_field() supports Oracle LOBs. Better error handling of oracle_update_lobs()
Merged from MOODLE_17_STABLE
2006-10-15 20:21:27 +00:00
stronk7
73ad2d0c29 Now update_record() supports LOBs under Oracle. Plus prevent empty objects to be updated.
Merged from MOODLE_17_STABLE
2006-10-15 19:40:33 +00:00
stronk7
1a8078073e Minor changes + debug info in UpdateXlob()
Merged from MOODLE_17_STABLE
2006-10-15 18:37:01 +00:00
stronk7
b825e563c0 - Introducing the first version of the new mssql_n adodb driver (not finished, just for experimenting).
- Now insert_record() is handling Oracle CLOBS and BLOBS properly (really annoying the number of hacks needed).
- Creating one new global object to cache $db->MetaColumns() calls per request, because it's being used
in a lot of places inside dmllib.
TODO: hack update_record() and set_field() to allow Oracle LOBs
      enclose all the Oracle function calls into one db transaction

Merged from MOODLE_17_STABLE
2006-10-15 16:41:55 +00:00
stronk7
97ab73aad4 Add odbc_msql dbtype to a bunch of places. 2006-10-09 22:55:55 +00:00
stronk7
5fbab6173a Now Oracle uses the new find_sequence_name() function to find the
correct sequence name for each table on insert.

Also, introduced initial hooks to support Oracle LOBs in insert_record()
2006-10-08 09:58:11 +00:00
moodler
937b63ee52 Adding some serious checks to make Moodle break when there is any
select, insert or update on user_students, user_teachers, user_coursecreators,
or user_admins (once roles is installed), because they should not be used
at all and we will drop them soon.
2006-10-01 09:16:49 +00:00
stronk7
66841aed29 One wrong use of onespace2empty() - an strange function - :-/
in the DIRTY HACK was causing not info to be returned under Oracle
by the get_field_sql() function, so sequence numbers were broken.
2006-09-26 18:27:44 +00:00
skodak
6de2a7b6c8 fixed another missing global $CFG 2006-09-26 08:49:47 +00:00
skodak
05f8f7e76b fixed missing global $CFG 2006-09-26 06:31:18 +00:00
martinlanghoff
1e7368e782 dmlib: set_field() now has the Oracle DIRTY HACK too! 2006-09-26 05:10:39 +00:00
martinlanghoff
5a55af6097 dmlib: Add Oracle dirty hack cleanup to recordset_to_menu() get_field_sql() and get_fieldset_sql()
This covers most (all?) the gaps in data retrieval except get_recordset_sql().

To tackle get_recordset_sql,  where the actual data retrieval is done within
AdoDB, we would have to to wrap around AdoDB with a subclass, but that would
be dirty, dirty, dirtier.
2006-09-26 05:10:18 +00:00
martinlanghoff
44f9885044 sql_concat(): fixed param order thinko -- and now it works too! 2006-09-26 05:09:48 +00:00
martinlanghoff
95008f81c6 sql_ilike() -- added notes on Oracle support or lack thereof 2006-09-26 05:07:28 +00:00
martinlanghoff
38e02f4c32 Introducing sql_concat_join($sep, $array) helper
returns the SQL to do the equivalente of a join() or implode()
on the DB server. Watch the RDBMS work! ;-)
2006-09-26 05:05:54 +00:00
martinlanghoff
0ce96669c9 Introducing sql_concat() - and use it in sql_fullname()
sql_concat() is just a passthrough to $db->Concat() -- it doesn't
add any value, and I think the dispatching is somewhat expensive.

Just using $db->Concat() should be good enough, were it not for
consistency in our DM API.
2006-09-26 05:02:59 +00:00
mjollnir_
6e58026b29 recredited the sql_primary_role_subselect function to correct author (much as I would like to claim it) 2006-09-26 04:41:45 +00:00
moodler
867f5adb73 Moved Penny's funky sql function into dmllib.php 2006-09-26 04:33:59 +00:00
stronk7
f46e2c8cbc Changed one LIMIT to a cross-db WHERE clause 2006-09-24 09:59:25 +00:00