安装redmine1.0版本时候,出现2个错误,处理方式如下:

本文介绍了解决Rails环境下MySQL兼容性问题的方法,包括替换libmysql.dll解决DLL错误及调整MySQL配置避免BLOB/TEXT默认值错误。
[b] 1、会出现无法找到libmysql.dll错误[/b]

在Windows下,如果使用了mysql 5.1,不但在安装mysql.gem时候会报ri和rdoc的错误,而且在执行 rake db:migrate时候也会报错:


这是由于mysql5.1里面所带的libmySQL.dll和rails不兼容(至少在2.3.5还是如此)。可以从网上下载一个旧版本的libmySQL.dll,将其放到ruby的bin目录即可。

下载地址:

http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll

[b]2、安装时候,会出现Mysql::Error: BLOB/TEXT column 'description' can't have a default value: ALTER TABLE `projects` CHANGE `description` `description` text DEFAULT ''[/b]
这个问题可以如下解决:
I think your problem in issues controller is not the same question with my migration error.

to JP Lang:
I have resolved my migration error by some irregular method. Please note:
1. MySQL 5.0 and 5.1 will not allow default value for BLOB/TEXT column.
2. If MySQL is working in strict mode, it will report an error on a TEXT column's default value and stop. While if its work mode is not strict mode(maybe sql_mode=""), it will just give out a warning instead of an error and the sql command will be executed successfully.
3. MySQL 5.0 binary installed on windows will work in strict mode in default. While it will not work in strict mode on linux compiled from source.(I'm not sure with linux because I use windows xp)
4. So maybe most of the redmine's users wouldn't encounter this problem...

So, to windows users of redmine, if you have encountered my problem, there is a solution:
1. find your mysql server's ini file, will be "MySQL\MySQL Server 5.0\my.ini" in default.,找到my.ini文件
2. locate this line: sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
3. add a "#" to the head: #sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
4. restart mysql server
5. run rake db:migrate, it should succeed this time
6. change the my.ini file back and restart mysql server
导出功能再切割subject的时候直接标题中的【】去掉了,导致主题显示不完全,有什么办法优化吗 ,完整主题如下 # 构建完整主题 complete_subject = ( f"【{data['ISP名称'][index].strip()}】" f"【{data['区域'][index].strip()}】" f"【{data['机型'][index].strip()}】" f"{data['主题'][index].strip()}" ) ,但是现在光主题中的【】也被过滤,例如【ITWIND3】【意大利】【XB432v 1.0】【定制】收到486 SIP消息播忙音,导出变成【ITWIND3】【意大利】【XB432v 1.0】定制 实现如下 def export_data(self): def async_export(): try: self.progress.start() # 获取用户自定义文件名 filename = filedialog.asksaveasfilename( defaultextension=".xlsx", filetypes=[("Excel文件", "*.xlsx")], initialfile="redmine.xlsx" ) if not filename: return # 初始化Excel wb = op.Workbook() ws = wb.active #ws.title = "Function" total_rows = 0 # 添加表头(带错误处理) try: head1 = ['任务id','ISP名称','区域','机型','跟踪','主题','描述','状态','优先级','指派给','功能类别','目标版本','父任务','开始日期','计划完成日期','预期时间','%完成','源头团队','需求组评估工作量','项目组评估工作量','实际执行工作量','源头状态','源头机型','业务模块','任务类别','备注','文件','跟踪者','是否推送平台','验收平台版本'] head2 = ['(必填)','(必填)','(必填)','(必填)','(必填)','(必填)','(必填)','(默认值)','(必填)','(不填)','(必填)','(不填)','(必填)','(不填)','(不填)','(不填)','(不填)','(默认值)','(选填)','(必填)','(选值)','(不填)','(不填)','(不填)','(默认值)','(不填)','(不填)','(不填)','(必填)','(必填)'] ws.append(head1) ws.append(head2) except Exception as e: self.append_output(f"表头创建失败:{str(e)}") return # 获取项目数据(带进度更新) try: project = self.controller.redmine.project.get(defaultProjectName) self.append_output(f"正在获取项目数据:{project.name}") issues = self.controller.redmine.issue.filter(project_id=project.id) except Exception as e: self.append_output(f"获取项目数据失败:{str(e)}") return #分割subject def split_subject(str): result= re.split(r'[【](.*?)[】]', str.strip()) result=list(filter(None,result)) return result # 新增getd函数定义 def getd(issue_id): try: issue = self.controller.redmine.issue.get(issue_id, include=['children'])#预加载子任务 res = split_subject(issue.subject) # 获取并补充缺失的字段 req_workload = issue.custom_fields.get(31).value if issue.custom_fields.get(31) else None proj_workload = issue.custom_fields.get(32).value if issue.custom_fields.get(32) else None act_workload = issue.custom_fields.get(33).value if issue.custom_fields.get(33) else None push_platform_workload = issue.custom_fields.get(23).value if issue.custom_fields.get(23) else None platform_pass_workload = issue.custom_fields.get(37).value if issue.custom_fields.get(37) else None return [ issue.id, res[0], # ISP名称 res[1], # 区域 res[2], # 机型 issue.tracker.name, # 跟踪类型 res[3], # 主题 issue.description or '', # 空值处理 issue.status.name, # 状态 issue.priority.name, # 优先级 issue.author.name, issue.custom_fields.get(24).value if issue.custom_fields.get(24) else '', # 功能类别 None, # 目标版本 issue.parent.id if issue.parent else '', issue.start_date.strftime('%Y-%m-%d') if issue.start_date else '', None, # 计划完成日期 None, # 预期时间 issue.done_ratio, issue.custom_fields.get(8).value, # 源头团队 req_workload, # 需求组评估工作量 proj_workload, # 项目组评估工作量 act_workload, # 实际执行工作量 None, # 源头状态 None, # 源头机型 None, # 业务模块 None, # 任务类别 None, # 备注 None, # 文件 None, # 跟踪者 push_platform_workload, platform_pass_workload ] except Exception as e: self.append_output(f"任务{issue_id}数据处理异常:{str(e)}") return [] # 处理数据(带进度显示) total = len(issues) for i, issue in enumerate(issues): try: # 更新进度 self.after(0, lambda: self.progress.configure(value=(i+1)/total*100)) # 处理子任务 if self.id_entry.get().strip() == str(issue.id): for c in issue.children:# 在处理数据处增加计数 ws.append(getd(c.id)) total_rows +=1 for cc in c.children: ws.append(getd(cc.id)) total_rows +=1 except (ResourceNotFoundError, ResourceAttrError) as e: self.append_output(f"处理任务{issue.id}时出错:{str(e)}") except Exception as e: self.append_output(f"未知错误:{str(e)}") # 在循环外输出统计信息(避免每次循环都输出) self.append_output(f"成功写入{total_rows}行数据") # 保存文件 try: wb.save(filename) self.append_output(f"文件已保存至:{filename}") except Exception as e: self.append_output(f"保存文件失败:{str(e)}") # Excel导出时及时释放资源 wb.close() del wb finally: self.progress.stop() self.progress["value"] = 0 # 在子线程中执行导出操作 Thread(target=async_export).start()
最新发布
09-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值