[Vtigercrm-commits] [vtiger-commits] r4059 - /vtigercrm/branches/4.2/adodb/adodb.inc.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Mar 7 03:05:44 EST 2006


Author: mfedyk
Date: Tue Mar  7 01:05:43 2006
New Revision: 4059

Log:
reduce adodb memory usage to enable larger BLOB uploads

Modified:
    vtigercrm/branches/4.2/adodb/adodb.inc.php

Modified: vtigercrm/branches/4.2/adodb/adodb.inc.php
==============================================================================
--- vtigercrm/branches/4.2/adodb/adodb.inc.php (original)
+++ vtigercrm/branches/4.2/adodb/adodb.inc.php Tue Mar  7 01:05:43 2006
@@ -801,6 +801,8 @@
 			$element0 = reset($inputarr);
 			# is_object check because oci8 descriptors can be passed in
 			$array_2d = is_array($element0) && !is_object(reset($element0));
+			//remove extra memory copy of input -mikefedyk
+			unset($element0);
 			
 			if (!is_array($sql) && !$this->_bindInputArray) {
 				$sqlarr = explode('?',$sql);
@@ -808,12 +810,14 @@
 				if (!$array_2d) $inputarr = array($inputarr);
 				foreach($inputarr as $arr) {
 					$sql = ''; $i = 0;
-					foreach($arr as $v) {
+					//Use each() instead of foreach to reduce memory usage -mikefedyk
+					while(list(, $v) = each($arr)) {
 						$sql .= $sqlarr[$i];
 						// from Ron Baldwin <ron.baldwin#sourceprose.com>
 						// Only quote string types	
 						$typ = gettype($v);
 						if ($typ == 'string')
+							//New memory copy of input created here -mikefedyk
 							$sql .= $this->qstr($v);
 						else if ($typ == 'double')
 							$sql .= str_replace(',','.',$v); // locales fix so 1.1 does not get converted to 1,1
@@ -892,6 +896,7 @@
 		$rs->connection = &$this; // Pablo suggestion
 		$rs->Init();
 		if (is_array($sql)) $rs->sql = $sql[0];
+		//New memory copy of input created here -mikefedyk
 		else $rs->sql = $sql;
 		if ($rs->_numOfRows <= 0) {
 		global $ADODB_COUNTRECS;





More information about the vtigercrm-commits mailing list