From 6df56bc473db19e478712cdc7dd3e75f9164ecc3 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 30 Oct 2006 23:13:48 +0000 Subject: [PATCH] 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 --- lib/dmllib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/dmllib.php b/lib/dmllib.php index 1b71a6ada0..e95d236edc 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -1202,7 +1202,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') { } /// End DIRTY HACK -/// Under Oracle we have our own insert record process +/// Under Oracle and MSSQL we have our own insert record process /// detect all the clob/blob fields and change their contents to @#CLOB#@ and @#BLOB#@ /// saving them into $foundclobs and $foundblobs [$fieldname]->contents /// Same for mssql (only processing blobs - image fields) @@ -1912,7 +1912,11 @@ function db_detect_lobs ($table, &$dataobject, &$clobs, &$blobs, $unset = false, continue; } /// If the field is CLOB, update its value to '@#CLOB#@' and store it in the $clobs array - if (strtoupper($columns[strtolower($fieldname)]->type) == $clobdbtype) { // && strlen($dataobject->$fieldname) > 3999 + if (strtoupper($columns[strtolower($fieldname)]->type) == $clobdbtype) { + /// Oracle optimization. CLOBs under 4000cc can be directly inserted (no need to apply 2-phases to them) + if ($db->dbtype = 'oci8po' && strlen($dataobject->$fieldname) < 4000) { + continue; + } $clobs[$fieldname] = $dataobject->$fieldname; if ($unset) { unset($dataobject->$fieldname); @@ -1923,7 +1927,7 @@ function db_detect_lobs ($table, &$dataobject, &$clobs, &$blobs, $unset = false, } /// If the field is BLOB OR IMAGE, update its value to '@#BLOB#@' and store it in the $blobs array - if (strtoupper($columns[strtolower($fieldname)]->type) == $blobdbtype) { // && strlen($dataobject->$fieldname) > 3999 + if (strtoupper($columns[strtolower($fieldname)]->type) == $blobdbtype) { $blobs[$fieldname] = $dataobject->$fieldname; if ($unset) { unset($dataobject->$fieldname); -- 2.39.5