Code Duplication    Length = 30-31 lines in 9 locations

web_interface/astpp/system/database/drivers/cubrid/cubrid_driver.php 1 location

@@ 497-526 (lines=30) @@
494
	 * @param	string
495
	 * @return	string
496
	 */
497
	function _escape_identifiers($item)
498
	{
499
		if ($this->_escape_char == '')
500
		{
501
			return $item;
502
		}
503
504
		foreach ($this->_reserved_identifiers as $id)
505
		{
506
			if (strpos($item, '.'.$id) !== FALSE)
507
			{
508
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
509
510
				// remove duplicates if the user already included the escape
511
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
512
			}
513
		}
514
515
		if (strpos($item, '.') !== FALSE)
516
		{
517
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
518
		} else
519
		{
520
			$str = $this->_escape_char.$item.$this->_escape_char;
521
		}
522
523
		// remove duplicates if the user already included the escape
524
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
525
	}
526
527
	// --------------------------------------------------------------------
528
529
	/**

web_interface/astpp/system/database/drivers/mssql/mssql_driver.php 1 location

@@ 471-500 (lines=30) @@
468
	 * @param	string
469
	 * @return	string
470
	 */
471
	function _escape_identifiers($item)
472
	{
473
		if ($this->_escape_char == '')
474
		{
475
			return $item;
476
		}
477
478
		foreach ($this->_reserved_identifiers as $id)
479
		{
480
			if (strpos($item, '.'.$id) !== FALSE)
481
			{
482
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
483
484
				// remove duplicates if the user already included the escape
485
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
486
			}
487
		}
488
489
		if (strpos($item, '.') !== FALSE)
490
		{
491
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
492
		} else
493
		{
494
			$str = $this->_escape_char.$item.$this->_escape_char;
495
		}
496
497
		// remove duplicates if the user already included the escape
498
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
499
	}
500
501
	// --------------------------------------------------------------------
502
503
	/**

web_interface/astpp/system/database/drivers/mysql/mysql_driver.php 1 location

@@ 486-515 (lines=30) @@
483
	 * @param	string
484
	 * @return	string
485
	 */
486
	function _escape_identifiers($item)
487
	{
488
		if ($this->_escape_char == '')
489
		{
490
			return $item;
491
		}
492
493
		foreach ($this->_reserved_identifiers as $id)
494
		{
495
			if (strpos($item, '.'.$id) !== FALSE)
496
			{
497
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
498
499
				// remove duplicates if the user already included the escape
500
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
501
			}
502
		}
503
504
		if (strpos($item, '.') !== FALSE)
505
		{
506
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
507
		} else
508
		{
509
			$str = $this->_escape_char.$item.$this->_escape_char;
510
		}
511
512
		// remove duplicates if the user already included the escape
513
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
514
	}
515
516
	// --------------------------------------------------------------------
517
518
	/**

web_interface/astpp/system/database/drivers/mysqli/mysqli_driver.php 1 location

@@ 483-512 (lines=30) @@
480
	 * @param	string
481
	 * @return	string
482
	 */
483
	function _escape_identifiers($item)
484
	{
485
		if ($this->_escape_char == '')
486
		{
487
			return $item;
488
		}
489
490
		foreach ($this->_reserved_identifiers as $id)
491
		{
492
			if (strpos($item, '.'.$id) !== FALSE)
493
			{
494
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
495
496
				// remove duplicates if the user already included the escape
497
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
498
			}
499
		}
500
501
		if (strpos($item, '.') !== FALSE)
502
		{
503
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
504
		} else
505
		{
506
			$str = $this->_escape_char.$item.$this->_escape_char;
507
		}
508
509
		// remove duplicates if the user already included the escape
510
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
511
	}
512
513
	// --------------------------------------------------------------------
514
515
	/**

web_interface/astpp/system/database/drivers/oci8/oci8_driver.php 1 location

@@ 575-604 (lines=30) @@
572
	 * @param	string
573
	 * @return	string
574
	 */
575
	protected function _escape_identifiers($item)
