137 Commits

Author SHA1 Message Date
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
stronk7
2a2905fb6f Now using ADOdb standard transactions. Some day, we should switch to
Smart Transactions (http://phplens.com/adodb/tutorial.smart.transactions.html)
as they autodetect errors and are nestable and easier to write
2006-09-22 20:05:44 +00:00
stronk7
94e65cc36c Now all the insert_record() and update_record() calls under
Oracle DB use the oracle_dirty_hack() function to transform
empty strings into something different ' ' in order to avoid
the problems with the empty=NULL stupid norm of Oracle.

With this change, Oracle installation works completely.

Now we need to implement everywhere the opposite hack: transforming
all those ' ' (1 whitespace) back to the '' (empty string). Working
on it now.
2006-09-21 18:30:50 +00:00
stronk7
0ce61c841f Force ANSI NULLs under mssql. It's not critical to work
but it avoids some problems when changing nullability
of fields in the future.
2006-09-21 07:44:56 +00:00
skodak
eef868d17d major whitespace cleanup - fixed trailng whitespace in new files and admin area 2006-09-20 21:00:45 +00:00
skodak
daa588aa52 merged changes in moodlelib.php from MOODLE_16_STABLE 2006-09-20 18:40:22 +00:00
martinlanghoff
d7e901c669 dmlib: changed array access to keyed instead of ordinal.
This supports the move to ADODB_FETCH_ASSOC instead of ADODB_FETCH_BOTH.
see:
http://docs.moodle.org/en/XMLDB_Problems#ADOdb_fetch_mode_.28ASSOC.2C_NUM_and_BOTH.29

Author: Luke Hudson <luke@catalyst.net.nz>
2006-09-20 11:26:47 +00:00
vyshane
3d5fb99f00 Fixed bug in get_records_sql(). This call:
$rs = get_recordset_sql($sql, $limitfrom='', $limitnum='');

should really be:

$rs = get_recordset_sql($sql, $limitfrom, $limitnum);
2006-09-15 06:03:32 +00:00
moodler
ea82d6b638 CHanged a lot of CFG->debug stuff to use the new debuggin() function 2006-09-13 09:45:07 +00:00
moodler
3d1885af1e Added some checking that should not be necessary but I had notices in one extreme situation 2006-09-13 08:09:18 +00:00
stronk7
83a78d9d17 PHPDoc update. 2006-09-10 18:37:57 +00:00
stronk7
5f45d2ae80 New function sql_order_by_text() to automatically build
custom expresions to being used in ORDER BY clauses with
TEXT columns.
2006-09-09 13:51:40 +00:00
stronk7
e20d180c11 DIRTY HACK to convert back all the ' ' (1 space) field contents
back to '' (empty string) in order to allow Oracle to work, more
or less until all the not real NOT NULL DEFAULT '' fields were out!

TODO: Apply the same hack to some more functions...
2006-09-07 23:48:48 +00:00
stronk7
3c4f35e645 Mark as deprecated the sql_paging_limit_function() 2006-09-05 21:42:20 +00:00
stronk7
3c242a66f5 Now get_records_sql() supports limitfrom and limitnum.
Required to kill all those hardcoded LIMIT x,y clauses.
2006-09-05 18:53:08 +00:00
stronk7
95f610334e Mark two functions as deprecated because that's standard now. 2006-09-04 22:40:42 +00:00
stronk7
fda5418401 $CFG required. 2006-09-04 22:30:56 +00:00
stronk7
4762bff7a3 Added the feedback attribute to the execute_sql_arr() function. 2006-09-03 17:56:34 +00:00
stronk7
228d8c20d7 New function execute_sql_arr() to execute arrays of
statements, Used by ddllib.php mainly.
2006-09-02 23:46:43 +00:00
stronk7
d32d63b6e0 Now record_exists_sql() uses the cross-db limit implementation. 2006-09-01 18:33:19 +00:00
stronk7
8351e29517 Introduced one function to calculate the proper "AS"
keyword for columns. All DB seems to support it but
PostgreSQL require it!
2006-09-01 17:45:02 +00:00
stronk7
3655a6b39f Set magic_quotes_sybase for both mssql and oci8po.
Anyway, this isn't enough and if must be defined in php.ini
or .htaccess, because GPC are added BEFORE this setting
has effect so they are slashed with the default char.
2006-08-27 21:57:33 +00:00
stronk7
d1c21c8f31 Very, very, very, very initial support of insert_record for oracle.
I shouldn't interfere with the rest at all. I needed it in CVS now.
2006-08-27 09:02:41 +00:00
stronk7
7e8f922047 Adding back the first column in the recordset, that is out after GetAssoc(),
in order to:

- Don't get our first named column under some drivers.
- Be able to migrate to ADODB_FETCH_ASSOC soon.

For more info, http://docs.moodle.org/en/XMLDB_Problems,
in the  ADOdb fetch mode (ASSOC, NUM and BOTH) section.
2006-08-26 00:08:11 +00:00
stronk7
d086d854a8 Added the configure_dbconnection() function to be executed
after DB conection. Responsible to set a lot of things
(charsets, dbsession variables...)
2006-08-20 18:21:33 +00:00
stronk7
293bccd539 First commit for the progressive adoption of ADODB's SelectLimit() function
in order to support LIMIT clauses in a cross-db compatible way.
Changes don't affect old sentences at all (all them would be changed soon too).
2006-08-20 09:37:56 +00:00
moodler
9f948d1136 Just minor doc tweaks 2006-08-19 02:58:07 +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