We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
JDK版本: jdk_8_311 hutool版本: 5.8.27
hutool DB 与 sqlite 搭配使用时,即使数据类型对不上也能插入成功?下面是测试代码和Navicat中看到的情况,如果直接在Navicat写插入语句是无法插入的
public static int addProduct(String name, int price, int num) { try { return Db.use().insert(Entity.create("product").set("cid", "test01").set("name", "test02").set("price", "test03").set("num", "test04")); } catch (SQLException e) { return 0; } }
表结构
The text was updated successfully, but these errors were encountered:
经过测试,确实会在定义int类型字段中插入字符串。
应该是Sqlite的JDBC驱动没有做类型检查导致的。
Hutool对参数本质上是调用的PreparedStatement.setObject,如果驱动未做类型检查,那可能就直接插入。
PreparedStatement.setObject
Sorry, something went wrong.
@xiaoACE6716 我给sqlite-jdbc 提issue了,你可以随时关注:
xerial/sqlite-jdbc#1143
@xiaoACE6716
简洁ming明了的回答。
No branches or pull requests
版本情况
JDK版本: jdk_8_311
hutool版本: 5.8.27
问题描述(包括截图)
hutool DB 与 sqlite 搭配使用时,即使数据类型对不上也能插入成功?下面是测试代码和Navicat中看到的情况,如果直接在Navicat写插入语句是无法插入的
表结构
The text was updated successfully, but these errors were encountered: