Code Duplication    Length = 18-21 lines in 2 locations

class/sql_generator.php 1 location

@@ 549-569 (lines=21) @@
546
	 * 						Array($k=>$v) means 'SET $k = $v, ' in sql,
547
	 * @return string
548
	 */
549
	protected function GenSqlArraySet($param)
550
	{
551
		$sql = '';
552
		if (is_array($param) && !empty($param))
553
		{
554
			foreach ($param as $k=>$v)
555
			{
556
				$sql .= ", $k = " . $this->GenSqlQuote($this->sUpdate, $k, $v);
557
			}
558
			$sql = ' SET ' . substr($sql, 2);
559
		}
560
		else
561
		{
562
			// If you fogot 'SET ', I add for you
563
			if ('SET ' != substr(strtoupper(trim($param)), 0, 4))
564
				$sql .= ' SET ';
565
			$sql .= $param;
566
		}
567
568
		return $sql;
569
	} // end of func GenSqlArraySet
570
571
572
	/**

src/Fwlib/Db/SqlGenerator.php 1 location

@@ 291-308 (lines=18) @@
288
     *                      Array($k=>$v) means 'SET $k = $v, ' in sql,
289
     * @return string
290
     */
291
    protected function genSqlArraySet($param)
292
    {
293
        $sql = '';
294
        if (!empty($param) && is_array($param)) {
295
            foreach ($param as $k => $v) {
296
                $sql .= ", $k = " . $this->genSqlQuote($this->paramPart['UPDATE'], $k, $v);
297
            }
298
            $sql = ' SET ' . substr($sql, 2);
299
        } else {
300
            // String param, add 'SET ' if user forgot
301
            if ('SET ' != substr(strtoupper(trim($param)), 0, 4)) {
302
                $sql .= ' SET ';
303
            }
304
            $sql .= $param;
305
        }
306
307
        return $sql;
308
    }
309
310
311
    /**