From: stronk7 Date: Mon, 28 Sep 2009 10:27:24 +0000 (+0000) Subject: MDL-17491 oci native driver: prevent get_columns() to execute huge queries X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=21e4f4b2127fa46af9d6ac2d0ac06f8008e9631f;p=moodle.git MDL-17491 oci native driver: prevent get_columns() to execute huge queries and fix return binding to proper SQLT_INT. Truncation was happening with LONG! --- diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 2aa6ab103a..289600562c 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -369,6 +369,10 @@ class oci_native_moodle_database extends moodle_database { return $this->columns[$table]; } + if (!$table) { // table not specified, return empty array directly + return array(); + } + $this->columns[$table] = array(); $tablename = strtoupper($this->prefix.$table); @@ -1066,7 +1070,7 @@ class oci_native_moodle_database extends moodle_database { $stmt = $this->parse_query($sql); $descriptors = $this->bind_params($stmt, $params, $table); if ($returning) { - oci_bind_by_name($stmt, ":oracle_id", $id, -1, SQLT_LNG); + oci_bind_by_name($stmt, ":oracle_id", $id, -1, SQLT_INT); } $result = oci_execute($stmt, $this->commit_status); $this->free_descriptors($descriptors);