Code Duplication    Length = 18-24 lines in 2 locations

class/adodb.php 1 location

@@ 976-993 (lines=18) @@
973
	 * @param	string	$tbl
974
	 * @return	boolean
975
	 */
976
	public function TblExists ($tbl) {
977
		if ($this->IsDbSybase()) {
978
			$sql = "select count(1) as c from sysobjects where name = '$tbl' and type = 'U'";
979
			$rs = $this->Execute($sql);
980
			return (0 != $rs->fields['c']);
981
		}
982
		elseif ($this->IsDbMysql()) {
983
			$sql = "SHOW TABLES LIKE '$tbl'";
984
			$rs = $this->Execute($sql);
985
			return (0 != $rs->RowCount());
986
		}
987
		else {
988
			// :NOTICE: Un-tested method
989
			$sql = "select 1 from $tbl";
990
			$rs = $this->Execute($sql);
991
			return (0 == $this->ErrorNo());
992
		}
993
	} // end of func TblExists
994
995
996
	/**

src/Fwlib/Bridge/Adodb.php 1 location

@@ 1159-1182 (lines=24) @@
1156
     * @param   string  $table
1157
     * @return  boolean
1158
     */
1159
    public function isTableExist($table)
1160
    {
1161
        $table = addslashes($table);
1162
1163
        // @codeCoverageIgnoreStart
1164
        if ($this->isDbSybase()) {
1165
            $sql = "SELECT count(1) AS c FROM sysobjects WHERE name =
1166
                '{$table}' AND type = 'U'";
1167
            $rs = $this->execute($sql);
1168
            return (0 != $rs->fields['c']);
1169
1170
        } elseif ($this->isDbMysql()) {
1171
            $sql = "SHOW TABLES LIKE '$table'";
1172
            $rs = $this->execute($sql);
1173
            return (0 != $rs->RowCount());
1174
1175
        } else {
1176
            // :THINK: Better method ?
1177
            $sql = "SELECT 1 FROM $table";
1178
            $this->execute($sql);
1179
            return (0 == $this->conn->ErrorNo());
1180
        }
1181
        // @codeCoverageIgnoreEnd
1182
    }
1183
1184
1185
    /**