From f3700f8cb3ac9c1208c4fa8a9de8326296a4632b Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 26 Jun 2008 18:27:22 +0000 Subject: [PATCH] Adding new sql_null_from_clause() helper function from 19_STABLE. MDL-13861 --- lib/dml/moodle_database.php | 9 +++++++++ lib/dml/oci8po_adodb_moodle_database.php | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index ab06ee7226..b4cfe68b70 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -1199,6 +1199,15 @@ abstract class moodle_database { return '((' . $int1 . ') ^ (' . $int2 . '))'; } + /** + * Returns the FROM clause required by some DBs in all SELECT statements + * To be used in queries not having FROM clause to provide cross_db + * Most DBs don't need it, hence the default is '' + */ + public function sql_null_from_clause() { + return ''; + } + /** * Returns the SQL to be used in order to CAST one CHAR column to INTEGER. * diff --git a/lib/dml/oci8po_adodb_moodle_database.php b/lib/dml/oci8po_adodb_moodle_database.php index bc756f7cc5..52ce5c7d41 100644 --- a/lib/dml/oci8po_adodb_moodle_database.php +++ b/lib/dml/oci8po_adodb_moodle_database.php @@ -166,6 +166,10 @@ class oci8po_adodb_moodle_database extends adodb_moodle_database { return '((' . $int1 . ') # (' . $int2 . '))'; } + function sql_null_from_clause() { + return ' FROM dual'; + } + public function sql_cast_char2int($fieldname, $text=false) { if (!$text) { return ' CAST(' . $fieldname . ' AS INT) '; -- 2.39.5