lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.44k stars 513 forks source link

linux下sqlshell直接执行sql语句报错 #180

Closed ContyChen closed 1 year ago

ContyChen commented 1 year ago

wsl环境下运行sqlshell 直接执行语句报错: image

./sqlshell.sh -url jdbc:lealone:tcp://127.0.0.1/lealone -user root -sql "select 1" 错误信息: Options are case sensitive. Supported options are:

[-help] or [-?] Print the list of options [-url ""] The database URL (jdbc:lealone:...) [-user ] The user name [-password ] The password [-database ] The database [-sql ""] Execute the SQL statements and exit

If special characters don't work as expected, you may need to use -Dfile.encoding=UTF-8 (Mac OS X) or CP850 (Windows).

Connection closed

codefollower commented 1 year ago

我在最新的 lealone 5.2 中已经加了错误提示,用 5.2 跑,错误提示是: Unsupported option: 1 说明在 wsl 中执行 shell 时,-sql "select 1" 被当成了3个参数,变成 -sql select 1 了,这个确实有点奇怪, 说明用 $@ 来接收参数并不能完整解析 "select 1",如果在 windows 10 里执行 sqlshell.bat 是没问题的,会把 "select 1" 当成一个整体。

qdongxu commented 1 year ago

linux 上加上引号,"$@" 往下传递,但是不知道在Windows 下是否兼容这个用法。

codefollower commented 1 year ago

linux 上加上引号,"$@" 往下传递,但是不知道在Windows 下是否兼容这个用法。

我试了,在多个 sh 文件中全加上 "$@" 确实可以,漏加一个都不行。