Code Duplication    Length = 8-8 lines in 2 locations

sources/database/Db-mysql.class.php 1 location

@@ 718-725 (lines=8) @@
715
716
		// Create the mold for a single row insert.
717
		$insertData = '(';
718
		foreach ($columns as $columnName => $type)
719
		{
720
			// Are we restricting the length?
721
			if (strpos($type, 'string-') !== false)
722
				$insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
723
			else
724
				$insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName);
725
		}
726
		$insertData = substr($insertData, 0, -2) . ')';
727
728
		// Create an array consisting of only the columns.

sources/database/Db-postgresql.class.php 1 location

@@ 617-624 (lines=8) @@
614
		{
615
			// Create the mold for a single row insert.
616
			$insertData = '(';
617
			foreach ($columns as $columnName => $type)
618
			{
619
				// Are we restricting the length?
620
				if (strpos($type, 'string-') !== false)
621
					$insertData .= sprintf('SUBSTRING({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName);
622
				else
623
					$insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName);
624
			}
625
			$insertData = substr($insertData, 0, -2) . ')';
626
627
			// Create an array consisting of only the columns.