-
Notifications
You must be signed in to change notification settings - Fork 156
feat(数据源): 数据源打包剔除JDBC驱动,以方便使用自己的JDBC驱动版本 #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| backup | ||
| deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| @echo off | ||
| echo collect begin ... | ||
|
|
||
| set src_path=.. | ||
| set dst_path=.\deploy | ||
| set target_dir=target | ||
|
|
||
| :: 脚本功能 | ||
| :: 将打包的结果收集到 deploy 目录中,并将原来的 deploy 目录移动到 backup 目录 | ||
| :: 也就是说,deploy 是最新的打包结果,backup 是上一次打包结果 | ||
|
|
||
| mkdir %dst_path% | ||
| mkdir .\backup | ||
|
|
||
| rd /q /s .\backup | ||
| move /Y %dst_path% .\backup | ||
|
|
||
| rd /q /s %dst_path% | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| mkdir %dst_path% | ||
|
|
||
| rd %src_path%\%target_dir% | ||
| for /F %%i in ('dir /S /B %src_path%\%target_dir%') do ( | ||
|
|
||
| for /F %%j in ('dir /B %%i\*.jar') do ( | ||
| echo copy /B /Y %%i\%%j %dst_path%\ | ||
| copy /B /Y %%i\%%j %dst_path%\ | ||
| ) | ||
| for /F %%j in ('dir /B %%i\*.war') do ( | ||
| echo copy /B /Y %%i\%%j %dst_path%\ | ||
| copy /B /Y %%i\%%j %dst_path%\ | ||
| ) | ||
| for /F %%j in ('dir /B %%i\*.tar') do ( | ||
| echo copy /B /Y %%i\%%j %dst_path%\ | ||
| copy /B /Y %%i\%%j %dst_path%\ | ||
| ) | ||
| for /F %%j in ('dir /B %%i\*.gz') do ( | ||
| echo copy /B /Y %%i\%%j %dst_path%\ | ||
| copy /B /Y %%i\%%j %dst_path%\ | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| echo collect done. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| package com.alibaba.nacos.plugin.datasource.dialect; | ||
|
|
||
| import com.alibaba.nacos.plugin.datasource.constants.DatabaseTypeConstant; | ||
| import com.alibaba.nacos.plugin.datasource.enums.mysql.TrustedMysqlFunctionEnum; | ||
|
|
||
| /** | ||
| * kingbase database dialect. | ||
|
|
@@ -14,4 +15,9 @@ public class KingbaseDatabaseDialect extends AbstractDatabaseDialect { | |
| public String getType() { | ||
| return DatabaseTypeConstant.KINGBASE; | ||
| } | ||
|
|
||
| @Override | ||
| public String getFunction(String functionName) { | ||
| return TrustedMysqlFunctionEnum.getFunctionByName(functionName); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 应使用与Kingbase数据库相关的函数枚举类,而不是复用MySQL的函数枚举。
📋 问题详情在 💡 解决方案修改 - return TrustedMysqlFunctionEnum.getFunctionByName(functionName);
+ return KingbaseFunctionEnum.getFunctionByName(functionName);
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| package com.alibaba.nacos.plugin.datasource.dialect; | ||
|
|
||
| import com.alibaba.nacos.plugin.datasource.constants.DatabaseTypeConstant; | ||
| import com.alibaba.nacos.plugin.datasource.impl.enums.GaussdbFunctionEnum; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| /** | ||
| * PostgreSQL database dialect. | ||
|
|
@@ -49,4 +50,9 @@ public String getLimitPageSqlWithOffset(String sql, int startOffset, int pageSiz | |
| return sql + " OFFSET " + startOffset + " LIMIT " + pageSize; | ||
| } | ||
|
|
||
| @Override | ||
| public String getFunction(String functionName) { | ||
| return GaussdbFunctionEnum.getFunctionByName(functionName); | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
批处理脚本在移动目录前未检查目标目录是否存在。
📋 问题详情
在执行
move /Y %dst_path% .�ackup之前没有检查%dst_path%目录是否存在,如果该目录不存在,move命令会报错。应该先检查目录是否存在再执行移动操作。💡 解决方案
在移动目录前添加条件判断以避免错误。
有用意见👍 | 无用意见👎 | 错误意见❌