xerial/sqlite-jdbc

Insert String value to Integer column

looly opened this issue · 1 comments

Describe the bug

When I use JDBC to build a PreparedStatement and use setObject method to insert to database, a String value can insert to a Integer column.

To Reproduce

I use Hutool wrap the sql and insert to db.

final Db db = Db.of(DbConfig.of().setUrl("jdbc:sqlite:d:/test/test.db"));
db.insert(Entity.of("user").set("age", "testStr2"));

and age column is a INTEGER column.

image

image

Expected behavior
A clear and concise description of what you expected to happen.

Logs

Environment (please complete the following information):

  • OS: Windows 11
  • CPU x86_64
  • sqlite-jdbc version 3.46.0.0

Additional context

SQLite doesn't care about types.