Code Duplication    Length = 13-18 lines in 2 locations

demos/blog/protected/Common/BlogDataModule.php 2 locations

@@ 437-449 (lines=13) @@
434
		return $comments;
435
	}
436
437
	public function queryCommentsByPostID($id)
438
	{
439
		$sql="SELECT * FROM tblComments WHERE post_id=? ORDER BY create_time DESC";
440
		$command=$this->_db->createCommand($sql);
441
		$command->bindValue(1, $id);
442
443
		$rows=$command->query();
444
445
		$comments=array();
446
		foreach($rows as $row)
447
			$comments[]=$this->populateCommentRecord($row);
448
		return $comments;
449
	}
450
451
	public function insertComment($comment)
452
	{
@@ 520-537 (lines=18) @@
517
		return $cats;
518
	}
519
520
	public function queryCategoriesByPostID($postID)
521
	{
522
		$sql="SELECT a.id AS id,
523
				a.name AS name,
524
				a.description AS description,
525
				a.post_count AS post_count
526
				FROM tblCategories a, tblPost2Category b
527
				WHERE a.id=b.category_id AND b.post_id=? ORDER BY a.name";
528
529
		$command=$this->_db->createCommand($sql);
530
		$command->bindValue(1, $postID);
531
		$rows=$command->query();
532
533
		$cats=array();
534
		foreach($rows as $row)
535
			$cats[]=$this->populateCategoryRecord($row);
536
		return $cats;
537
	}
538
539
	public function queryCategoryByID($id)
540
	{