/** * 更新数据 * @access public * @param string $table 表名 * @param array $data 数据 * @param mixed $condition 条件(数组或字符串) * @param bool $unbuffered 是否不获取/缓存结果 默认false(获取/缓存结果 ) * @param bool $low_priority 是否延迟 默认为false * @return mixed */ function update($table, $data, $condition, $unbuffered = false, $low_priority = false) { $sql = FDB::implodeFieldValue($data); $cmd = "UPDATE " . ($low_priority ? 'LOW_PRIORITY' : ''); $table = FDB::table($table); $where = ''; if (empty($condition)) { $where = '1'; } elseif (is_array($condition)) { $where = FDB::implodeFieldValue($condition, ' AND '); } else { $where = $condition; } $res = FDB::query("{$cmd} {$table} SET {$sql} WHERE {$where}", $unbuffered ? 'UNBUFFERED' : ''); return $res; }