}
}
-/// First basic support of insert for Oracle. As it doesn't
-/// support autogenerated fields, we rely on the corresponding
-/// sequence. It will work automatically, unless we need to
-/// return the primary from the function, in this case we
-/// get the next sequence value here and insert it manually.
- if ( $CFG->dbtype === 'oci8po' && $returnid == true) {
+/// Begin DIRTY HACK
+ if ($CFG->dbtype == 'oci8po') {
+ oracle_dirty_hack($table, $dataobject); // Convert object to the correct "empty" values for Oracle DB
+ }
+/// End DIRTY HACK
+
+/// Under Oracle 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)
+ if (($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'odbc_mssql' || $CFG->dbtype == 'mssql_n')) {
+ $foundclobs = array();
+ $foundblobs = array();
+ db_detect_lobs($table, $dataobject, $foundclobs, $foundblobs);
+ }
+
+/// Under Oracle, if the primary key inserted has been requested OR
+/// if there are LOBs to insert, we calculate the next value via
+/// explicit query to the sequence.
+/// Else, the pre-insert trigger will do the job, because the primary
+/// key isn't needed at all by the rest of PHP code
+ if ( $CFG->dbtype === 'oci8po' && ($returnid == true || !empty($foundclobs) || !empty($foundblobs))) {
/// We need this here (move this function to dmlib?)
include_once($CFG->libdir . '/ddllib.php');
$xmldb_table = new XMLDBTable($table);
}
}
-/// Begin DIRTY HACK
- if ($CFG->dbtype == 'oci8po') {
- oracle_dirty_hack($table, $dataobject); // Convert object to the correct "empty" values for Oracle DB
- }
-/// End DIRTY HACK
-
-/// Under Oracle 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)
- if (($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'odbc_mssql' || $CFG->dbtype == 'mssql_n')) {
- $foundclobs = array();
- $foundblobs = array();
- db_detect_lobs($table, $dataobject, $foundclobs, $foundblobs);
- }
-
/// Get the correct SQL from adoDB
if (!$insertSQL = $db->GetInsertSQL($rs, (array)$dataobject, true)) {
return false;