576
	{
577
		if ($this->_escape_char == '')
578
		{
579
			return $item;
580
		}
581
582
		foreach ($this->_reserved_identifiers as $id)
583
		{
584
			if (strpos($item, '.'.$id) !== FALSE)
585
			{
586
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
587
588
				// remove duplicates if the user already included the escape
589
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
590
			}
591
		}
592
593
		if (strpos($item, '.') !== FALSE)
594
		{
595
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
596
		} else
597
		{
598
			$str = $this->_escape_char.$item.$this->_escape_char;
599
		}
600
601
		// remove duplicates if the user already included the escape
602
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
603
	}
604
605
	// --------------------------------------------------------------------
606
607
	/**

web_interface/astpp/system/database/drivers/odbc/odbc_driver.php 1 location

@@ 441-470 (lines=30) @@
438
	 * @param	string
439
	 * @return	string
440
	 */
441
	function _escape_identifiers($item)
442
	{
443
		if ($this->_escape_char == '')
444
		{
445
			return $item;
446
		}
447
448
		foreach ($this->_reserved_identifiers as $id)
449
		{
450
			if (strpos($item, '.'.$id) !== FALSE)
451
			{
452
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
453
454
				// remove duplicates if the user already included the escape
455
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
456
			}
457
		}
458
459
		if (strpos($item, '.') !== FALSE)
460
		{
461
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
462
		} else
463
		{
464
			$str = $this->_escape_char.$item.$this->_escape_char;
465
		}
466
467
		// remove duplicates if the user already included the escape
468
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
469
	}
470
471
	// --------------------------------------------------------------------
472
473
	/**

web_interface/astpp/system/database/drivers/pdo/pdo_driver.php 1 location

@@ 510-540 (lines=31) @@
507
	 * @param	string
508
	 * @return	string
509
	 */
510
	function _escape_identifiers($item)
511
	{
512
		if ($this->_escape_char == '')
513
		{
514
			return $item;
515
		}
516
517
		foreach ($this->_reserved_identifiers as $id)
518
		{
519
			if (strpos($item, '.'.$id) !== FALSE)
520
			{
521
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
522
523
				// remove duplicates if the user already included the escape
524
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
525
			}
526
		}
527
528
		if (strpos($item, '.') !== FALSE)
529
		{
530
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
531
			
532
		} else
533
		{
534
			$str = $this->_escape_char.$item.$this->_escape_char;
535
		}
536
537
		// remove duplicates if the user already included the escape
538
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
539
	}
540
541
	// --------------------------------------------------------------------
542
543
	/**

web_interface/astpp/system/database/drivers/postgre/postgre_driver.php 1 location

@@ 486-515 (lines=30) @@
483
	 * @param	string
484
	 * @return	string
485
	 */
486
	function _escape_identifiers($item)
487
	{
488
		if ($this->_escape_char == '')
489
		{
490
			return $item;
491
		}
492
493
		foreach ($this->_reserved_identifiers as $id)
494
		{
495
			if (strpos($item, '.'.$id) !== FALSE)
496
			{
497
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
498
499
				// remove duplicates if the user already included the escape
500
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
501
			}
502
		}
503
504
		if (strpos($item, '.') !== FALSE)
505
		{
506
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
507
		} else
508
		{
509
			$str = $this->_escape_char.$item.$this->_escape_char;
510
		}
511
512
		// remove duplicates if the user already included the escape
513
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
514
	}
515
516
	// --------------------------------------------------------------------
517
518
	/**

web_interface/astpp/system/database/drivers/sqlite/sqlite_driver.php 1 location

@@ 455-484 (lines=30) @@
452
	 * @param	string
453
	 * @return	string
454
	 */
455
	function _escape_identifiers($item)
456
	{
457
		if ($this->_escape_char == '')
458
		{
459
			return $item;
460
		}
461
462
		foreach ($this->_reserved_identifiers as $id)
463
		{
464
			if (strpos($item, '.'.$id) !== FALSE)
465
			{
466
				$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);
467
468
				// remove duplicates if the user already included the escape
469
				return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
470
			}
471
		}
472
473
		if (strpos($item, '.') !== FALSE)
474
		{
475
			$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
476
		} else
477
		{
478
			$str = $this->_escape_char.$item.$this->_escape_char;
479
		}
480
481
		// remove duplicates if the user already included the escape
482
		return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
483
	}
484
485
	// --------------------------------------------------------------------
486
487
	/**