xerial / sqlite-jdbc

SQLite JDBC Driver
Apache License 2.0
2.86k stars 619 forks source link

Insert String value to Integer column #1143

Closed looly closed 4 months ago

looly commented 4 months ago

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):

Additional context

gotson commented 4 months ago

SQLite doesn't care about types.