eBookingServices / mysql-lited

Lightweight native mysql driver written in D
MIT License
24 stars 9 forks source link

Problems using inserter with OnDuplicate.Ignore. #8

Open TheFlyingFiddle opened 7 years ago

TheFlyingFiddle commented 7 years ago

When I run the following code:

auto client = new MySQLClient(...); auto con = clieck.lockConnection();

con.use(my_db); auto insert = inserter(con, OnDuplicate.Ignore, "users", "googleID"); foreach(i; 30 .. 40) { insert.row(i); } insert.flush;

I get the following error on the flush call: core.exception.AssertError@.dub\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\packet.d(53): Assertion failure

0x0059A99B in _d_assert 0x0048E071 in void mysql.packet.InputPacket.skip(uint) at dub\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\packet.d(54) 0x00477FD9 in D5mysql10connection84__T10ConnectionTS5mysql6socket10VibeSocketVE5mysql10connection17ConnectionA0698ACEAD000617DF0366730C40E1B2 at dub\packages\mysql-lited-0.3.15\mysql-lited\src\mysql\connection.d(691)


The table looks like this: create table users ( id int auto_increment, googleID bigint unsigned unique, primary key(id))

When I use OnDuplicate.Error everything works fine. (unless i have duplicates ofc)
Am I using the inserter wrong or is there something else that is problematic?

TheFlyingFiddle commented 7 years ago

This works as expected: foreach(i; 30 .. 40) { con.execute("insert ignore into users(googleID) values (?)", i); }