catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.84k stars 1.15k forks source link

Insert always works (casts data) #893

Open safinahmed opened 4 years ago

safinahmed commented 4 years ago

Describe the bug I have a simple table defined as such CREATE TABLEaccount( user_nameTINYINT(4) NOT NULL, emailDATE NOT NULL ) My code is also simple from the documentation $database->insert("account", [ "user_name" => "foo", "email" => "foo@bar.com" ]);

I was expecting this to fail as neither user_name nor email fits the datatype defined in the database, but Medoo seems to always be casting (converting) the data types, so I get a row with 0, 0000-00-00 How can I force this to be an error? I've tried adding this to the configuration, but still get success 'option' => [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ]

Information

harryqt commented 4 years ago

Hmm. Interesting. Did you figured out why?